Commit Graph

938 Commits

Author SHA1 Message Date
Josh Poimboeuf 7876ce4aae test: make sure TMP.patch is cleaned up 2014-10-06 14:42:34 -05:00
Josh Poimboeuf fb49e254cf improve static local variable correlation
Improve the static local variable correlation logic, for the case where
a static local is used by multiple functions.  For each usage of the
variable, look for a corresponding usage in the base object.  If we find
at least one matching usage, consider it a twin.
2014-10-06 14:38:46 -05:00
Seth Jennings b50264e675 Merge pull request #440 from jpoimboe/unlink-error-handling
fix object unlink error handling
2014-10-06 14:22:51 -05:00
Josh Poimboeuf ea0ad69bbf Merge pull request #447 from jpoimboe/integration-test-fix
fix integration test patch conflict
2014-10-06 12:43:18 -05:00
Josh Poimboeuf 36150a8beb fix integration test patch conflict 2014-10-06 12:42:45 -05:00
Seth Jennings 78b4d3c70d Merge pull request #443 from jpoimboe/func-special-static
static local fixes
2014-10-06 11:33:31 -05:00
Seth Jennings 8efd704b51 Merge pull request #446 from flaming-toast/issue430
Fix #430 by copying original modules to TEMPDIR
2014-10-06 11:31:55 -05:00
Jessica Yu 09c39932b1 kpatch-gcc: for module patches, copy module to temp dir
For patches involving modules, copy the original module(s) to
TEMPDIR so that create-diff-object can create the correct lookup
tables
2014-10-06 01:05:36 -07:00
Josh Poimboeuf 4d01e89c3a fix object unlink error handling
Fix the object unlink error handling so that each function cleans up
after itself properly.

Also use find_symbol() instead of __symbol_get() to make cleanup easier.
When patching a module we don't need a reference to each symbol, since
we already have done a try_module_get() on the module.

Fixes #392.
2014-10-03 21:18:47 -05:00
Josh Poimboeuf f7c0e6849e allow static locals to be used by two functions
Allow static locals to be used by two functions.  This is possible if
the static's containing function is inlined.  We only need to find one
of them to do the correlation.
2014-10-03 16:02:16 -05:00
Josh Poimboeuf 03995e5223 make __func__ a special static local
The __func__ static local variable should be deemed "special", because
it doesn't need to be correlated and should be included when needed by
an include function.

I don't have a test case for F20, but this fixes the following types of
issues when doing a full-tree recompile on RHEL 7:

    ERROR: cifssmb.o: object size mismatch: __func__.49322
    ERROR: btmrvl_main.o: kpatch_correlate_static_local_variables: 982: static local variable __func__.44657 not used
    ERROR: iwch_qp.o: .rodata.__func__.46024 section header details differ
2014-10-03 12:27:27 -05:00
Seth Jennings 6175658196 Merge pull request #441 from jpoimboe/module-shadow
allow shadow functions to be called from modules
2014-10-02 23:22:26 -05:00
Seth Jennings c6506ec549 Merge pull request #436 from jpoimboe/descriptor
make "descriptor" a special static local variable
2014-10-02 23:11:00 -05:00
Josh Poimboeuf ea445c0333 allow shadow functions to be called from modules
Fixes an issue where attempting to call the shadow functions from a
module results in modpost failures:

    ERROR: "kpatch_shadow_get" [net/mac80211/mac80211.ko] undefined!
    ERROR: "kpatch_shadow_alloc" [net/mac80211/mac80211.ko] undefined!

LDFLAGS_MODULE is apparently not really needed.
2014-10-02 13:31:48 -05:00
Josh Poimboeuf 629b2eaa26 Merge pull request #439 from spartacus06/skip-gcc-check
Allow user to skip gcc version check
2014-10-01 15:46:42 -05:00
Seth Jennings 12e77bab46 fix usage formatting 2014-10-01 15:40:57 -05:00
Seth Jennings b8c582f2ee Merge pull request #438 from jpoimboe/no-changed-functions
remove "no changed functions" messages
2014-10-01 14:27:04 -05:00
Seth Jennings d3abeb667a Allow user to skip gcc version check
Right now, unless the entire gcc version string, including build date
and package version, matches the distro kernel exactly, kpatch-build
won't proceed.

For some distros, it is very difficult to rollback to a previous
version of gcc and keep that version pinned on the system so that the
package manager doesn't update it.

