Commit Graph

539 Commits

Author SHA1 Message Date
Seth Jennings
7d747e86fd remove compressed cache
The compression of the cache during initial build time and
the removal and (re)decompression of the cache for subsequent
builds takes a large amount of time and causes significant I/O.

This commit removes the compressed cache and, instead, keeps
the cache uncompressed and maintained in a known state.  If
the "applied-patch" file does not exist, then the cache is
in the unpatched state.  If the file does exist, the cache is
in a patched state and can be returned to an unpatched state
with "patch -R -p1 < applied-patch".

The if cache is detected and is in the patched state, the patch
is removed and vmlinux is rebuilt to obtain the base vmlinux.

Signed-off-by: Seth Jennings <sjenning@redhat.com>
2014-02-18 15:25:11 -06:00
Josh Poimboeuf
f0ce3443b5 Merge pull request #25 from spartacus06/fixes
remove quotes around for loop elements
2014-02-18 14:19:50 -06:00
Seth Jennings
a6154ca400 remove quotes around for loop elements
Right now kpatch-build fails when more than one object
file has changed because the quotes around the for loop
arrays cause the for loop to execute only once for all
elements in a single string.

Remove the quotes around the for loop arrays so that the
for loop is execute for each element.

Signed-off-by: Seth Jennings <sjenning@redhat.com>
2014-02-18 13:37:46 -06:00
Seth Jennings
07d78c2275 Merge pull request #24 from jpoimboe/readme
rearrange README and add some more content
2014-02-18 11:52:20 -06:00
Josh Poimboeuf
843a42298b rearrange README and add some more content
- move license to bottom
- clarify dependencies and installation procedure
- move gotchas section to installation section
- move status section to intro
- add more information about how it works
2014-02-18 11:49:35 -06:00
Seth Jennings
2fb629e958 Merge pull request #23 from jpoimboe/cleanup-cleanup
cleanup the cleanup handling
2014-02-18 11:23:42 -06:00
Seth Jennings
cf93831a6a Merge pull request #22 from jpoimboe/kpatch-build-from-git
fix calling of kpatch-build from git dir
2014-02-18 11:14:37 -06:00
Josh Poimboeuf
052f2d8b25 fix calling of kpatch-build from git dir
When calling kpatch-build from the git directory, the patch kmod build
fails because it can't find kpatch.h because the symlink is broken.
Copy the kpatch.h file (instead of the symlink) to TEMPDIR.
2014-02-18 11:11:51 -06:00
Josh Poimboeuf
aed73433a7 cleanup the cleanup handling
- always remove TEMPDIR, otherwise /tmp can fill up if you get multiple
  build errors
- always remove KSRCDIR
- only remove the log file on success
2014-02-18 10:56:16 -06:00
Seth Jennings
06ed1bdcc0 Merge pull request #21 from jpoimboe/strip-fix
fix STRIPCMD use
2014-02-18 10:41:24 -06:00
Josh Poimboeuf
d8cdaa7a57 fix STRIPCMD use
bash gets confused when a command and its args are quoted:

  /usr/local/libexec/kpatch/kpatch-build: line 131: strip -d --keep-file-symbols: command not found
2014-02-18 10:37:49 -06:00
Seth Jennings
a4e0b80a6d Merge pull request #20 from jpoimboe/copy-core-fix
don't copy core kmod source files to tempdir
2014-02-18 10:14:02 -06:00
Josh Poimboeuf
12065851f3 don't copy core kmod source files to tempdir
No need to copy them anymore now that the core kmod is getting
built elsewhere.
2014-02-18 10:12:42 -06:00
Seth Jennings
496cb13085 Merge pull request #19 from jpoimboe/install-fix
install uname fix
2014-02-18 09:34:15 -06:00
Seth Jennings
b373d6e331 Merge pull request #18 from jpoimboe/logfile-error
kpatch-build: fix logfile error message
2014-02-18 09:29:27 -06:00
Josh Poimboeuf
c3ad933132 install uname fix 2014-02-18 09:23:17 -06:00
Seth Jennings
09586bbe5f Merge pull request #15 from jpoimboe/update-usage
add usage command descriptions and help command
2014-02-18 09:14:13 -06:00
Josh Poimboeuf
b801ceee9e output usage on stderr 2014-02-18 09:10:05 -06:00
Seth Jennings
6c316119b2 Merge pull request #14 from jpoimboe/core-module
build and install core module with make
2014-02-18 09:05:52 -06:00
Seth Jennings
b89d1ca4ff Merge pull request #17 from jpoimboe/install-command
add install/uninstall commands
2014-02-18 09:05:12 -06:00
Seth Jennings
f175f693db Merge pull request #16 from jpoimboe/no-rename-magic
remove naming magic
2014-02-18 08:57:55 -06:00
Josh Poimboeuf
f4791d0cce kpatch-build: fix logfile error message 2014-02-18 08:15:55 -06:00
Josh Poimboeuf
14aecdeb3c remove naming magic
Don't do any naming translation for now.

All commands will now take kpatch-foo.ko as an argument rather than foo.
2014-02-18 08:08:31 -06:00
Josh Poimboeuf
07c2991d75 add install/uninstall commands 2014-02-18 08:07:21 -06:00
Josh Poimboeuf
34227c7ecc add usage command descriptions and help command 2014-02-18 08:03:32 -06: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
09a963cfd9 Merge pull request #13 from spartacus06/fixes
Fixes
2014-02-17 16:02:57 -06:00
Seth Jennings
062355a186 retain source tree directory structure with objects
The source tree directory structure should be maintained
in the TEMPDIR while building the hotpatch module so that
changed objects in different directories with the same
name don't collide during the build process.

Signed-off-by: Seth Jennings <sjenning@redhat.com>
2014-02-17 16:00:11 -06:00
Seth Jennings
84a513e7c4 Merge pull request #11 from jpoimboe/readme-markdown
convert README to markdown
2014-02-17 15:26:07 -06:00
Seth Jennings
4f2d5d209c variablize strip command and add --keep-file-symbols
We need to keep the file symbols around for add-patches-section
and link-vmlinux-syms to resolve ambigous symbols in vmlinux.

Signed-off-by: Seth Jennings <sjenning@redhat.com>
2014-02-17 15:24:11 -06:00
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