Commit Graph

159 Commits

Author SHA1 Message Date
Josh Poimboeuf
56e350430b convert README to markdown
This makes it more readable on the github page, since github expects
README to be in markdown format.
2014-02-17 15:15:46 -06:00
Seth Jennings
6eafd1648f Merge pull request #9 from jpoimboe/kpatch-script-improvements
kpatch script improvements
2014-02-17 14:47:03 -06:00
Josh Poimboeuf
01a676d9b5 Merge pull request #10 from spartacus06/fixes
Fixes
2014-02-17 14:28:16 -06:00
Seth Jennings
62bb62f409 s/sybmols/symbols/ in create-diff-object
Signed-off-by: Seth Jennings <sjenning@redhat.com>
2014-02-17 13:30:30 -06:00
Seth Jennings
8656355291 append to CFLAGS instead of overwrite
Honor user set CFLAGS

Signed-off-by: Seth Jennings <sjenning@redhat.com>
2014-02-17 11:45:48 -06:00
Josh Poimboeuf
af17774865 kpatch-build: allow building as non-root
Allowing the user to build without needing to be root.  If the needed
packages aren't installed, the error messages will tell the user what to
install.
2014-02-14 16:53:27 -06:00
Josh Poimboeuf
4c74203366 kpatch-build: log to /tmp 2014-02-14 16:48:27 -06:00
Josh Poimboeuf
9c674f52be kpatch-build: put rpm in temp directory 2014-02-14 16:48:27 -06:00
Josh Poimboeuf
833a76b9df kpatch: use relative paths for finding tools/data
Use relative paths so that kpatch and kpatch-build will find the tools
and data they need, regardless of the installation prefix.  Also add
support for running them straight from the git repo.
2014-02-14 16:48:27 -06:00
Josh Poimboeuf
5947e79e30 kpatch: patches not modules
Be more consistent with the patch metaphor (as opposed to modules):

- change load/unload to apply/remove
- strip "kpatch-" prefix from the module name, so that patch name "foo"
  corresponds to module "kpatch-foo.ko"
2014-02-14 16:48:27 -06:00
Josh Poimboeuf
244d963f89 kpatch: remove unload --all
A proper implementation would be trickier and I'm not sure this is a
useful command anyway.
2014-02-14 16:48:27 -06:00
Josh Poimboeuf
3779e9decc kpatch: single enabled dir
Programs aren't supposed to touch /usr/lib, so use a new backend
directory scheme:
- /var/lib/kpatch/<version>/enabled for all symlinks
- /var/lib/kpatch/<version> for user installed
- /usr/lib/kpatch/<version> for system installed
2014-02-14 16:48:27 -06:00
Seth Jennings
e1936f1e0f Merge pull request #8 from jpoimboe/bash-style
bash style standardization
2014-02-14 13:16:23 -06:00
Josh Poimboeuf
d58cea2717 bash style standardization
Before adding any more features to the scripts, standardize the bash
style.  I prefer something close to the google shell style guidelines:

  http://google-styleguide.googlecode.com/svn/trunk/shell.xml