For these user, add a --skip-gcc-check flag to kpatch-build to allow the
version check to be skipped.  If the user does this, it is assumed they
know what they are doing.  This flag is documented as "not recommended".

Signed-off-by: Seth Jennings <sjenning@redhat.com>
2014-10-01 14:25:02 -05:00
Josh Poimboeuf 51799dff2c remove "no changed functions" messages
When patching a shared header file, don't spam the user with hundreds of
lines of "no changed functions" messages.  We expect the user to be
proactive with verifying that the right functions are being patched
anyway, so this message isn't strictly necessary.
2014-10-01 14:12:25 -05:00
Josh Poimboeuf ab1b487d90 Merge pull request #437 from spartacus06/cleanup
check that logfile exists before printing message
2014-10-01 14:05:28 -05:00
Seth Jennings ac452ef175 check that logfile exists before printing message
Don't tell the user to check a log file that doesn't exist

Signed-off-by: Seth Jennings <sjenning@redhat.com>
2014-10-01 13:29:20 -05:00
Josh Poimboeuf e27ffadce1 make "descriptor" a special static local variable
The "descriptor" static local variables and their containing __verbose
section are used for dynamic debug printks.  They should be considered
as special static local variable symbols because they have the same
requirements: they should never be correlated and they should only be
included if referenced by an included function.
2014-10-01 11:11:54 -05:00
Josh Poimboeuf b295c8686e test: improve macro-hooks patch
Restore aio_max_nr to its original value when unloading.

Also move the location of the patch hunk to be not at the end of the
file.  Otherwise we hit a weird combinediff bug which results in the
diff's context being removed.
2014-10-01 11:11:54 -05:00
Seth Jennings e5dd825f15 Merge pull request #435 from jpoimboe/rhel7-optional-repo
readme: enable RHEL 7 optional repo
2014-09-30 14:15:04 -05:00
Josh Poimboeuf bd2b499509 readme: get ccache from EPEL for RHEL 7 2014-09-29 21:32:27 -05:00
Josh Poimboeuf 2203cf5b7d readme: enable RHEL 7 optional repo
needed for pesign, newt-devel, pciutils-devel, asciidoc
2014-09-29 21:21:43 -05:00
Josh Poimboeuf cca211067c Merge pull request #434 from useidel/master
added missing options -v, -t and -d
2014-09-26 23:43:15 -05:00
Udo Seidel 6c73bc3652 added missing options -v, -t and -d 2014-09-26 19:12:45 +02:00
Josh Poimboeuf f69d258c0b Merge pull request #433 from spartacus06/fixup-makefile
improve kpatch-build Makefile
2014-09-24 22:04:48 -05: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
Seth Jennings 88aae05894 Merge pull request #428 from jpoimboe/full-tree-recompile
full tree recompilation support
2014-09-15 21:22:08 -05:00
Josh Poimboeuf a20940892a code review fixes 2014-09-15 21:11:13 -05:00
Josh Poimboeuf 46ba72b339 Merge pull request #429 from spartacus06/fix-srpm-regression
fix regression in user-specified source RPM
2014-09-15 21:08:51 -05:00
Seth Jennings 85d7b071ba Merge pull request #427 from jpoimboe/replace-unbundled-references
replace all unbundled section references with symbols
2014-09-15 17:02:19 -05:00
Seth Jennings 18d9e4daa9 fix regression in user-specified source RPM
A recent commit 74316588e is unconditionally setting the SRCRPM path
overwriting a user specified path.

Only set SRCRPM if SRCRPM is not already set.

Signed-off-by: Seth Jennings <sjenning@redhat.com>
2014-09-15 16:58:22 -05:00
Josh Poimboeuf 1ee3ae669f test: add slow test for rebuilding entire tree
Only gets run with the slow integration tests, not "make quick".
2014-09-15 14:54:59 -05:00
Josh Poimboeuf 33cd945b14 new .fixup group size algorithm
The fixup_group_size() function assumes that all .fixup rela groups end
with a jmpq instruction.  That assumption turns out to be false when you
take into account the ____kvm_handle_fault_on_reboot() macro which is
used by kvm.

This is a new, more reliable method.  It turns out that each .fixup
group is referenced by the __ex_table section.  The new algorithm goes
through the __ex_table relas to figure out the size of each .fixup
group.

Also the .fixup section is now processed before __ex_table, because it
needs to access the original __ex_table relas before the unused ones
have been stripped.

