Adding preempt_mask.h to core.c

When compiling core.c, it may report error like:
"error: implicit declaration of function ‘in_nmi’"

Adding header file in_nmi defined could avoid this.

Signed-off-by: Jincheng Miao <jincheng.miao@gmail.com>
Merge pull request #141 from ryanmiao/for-issue-140

Adding preempt_mask.h to core.c
add smp_locks support

This commit uses the same approach as the bug table support,
mangling the .smp_locks and .rela.smp_locks sections so that
they only contain entries for changed functions (if any).

Fixes #107

Signed-off-by: Seth Jennings <sjenning@redhat.com>
Merge pull request #143 from spartacus06/smp-locks

add smp_locks support
fix smp_lock support

The initial commit had a bug where the offset field of the
.rela.smp_locks entries was not updated to reflect the correct
offset in the truncated .smp_locks section.

Signed-off-by: Seth Jennings <sjenning@redhat.com>
Merge pull request #144 from spartacus06/smp-locks

fix smp_lock support
add .parainstructions support

Following in the same solution, regenerate [.rela].parainstructions
sections if table entries contain relocations that reference changed
functions (if any).

Fixes #135

Signed-off-by: Seth Jennings <sjenning@redhat.com>
safe kpatch unload

Currently the patch module calls kpatch_unregister in the patch module
exit path.  If the activeness safety check fails in kpatch_unregister,
it's too late for the patch module to stop exiting, so all it can do is
panic.

Prevent this scenario by requiring the user to disable the patch module
via sysfs before allowing the module to be unloaded.  The sysfs write
will fail if the activeness safety check fails.  An rmmod will fail if
the patch is still enabled.

Also add support for this new unloading model in "kpatch unload".
Merge pull request #145 from spartacus06/parainstructions-support

add .parainstructions support
create integration test framework

This is a basic integration test framework for kpatch, which tests
building, loading, and unloading patches, as well as any other related
custom tests.

The kpatch-test script looks for test input files in the
tests/integration directory.  It expects certain file naming
conventions:

- foo.patch - patch that should build successfully

- bar-FAIL.patch - patch that should fail to build

- foo-LOADED.test - executable which tests whether the foo.patch module
  is loaded.  It will be used to test that loading/unloading the patch
  module works as expected.

Any other *.test files will be executed after all the patch modules have
been built from the *.patch files.  They can be used for more custom
tests above and beyond the simple loading and unloading tests.

I just have one test here, but many more to come eventually.  I'm
constantly doing manual testing of patches and am planning on automating
them with this framework.
add include linux/module.h to kpatch.h

Needed for the module and kobject structs.
test: make load/unload errors fatal

No need to accumulate errors if the load or unload fails.  Leaving the
testprog failure non-fatal so that the test will then call unload to
clean up after itself.
Merge pull request #139 from jpoimboe/disable-before-unload

safe kpatch unload
Merge pull request #147 from jpoimboe/integration-tests

create integration test framework