- Add unwind-fallback.patch
- rhbz1566422.patch
This commit is contained in:
Mark Wielaard 2018-04-18 16:57:44 +02:00
parent a1381b8649
commit c6a588ad5d
3 changed files with 95 additions and 3 deletions

46
rhbz1566422.patch Normal file
View File

@ -0,0 +1,46 @@
commit db9c9d6e30c6cfd7b85475b5c79ee2cc51201934
Author: Serhei Makarov <smakarov@redhat.com>
Date: Tue Apr 17 11:35:00 2018 -0400
RHBZ1566422 - fix spurious Build-id mismatch when probing reinserted kernel module
Code for newer kernels did not clear the address of the notes-section
when a probed module was unloaded. This caused spurious Build-id mismatch
when the module was reinserted as new addresses are not computed for
dynamically loaded modules (see also: PR23068) and the Build-id check
was trying to read the notes section at the no-longer-valid old address.
* runtime/sym.c (_stp_module_notifier): clear addresses on
MODULE_STATE_GOING in newer kernels (>=3.10) too.
* runtime/transport/symbols.c (_stp_kmodule_update_address): fix logic
error and clear notes section addr when reloc=NULL (aka. 'all').
diff --git a/runtime/sym.c b/runtime/sym.c
index c11a35a..b6e0fd6 100644
--- a/runtime/sym.c
+++ b/runtime/sym.c
@@ -1045,7 +1045,7 @@ static void _stp_kmodule_update_address(const char* module,
if (strcmp (_stp_modules[mi]->name, module))
continue;
- if (reloc && !strcmp (note_sectname, reloc)) {
+ if (!reloc || !strcmp (note_sectname, reloc)) {
dbug_sym(1, "module %s special section %s address %#lx\n",
_stp_modules[mi]->name,
note_sectname,
diff --git a/runtime/transport/symbols.c b/runtime/transport/symbols.c
index 64c2aeb..076c562 100644
--- a/runtime/transport/symbols.c
+++ b/runtime/transport/symbols.c
@@ -167,6 +167,11 @@ static int _stp_module_notifier (struct notifier_block * nb,
/* Verify build-id. */
_stp_kmodule_check (mod->name);
}
+ else if (val == MODULE_STATE_GOING) {
+ /* Unregister all sections. */
+ dbug_sym(2, "unregister sections\n");
+ _stp_kmodule_update_address(mod->name, NULL, 0);
+ }
else if (val != MODULE_STATE_GOING) {
return NOTIFY_DONE;
}

View File

@ -74,7 +74,7 @@
Name: systemtap Name: systemtap
Version: 3.2 Version: 3.2
Release: 9%{?dist} Release: 10%{?dist}
# for version, see also configure.ac # for version, see also configure.ac
Patch10: rhbz1504009.patch Patch10: rhbz1504009.patch
@ -83,9 +83,17 @@ Patch10: rhbz1504009.patch
# upstream: https://sourceware.org/bugzilla/show_bug.cgi?id=22551 # upstream: https://sourceware.org/bugzilla/show_bug.cgi?id=22551
Patch11: rhbz1546563.patch Patch11: rhbz1546563.patch
# Partial fix for backstrace issues. Add a new kernel fallback unwinder. # Add a new kernel fallback unwinder.
# upstream: commit 553b6df07c9b7ab30ed468a6a4374cbdf73d1c0d # upstream: commit 553b6df07c9b7ab30ed468a6a4374cbdf73d1c0d
Patch13: unwind-fallback.patch Patch13: unwind-fallback.patch
# And make the kernel DWARF unwinder work with ksalr.
# upstream: commit 17ee540dd61113fe4f557f191db3480db875cca1
Patch14: unwind-ksalr.patch
# Build-id mismatch with (re)inserted/removed kernel module probe
# redhat: https://bugzilla.redhat.com/show_bug.cgi?id=1566422
# upstream: db9c9d6e30c6cfd7b85475b5c79ee2cc51201934
Patch15: rhbz1566422.patch
# Packaging abstract: # Packaging abstract:
# #
@ -253,7 +261,7 @@ URL: http://sourceware.org/systemtap/
# kernel variant (kernel-PAE, kernel-debug, etc.) devel package # kernel variant (kernel-PAE, kernel-debug, etc.) devel package
# installed. # installed.
Requires: kernel-devel-uname-r Requires: kernel-devel-uname-r
%{?fedora:Suggests: kernel-devel} #%{?fedora:Suggests: kernel-devel}
Requires: gcc make Requires: gcc make
# Suggest: kernel-debuginfo # Suggest: kernel-debuginfo
@ -492,6 +500,8 @@ cd ..
%patch11 -p1 %patch11 -p1
%patch13 -p1 %patch13 -p1
%patch14 -p1
%patch15 -p1
%build %build
@ -1172,6 +1182,10 @@ done
# PRERELEASE # PRERELEASE
%changelog %changelog
* Wed Apr 18 2018 Mark Wielaard <mjw@fedoraproject.org> - 3.2-10
- Add unwind-fallback.patch
- rhbz1566422.patch
* Tue Apr 17 2018 Mark Wielaard <mjw@fedoraproject.org> - 3.2-9 * Tue Apr 17 2018 Mark Wielaard <mjw@fedoraproject.org> - 3.2-9
- Add unwind-fallback.patch. - Add unwind-fallback.patch.

32
unwind-ksalr.patch Normal file
View File

@ -0,0 +1,32 @@
commit 17ee540dd61113fe4f557f191db3480db875cca1
Author: Mark Wielaard <mark@klomp.org>
Date: Wed Apr 18 15:00:24 2018 +0200
Make kernel DWARF unwinder work with ksalr.
The .debug_frame loaded from disk is already relocated against the
expected load offset of the kernel, but the actual static (load)
address might be different (with kaslr). So adjust the startLoc
for that difference when reading any address from the unwind table.
diff --git a/runtime/unwind.c b/runtime/unwind.c
index 3a2d991..4c360d2 100644
--- a/runtime/unwind.c
+++ b/runtime/unwind.c
@@ -724,10 +724,15 @@ adjustStartLoc (unsigned long startLoc,
dbug_unwind(2, "adjustStartLoc=%lx, ptrType=%s, m=%s, s=%s eh=%d\n",
startLoc, _stp_eh_enc_name(ptrType), m->path, s->name, is_ehframe);
if (startLoc == 0
- || strcmp (m->name, "kernel") == 0
|| (strcmp (s->name, ".absolute") == 0 && !is_ehframe))
return startLoc;
+ /* The .debug_frame loaded from disk is already relocated against the
+ expected load offset of the kernel, but the actual static (load)
+ address might be different (with kaslr). */
+ if (strcmp (m->name, "kernel") == 0)
+ return startLoc - s->sec_load_offset + s->static_addr;
+
/* eh_frame data has been loaded in the kernel, so readjust offset. */
if (is_ehframe) {
dbug_unwind(2, "eh_frame=%lx, eh_frame_addr=%lx\n", (unsigned long) m->eh_frame, m->eh_frame_addr);