Blame SOURCES/rhbz1566422.patch

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