Currently unbundled section references are only replaced if the start of
the symbol is referenced. It's also useful to support replacement of
references which point to inside the symbol.
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.
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.
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.
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
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.
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>
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.
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.
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.
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.
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>
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
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.
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.
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).
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.