Fixes the following error:

  ERROR: vmx.o: fixup_group_size: 1554: can't find jump instruction in .fixup section
2014-09-15 14:54:57 -05:00
Josh Poimboeuf dbecef6e91 replace all unbundled section references with symbols
Currently we're checking for several special cases when deciding whether
to convert unbundled section references to their corresponding symbol
references.  We do it for all unbundled text sections as well as three
specific data sections.

There's no reason I can think of for why we shouldn't just do it for
_all_ unbundled sections.
2014-09-15 12:01:34 -05:00
Seth Jennings a042dc1bbc Merge pull request #426 from jpoimboe/rename-objname-var
rename global "objname" variable to "childobj"
2014-09-15 11:48:39 -05:00
Josh Poimboeuf bfe7fca5bd rename global "objname" variable to "childobj"
There are two distinct usages of "objname" as a variable name:

- the parent object being patched (e.g. vmlinux)
- the child object being analyzed (e.g. meminfo.o)

The name of the global objname variable conflicts with several
functions' usage of a local objname variable, resulting in some error
messages of e.g., "ERROR: vmlinux:" instead of "ERROR: meminfo.o:".

Rename the global objname variable to childobj.
2014-09-15 11:36:02 -05:00
Josh Poimboeuf ba7c905b3a process special sections after checking for changes
There's no need to process special sections if we're returning due to no
functions changing.

Also this means we don't have to deal with extra-special usage of the
.fixup section (here's looking at you arch/x86/lib/copy_user_64.S -- we
can't patch functions in .S files anyway).
2014-09-15 11:17:37 -05:00
Josh Poimboeuf 218011b268 kpatch-build: allow two parents unless the object changes
With some obscure drivers, the same object file can be linked into
multiple parent objects.  Only call this out as an error if the object
has changed, otherwise it doesn't matter.

Fixes the following issue:

    ERROR: two parent matches for drivers/media/radio/si470x/radio-si470x-common.o.
2014-09-15 11:17:37 -05:00
Josh Poimboeuf f5dbd7816e kpatch-gcc: skip vdso files
vdso files aren't kpatch-compatible, and give errors like the following:

    ERROR: invalid ancestor arch/x86/vdso/vdso32-sysenter.so.dbg for arch/x86/vdso/vdso32/sysenter.o
2014-09-15 11:17:37 -05:00
Josh Poimboeuf 8c2792af6c kpatch-build: deep find performance improvement
If we have to do a deep find (e.g. search the entire tree) to find a
parent object, first try searching in the last successful deep find
directory.  This is a performance improvement in the case of a full tree
rebuild, because deep finds are very expensive, and it's not uncommon
for there to be multiple objects in a directory being linked into an
object in another directory.
2014-09-15 11:17:37 -05:00
Josh Poimboeuf a851517165 kpatch-build: add more ancestors for vmlinux
There are a few more valid ancestors for vmlinux other than built-in.o.
This fixes errors similar to the following:

    ERROR: invalid ancestor arch/x86/lib/lib.a for arch/x86/lib/usercopy_64.o
2014-09-15 11:17:37 -05:00
Josh Poimboeuf 5cce81f49b kpatch-gcc: properly quote arguments
Fixes an error when the following is an argument to gcc:

'-DIPATH_IDSTR="QLogic' kernel.org 'driver"'

gcc: error: kernel.org: No such file or directory
gcc: error: driver": No such file or directory
2014-09-15 11:17:37 -05:00
Seth Jennings 43ca05e5b1 Merge pull request #425 from jpoimboe/fedora-src-rpm-koji-2
kpatch-build: download fedora src rpms from koji
2014-09-15 11:15:46 -05:00
Josh Poimboeuf d254d3d0f2 fix review comments
Use the wget -P option.
2014-09-15 11:12:11 -05:00
Josh Poimboeuf 74316588e8 kpatch-build: download fedora src rpms from koji
yumdownloader is problematic because it doesn't allow you to download
anything but the latest released kernel.  It can also be slow at times.
Instead, for Fedora, download the RPMs from koji.
2014-09-15 11:12:11 -05:00
Josh Poimboeuf 6176353f8d kpatch-build: add KVER and KREL variables
Add KVER and KREL variables, and use them where appropriate.  Also
remove the setting of ARCHVERSION in the '-s' case, since it's not
actually used anywhere in that case.
2014-09-15 11:11:25 -05:00