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.
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
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.
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
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
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.
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.
The special sections should be processed after all the other inclusion
logic has run, so that should_keep_rela_group() can work properly.
Otherwise it might remove a needed rela group from a special section.
If hyphen doesn't exist in uname -r (ARCHVERSION), then it is probably a
non-distro kernel and we don't need to create the localversion file.
Fixes#376
Signed-off-by: Seth Jennings <sjenning@redhat.com>
Fix the mangled function strcmp so that it compares all of the string
except for the numbered parts. foo.isra.35 should match foo.isra.1, but
not foo.isra.35.part.36.
Fixes#352.
Make the kpatch-patch-hook.c function and variable names consistent by
prefixing them all with 'patch_'. This makes it easier to distinguish
the patch hook sections from the patched sections when looking at the
ELF section data.
It's possible for a static local variable's data section to have
a relocation which refers to the variable symbol itself. Fix the logic
which searches for the user of a static local variable by only looking
in text sections (i.e. functions).
Fixes#411.
This fixes a seg fault in the test suite caused by a debug section
referencing an un-included unbundled symbol (though its section was
included). The symbol was a __warned symbol and the section was
.data.unlikely.
For debug sections, there is no need to replace section references with
symbols because we don't compare debug sections.
Add support for the __key and __warned "special" static local variables.
I'm calling them that for lack of a better term, analagous to the
kernel's special sections that we have to deal with.
__warned: Used by WARN_ONCE et al as an indicator as to whether a
message has already been printed. I think it makes sense (and is much
easier) to reset this counter for a given function when replacing the
function, since the user may expect the new function to warn again.
__key: Used by lockdep as an identifier for a given lock initialization
code path (see http://lwn.net/Articles/185666/ for more info). I think
it makes sense (and is much easier) to create a new key for a given
function when replacing the function, because the locking semantics may
have changed, so it makes sense for lockdep to use a new key to validate
the new locking behavior.
So for both __warned and __key static variables, the new version of the
variable should be used when referenced by an included function.
Made the following changes to support these special variables:
- Ignore their suffixes when comparing them in rela_equal, so that gcc
renaming them will not result in a function being marked as changed
just because it referenced a renamed static local
- Don't ever correlate them, so that their new versions will be included
if a changed or new function uses their corresponding symbols
Fixes#402.