remove inventory based testing

The inventory based testing for create-diff-object was introduced at a
time when create-diff-object only needed the two object files to operate.
Now, it requires vmlinux as well.  This makes the inventory testing (a
unit testing framework for create-diff-object) obsolete and difficult to
update in it's current form.

This commit removes the inventory test framework.

Signed-off-by: Seth Jennings <sjenning@redhat.com>
Merge pull request #212 from spartacus06/remove-inventory-test-framework

remove inventory based testing
kmod/patch: export patched functions information via sysfs

This feature is implemented as:
```
[root@localhost kpatch]# insmod ./kpatch-meminfo.ko
[root@localhost kpatch]# ls /sys/kernel/kpatch/patches/kpatch_meminfo/functions/meminfo_proc_show/
new_addr  old_addr
[root@localhost kpatch]# cat /sys/kernel/kpatch/patches/kpatch_meminfo/functions/meminfo_proc_show/new_addr
0xffffffffa05211e0
[root@localhost kpatch]# cat /sys/kernel/kpatch/patches/kpatch_meminfo/functions/meminfo_proc_show/old_addr
0xffffffff8125d0e0
```

The patch module init function will allocate and init kpatch_func_obj with
customized kobj_type func_ktype. The attribute new_addr and old_addr of
kpatch_func_obj is attached to this func_ktype, so that these files could
be created by kobject_add automatically.

Signed-off-by: Jincheng Miao <jincheng.miao@gmail.com>
Merge pull request #211 from useidel/master

rebased SPEC file to current version
test: add much quicker combined test option

Combine all the patch modules into a single kpatch-COMBINED.ko for a
much quicker test which still gives 95% or so of the coverage compared
to the full test suite.  Use "make quick" for use this new option.
Merge pull request #213 from jpoimboe/test-combined

test: add much quicker combined test option
correlate symbols also by type

Both unpatched and patched objects may contain FILE
symbol with empty name. This is unexpected for
create-diff-object and could correlate 2 symbols
with same (empty) name but different types:
  sym 00, type 0, bind 0, ndx 00, name  (SAME)
  ...
  sym 425, type 4, bind 0, ndx 65521, name  (SAME)
  ...
  signal.o: changed function: do_rt_tgsigqueueinfo
  signal.o: changed function: do_rt_sigqueueinfo
  signal.o: changed function: get_signal_to_deliver
  signal.o: signal.o: changed section .rela__jump_table not selected for inclusion
  signal.o: 1 unsupported section change(s)
  /root/kpatch/kpatch-build/create-diff-object: unreconcilable difference

Introduce condition to match symbols also by type.

Signed-off-by: Jan Stancek <jstancek@redhat.com>
fix vmlinux parameter for kpatch-build

It was missing in getopt arguments.

Signed-off-by: Jan Stancek <jstancek@redhat.com>
Merge pull request #216 from jstancek/issue203

fix vmlinux parameter for kpatch-build
create-diff-object: percpu support

The -fdata-sections gcc flag doesn't work with objects in the
.data..percpu section.  Any function which uses a percpu variable
references this section, causing the section to get incorrectly included
in the patch module.

Manually convert these section references to object symbol references so
that the needed symbol can be found in vmlinux.

Also, the core module symbol verification code will fail when looking up
a percpu variable, because sprint_symbol doesn't think a percpu address
is a valid kernel address.  So rewrite the symbol verification code to
use kallsyms_on_each_symbol() instead.  It's not ideal performance-wise:
it seems to cost about 1ms per symbol lookup.  I think that's acceptable
for now.  In the future we may want to try to get a better upstream
kallsyms interface.
create-diff-object: fix symbol section indexes

For a local non-included function or object which is needed by an
included function, its symbol table entry will still refer to a local
section index.  Instead it should be changed to SHN_UNDEF.
create-diff-object: improve error message
create-diff-object: generic special section support

Abstract out the common functionality for dealing with special sections
into a new kpatch_process_special_sections() function.

The base sections are partitioned into "groups".  Only those groups
whose relas reference a changed function are kept.  The only difference
in the logic for handling each special section is determining the size
of a given group.  Each section has its own group_size() callback for
this.  It's a callback instead of an integer because one of the
soon-to-be-supported special sections requires that its group sizes be
dynamically determined.
create-diff-object: support fixup and related sections

Add support for the following sections:

- .fixup
- __ex_table
- .altinstructions
- .altinstr_replacement

Fixes #187.
create-diff-object: support tracepoints and related sections

Add support for the following special sections:

- __jump_table
- __tracepoints
- __tracepoints_ptrs
- __tracepoints_strings

Fixes #157.
Merge pull request #215 from jstancek/issue202

correlate symbols also by type
Merge pull request #214 from jpoimboe/special-sections

generic support for special sections
kmod/core: move dynamic relocation writes to new function

Unclutter kpatch_register a little bit.
kmod/core: make loc variable a u64

So less casting is needed.
kmod/core: ensure page is RO before changing its permissions

Make sure we leave the page's execution permissions in the same state we
found them.