- change [[ to [ (more robust)
- put variable references in quotes (more robust)
- put "then" on same line as "if" (more C-like, readable)
- print error messages on stdout
- avoid using external utilities like ls

Also added a few error handling improvements, including using a die
function where appropriate.
2014-02-14 10:26:23 -06:00
Seth Jennings
6ece4cc03b Merge pull request #6 from jpoimboe/makefiles
proper makefile support
2014-02-13 16:22:37 -06:00
Josh Poimboeuf
62de820aab proper makefile support
- setup the makefiles to support "make" and "make install", which builds
  the kpatch-build tools and installs everything in /usr/local.
- update kpatch-build to support new paths
- add "kpatch build" wrapper around kpatch-build
2014-02-13 16:02:10 -06:00
Josh Poimboeuf
352926bc77 Merge pull request #5 from spartacus06/fixes
Fixes
2014-02-13 11:52:24 -06:00
Seth Jennings
d32ca30052 don't compare data on NOBITS sections
NOBITS section may have a non-zero size, however, the have no data and
the data descriptor will have d_buf set to NULL.

This commit fixes as segfault that occurs from trying to compare the
data of such sections.

Signed-off-by: Seth Jennings <sjenning@redhat.com>
2014-02-13 11:18:25 -06:00
Seth Jennings
d927215dda check for one-to-one section-symbol relationship
There are cases in which the compiler will create symbols with NOTYPE
that map to a non-zero offset inside an .rodata section.  In that case, there
may not be a one-to-one relationship between that symbol and section as
the section may contains the data for multiple NOTYPE symbols.

This commit checks for this case and does not assign the symbol pointer of the
section that contains its data to avoid multiple symbols referring to the same
section from overwriting one another.  It also adds a check ensuring that all
symbols whose type is !NOTYPE start at offset 0 within the section.  This
should be guarenteed by the -ffunction-sections and -fdata-sections options
compiler options.

Signed-off-by: Seth Jennings <sjenning@redhat.com>
2014-02-13 11:18:25 -06:00
Seth Jennings
c8b41f8cae Merge pull request #4 from jpoimboe/usability
Interface improvements
2014-02-13 11:18:09 -06:00
Josh Poimboeuf
72b1ee7916 use consistent naming for core and patch modules 2014-02-13 11:00:12 -06:00
Josh Poimboeuf
cc846f6705 clarify that kpatch should work on non-Fedora 2014-02-13 11:00:12 -06:00
Josh Poimboeuf
6d6a5dfd1e compressed cache
Saves about 2G disk space per kernel version
2014-02-13 11:00:12 -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
Josh Poimboeuf
a8ab0c16a7 first pass at a decent user interface
This makes it somewhat easy to use.  From the root git dir, just:

  sudo scripts/kpatch-build ~/foo.patch

and it'll take care of everything, eventually spitting out the base
module (kpatch.ko) and the hotpatch module kpatch-foo.ko.

This is still all very crude, but a better user interface is coming
soon.
2014-02-12 22:24:27 -06:00
Josh Poimboeuf
8c9d8d0cb6 add build caching 2014-02-12 21:34:22 -06:00
Josh Poimboeuf
519c8e6b44 fix bash shebang 2014-02-12 21:31:38 -06:00
Josh Poimboeuf
5098b09a23 Merge pull request #3 from spartacus06/removebins
remove binaries from repo and add to gitignore
2014-02-11 16:33:25 -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
Seth Jennings
bf6af4d5e1 remove tools binaries from repo
Signed-off-by: Seth Jennings <sjenning@redhat.com>
2014-02-11 15:56:48 -06:00
Josh Poimboeuf
6b10df0432 Merge pull request #1 from spartacus06/docsupdate
update README with new OVERVIEW and DEMONSTRATION section
2014-02-11 14:42:55 -06:00
Seth Jennings
4e0dae11da update README with new OVERVIEW and DEMONSTRATION section
Signed-off-by: Seth Jennings <sjenning@redhat.com>
2014-02-11 14:34:19 -06:00
Seth Jennings
8b928cc173 add documentation to core kmod files
Signed-off-by: Seth Jennings <sjenning@redhat.com>
2014-02-11 14:01:00 -06:00
Seth Jennings
e856a15881 change output object to match kpatch-build script
Signed-off-by: Seth Jennings <sjenning@redhat.com>
2014-02-11 12:15:17 -06:00
Seth Jennings
7340fde7b5 remove target 'test' from Makefile
Signed-off-by: Seth Jennings <sjenning@redhat.com>
2014-02-11 12:04:56 -06:00
Seth Jennings
628bce2ee8 add file documentation and copyright
Signed-off-by: Seth Jennings <sjenning@redhat.com>
2014-02-11 12:01:51 -06:00
Seth Jennings
5e3baa4447 add README
Signed-off-by: Seth Jennings <sjenning@redhat.com>
2014-02-11 12:00:17 -06:00
Seth Jennings
18aee7bdfe exclude shstrtab from reachability test
Signed-off-by: Seth Jennings <sjenning@redhat.com>
2014-02-11 10:28:00 -06:00
Seth Jennings
588b174ef1 add deep rela correlation for strings
Signed-off-by: Seth Jennings <sjenning@redhat.com>
2014-02-11 10:28:00 -06:00
Seth Jennings
c1eab7eb7c invert if conditions, remove indent level
Signed-off-by: Seth Jennings <sjenning@redhat.com>
2014-02-11 10:28:00 -06:00
Seth Jennings
069a5dbad7 don't build kpatch-files from primary Makefile
Signed-off-by: Seth Jennings <sjenning@redhat.com>
2014-02-11 10:28:00 -06:00
Seth Jennings
28a5a1d275 add kpatch and kpatch-build scripts
Signed-off-by: Seth Jennings <sjenning@redhat.com>
2014-02-11 10:28:00 -06:00
Seth Jennings
139cfe5350 replace hardcoded vmlinux path in diff-object
Signed-off-by: Seth Jennings <sjenning@redhat.com>
2014-02-11 10:28:00 -06:00
Seth Jennings
954a3cdd81 remove local paths in makefiles
Signed-off-by: Seth Jennings <sjenning@redhat.com>
2014-02-11 10:27:59 -06:00
Seth Jennings
6ab1273021 major rewrite to per-section function/data model
Signed-off-by: Seth Jennings <sjenning@redhat.com>
2014-02-11 10:25:48 -06:00
Josh Poimboeuf
32c0fa5b44 Tell ftrace to return to new function
This changes the way the trampoline code works, thanks to a suggestion
by Steve Rostedt.  Before, the trampoline was mucking with the stack
pointer and other registers, and jumping to the new function directly.
With this change, all it does is set regs->ip to the address of the new
function and return back to ftrace.  When ftrace returns, it will return
to the beginning of the new function.
2013-01-24 09:50:43 -05:00
Josh Poimboeuf
46f1e166e8 kpatch-create: no need to do a make during cleanup 2013-01-22 16:37:57 -05:00
Josh Poimboeuf
8bb23d3893 add -n option to kpatch-create to not cleanup objects 2013-01-22 16:26:10 -05:00
Josh Poimboeuf
12fb573fca add address end to fix activeness safety check 2013-01-19 13:44:13 -06:00
Josh Poimboeuf
0cf58eea37 fix bugs
- fix real issue with 0's in the middle of a merged section (wrong
  alignment)
- show patch util output in case it asks a question so it doesn't
  silently fail
- fix issue with relocation of local objects (because they become global
  objects)
2013-01-19 12:36:52 -06:00