kpatch: make kpatch load & unload work on more distros with less code ;-D
Merge pull request #204 from terrywang/ubuntu

kpatch Ubuntu support and more
create-diff-object: fix symtab sh_info field

This fixes the weird ld errors we've been seeing lately.

According to the "ELF-64 Object File Format" spec, the symtab sh_info
field should contain "Index of first non-local symbol (i.e., number of
local symbols)".
Merge pull request #206 from jpoimboe/symtab-sh-info

create-diff-object: fix symtab sh_info field
fix symbol migration

kpatch_migrate_included_symbols() is called from
kpatch_reorder_symbols() now, not kpatch_migrate_included_elements().
The difference is the kpatch_reorder_symbols() is operating on the
output kpatch_elf structure, and thus all symbols are by definition
included.

Remove the check and rename the function since it is redundant.

Signed-off-by: Seth Jennings <sjenning@redhat.com>
Merge pull request #208 from spartacus06/fix-symbol-migration

fix symbol migration
change matching criteria for NULL sym

Right now the matching criteria for the NULL sym is type LOCAL and shndx
UNDEF.  Unfortunately, that would also match any new LOCAL symbol
added to the symbol table with uninit'd sym.* fields i.e. the upcoming
__kpatch_strings and .kpatch.strings symbols.

Change the matching criteria to be symbols that have a zero-length name;
a property unique to the NULL sym.

Signed-off-by: Seth Jennings <sjenning@redhat.com>
symbol location verification support

This commit introduces functionality to verify the location of symbols
used in both the patch and dynrelas sections.  It adds significant
protection from mismatches between the base and running kernels.

Signed-off-by: Seth Jennings <sjenning@redhat.com>
review fixups

Signed-off-by: Seth Jennings <sjenning@redhat.com>
Merge pull request #209 from spartacus06/symbol-location-verification

Symbol location verification
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>