change struct kpatch_patch s/old_addr/old_offset

Make old addresses relative to the start address of the relocatable
kernel or module.

This commit has no functional effect; it just prepares the code for
future acceptance of the module patching support.

Signed-off-by: Seth Jennings <sjenning@redhat.com>
avoid replicating strip logic

Just create a strip feild in the struct symbol the is marked if the
symbol needs to be stripped.

Signed-off-by: Seth Jennings <sjenning@redhat.com>
avoid replicating dynrela logic

Rather than keep the logic in sync between the counting and processing
code in kpatch_create_dynamic_rela_sections() just do a "dumb" count
establishing an upper bound and allocating the buffer, then determine
the actual size (i.e. number of dynrelas) in the processing section.

No functional change intended.

Signed-off-by: Seth Jennings <sjenning@redhat.com>
invert logic to reduce indentation

No functional change.

Signed-off-by: Seth Jennings <sjenning@redhat.com>
exclude UNDEF global syms from lookup_global_symbol

Don't return a result for an UNDEF symbol

Signed-off-by: Seth Jennings <sjenning@redhat.com>
add module patching support to create-diff-object

This commit adds module patching support to create-diff-object by:

1) generalizing the vmlinux CLI parameter
2) adding the kernel object name to each patch and dynrela
3) adding slightly different logic for vmlinux/module in the dynrela
creation

Signed-off-by: Seth Jennings <sjenning@redhat.com>
add module patching support to core module

This commit adds support for patching modules.  If a patch or dynrela is
determined to be for a kernel module, the old_offset/src is not used and
the symbol location is looked up using kallsyms.  The module being
patched is also references to keep if from disappearing from underneath
us.

This commit introduces early and limited support.  The kernel module to
be patched must already be loaded or the patch module will not apply.

Signed-off-by: Seth Jennings <sjenning@redhat.com>
add module for testing module patching

A simple kernel module for testing basic kernel module patching.

Just run doit.sh from test/testmod.

Signed-off-by: Seth Jennings <sjenning@redhat.com>
readme: patches for vdso are not supported

Signed-off-by: Jan Stancek <jstancek@redhat.com>
readme: add missing dependencies for Ubuntu
Merge pull request #229 from jstancek/vdso_doc

readme: patches for vdso are not supported
Merge pull request #205 from terrywang/doc

Add missing dependencies & vmlinux symbolic link for Ubuntu
create-diff-object: support gcc function name mangling

Fixes #189.
Fixes #228.
review changes for module support PR

Signed-off-by: Seth Jennings <sjenning@redhat.com>
Merge pull request #227 from spartacus06/module-patching-support

Module patching support
fix review comments
Merge pull request #230 from jpoimboe/isra

create-diff-object: support gcc function name mangling
kpatch: improve "unload --all" error message

In the case of "kpatch unload --all", just show the usage help instead
of this:

  # kpatch unload --all
  basename: unrecognized option '--all'
  Try 'basename --help' for more information.
  unloading patch module:
  basename: unrecognized option '--all'
  Try 'basename --help' for more information.
  rmmod: ERROR: Module  is builtin.
  kpatch: failed to unload patch --all
kpatch: consistent naming: module vs patch

Try to be more consistent with the naming of patch modules.  They are
patch modules, where patch is the adjective and module is the noun.  So
calling them patches is confusing.
Merge pull request #231 from jpoimboe/unload-all-error

kpatch: a few minor script cleanups