Commit Graph

25 Commits

Author SHA1 Message Date
Artem Savkov 89a8ac740c Disable git-lfs
While convenient git-lfs has too many restrictions for kpatch's needs.
Remove links to the objectfiles and related configs.

Signed-off-by: Artem Savkov <asavkov@redhat.com>
2018-04-26 15:08:24 +02:00
Artem Savkov 3ee81ec4ee x86_64: integration test objs
Populate x86_64 dir with objectfiles from integration test builds.

Signed-off-by: Artem Savkov <asavkov@redhat.com>
2018-04-13 18:10:34 +02:00
Artem Savkov a05c644c7b Add create-diff-object unittest framework
Add a simple unittest framework for create-diff-object implemented in
GNU Make.
It will automatically scan the kpatch-unit-objs/$(uname -m) directory
for specifically named files running one of 3 tests:
  - creating diff object with expected success
  - creating diff object with expected failure
  - creating diff object and running a shell script on it with expected
  success

Signed-off-by: Artem Savkov <asavkov@redhat.com>
2018-04-13 18:09:37 +02:00
Josh Poimboeuf d4e4258172 gitignore: ignore cache.mk from newer kernel builds
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
2018-03-21 13:22:26 -05:00
Josh Poimboeuf 63a94b8323 gcc-plugin: create a ppc64le GCC plugin which inserts nops after local calls
This is in response to an upstream discussion for the following patch:

  https://lkml.kernel.org/r/1508217523-18885-1-git-send-email-kamalesh@linux.vnet.ibm.com

This should hopefully make it a lot easier for the ppc64le kernel module
code to support klp relocations.

The gcc-common.h and gcc-generate-rtl-pass.h header files are copied
from the upstream Linux source tree.

Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
2017-11-10 09:17:00 -06:00
Jessica Yu 0cc693ba36 create-kpatch-module: add new program that creates kpatch modules
Add new program create-kpatch-module, that, given an intermediate object
outputted by create-diff-object, outputs an object (.o) that contains the
.kpatch.dynrelas section required by kpatch.
2017-01-23 12:43:34 -08:00
Jessica Yu 09d2af5cb4 create-klp-module: add new program that creates patch modules that have klp elements
Add a new program, create-klp-module, that, given a built module (.ko),
will create a patch module with klp rela sections, klp arch sections, and
klp symbols.
2017-01-23 12:43:31 -08:00
Seth Jennings 8b1ae48d7c improve kpatch-build Makefile
Right now, the makefile has one target, create-diff-object, which
contains all the source/headers as one long list and all the source
files compiled in one command to make create-diff-object.

This doesn't scale well and doesn't accurately portray the dependencies
of each object that contribute to the final binary.

This commit renames create-diff-object.c to main.c so that it can be
compiled and linked seperately and cleanly in Make and autogenerates
dependencies for each .o. This should make it easier to add additional
object files, or refactor the very large main.o into seperate object
file, later.
2014-09-23 09:45:04 -05:00
Josh Poimboeuf d7f209f838 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.
2014-05-27 09:40:24 -05:00
Seth Jennings 170c8b1ba1 fix review comments
Signed-off-by: Seth Jennings <sjenning@redhat.com>
2014-05-20 12:44:31 -05:00
Seth Jennings 21fc274448 dynrelas support, obsoleting link-vmlinux-syms
This adds dynamic linking support for the patch modules.  It is the
first step toward supporting patching module code and relocatable
kernels.

Rela entries that reference non-included local and non-exported global
symbols are converted to "dynrelas".  These dynrelas are relocations
that are done by the core module, not the kernel module linker.  This
allows the core module to apply offsets to the base addresses found
in the base vmlinux or module.

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

Conflicts:
	kpatch-build/kpatch-build
2014-05-20 12:44:31 -05:00
Seth Jennings 6b7d576341 merge add-patches-section functionality into create-obj-diff
In preparation for dynamic symbol linking, the symbol lookup logic
is going to move into create-diff-obj anyway.  We might as well
minimize the code duplication and pull this into create-diff-obj.
This avoids having to re-parse the ELF file modify it in-place.

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

Conflicts:
	kpatch-build/kpatch-build
2014-05-20 12:44:30 -05:00
Josh Poimboeuf 5e25365244 Revert #186 (add dynamic symbol linking support)
We merged PR #186 a little too hastily.  It seg faults with the new
parainstructions-section.patch in the integration test suite.  Reverting
it for now until we get it figured out.

This reverts commit e1177e3a03.
This reverts commit 880e271841.
This reverts commit 2de5f6cbfb.
This reverts commit 38b7ac74ad.
This reverts commit 108cd9f95e.
2014-05-15 17:34:16 -05:00
Seth Jennings e1177e3a03 fix review comments
Signed-off-by: Seth Jennings <sjenning@redhat.com>
2014-05-15 13:42:27 -05:00
Seth Jennings 880e271841 dynrelas support, obsoleting link-vmlinux-syms
This adds dynamic linking support for the patch modules.  It is the
first step toward supporting patching module code and relocatable
kernels.

Rela entries that reference non-included local and non-exported global
symbols are converted to "dynrelas".  These dynrelas are relocations
that are done by the core module, not the kernel module linker.  This
allows the core module to apply offsets to the base addresses found
in the base vmlinux or module.

Signed-off-by: Seth Jennings <sjenning@redhat.com>
2014-05-15 13:29:15 -05:00
Seth Jennings 38b7ac74ad merge add-patches-section functionality into create-obj-diff
In preparation for dynamic symbol linking, the symbol lookup logic
is going to move into create-diff-obj anyway.  We might as well
minimize the code duplication and pull this into create-diff-obj.
This avoids having to re-parse the ELF file modify it in-place.

Signed-off-by: Seth Jennings <sjenning@redhat.com>
2014-05-15 13:26:41 -05:00
Josh Poimboeuf b7f32f8ade gitignore *.o.d
When the core module compilation fails, a kmod/core/.core.o.d file
appears.
2014-05-02 15:15:25 -05:00
Josh Poimboeuf 0d2ab160fe 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.
2014-04-26 16:23:05 -05:00
Seth Jennings 15da394a2f add man .gz files to gitignore
Signed-off-by: Seth Jennings <sjenning@redhat.com>
2014-03-27 16:29:14 -05:00
Josh Poimboeuf 8085d0402b build and install core module with make
Build and install the kpatch core module with make and make install,
rather than building it every time with kpatch build.

The only downside to this approach is that the user has to make and make
install kpatch every time they get a new kernel.  But this is only
temporary, until the kpatch module is delivered in an RPM.
2014-02-18 07:44:33 -06:00
Josh Poimboeuf 4f27b9ae31 functional reorganization
Organize the files functionally:
- kmod/core: core kmod source
- kmod/patch: patch kmod source
- kpatch: kpatch script
- kpatch-build: kpatch build script and supporting tools
- contrib: distro-related files
2014-02-13 11:00:06 -06:00
Seth Jennings c2795032d2 add tools binaries to gitignore
Signed-off-by: Seth Jennings <sjenning@redhat.com>
2014-02-11 16:25:34 -06:00
Josh Poimboeuf 04433125bc incremental patching and rmmod support 2013-01-18 12:31:14 -06:00
Josh Poimboeuf 8483c73b92 rename kpatch-gen to kpatch-diff-gen 2013-01-18 10:45:58 -06:00
Josh Poimboeuf 4feb144e98 It's alive...
The end-to-end patching works.  From object analysis to generation to
runtime patching.  It's still missing the scripting piece that will only
take a patch and kernel source dir as input.
2013-01-16 11:28:59 -06:00