From b2f9c9051897d50ad59b06f9e305083eab84fd4b Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Tue, 24 Nov 2009 21:29:57 +0100 Subject: Add assert for detecting shared library reloading, PR11015. * runtime/sym.c (_stp_tf_mmap_cb): Only look for first load of whole module that is executable. Add check for detecting reloading of module. --- runtime/sym.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/runtime/sym.c b/runtime/sym.c index fd9863dd..953161bc 100644 --- a/runtime/sym.c +++ b/runtime/sym.c @@ -35,7 +35,9 @@ static int _stp_tf_mmap_cb(struct stap_task_finder_target *tgt, "mmap_cb: tsk %d:%d path %s, addr 0x%08lx, length 0x%08lx, offset 0x%lx, flags 0x%lx\n", tsk->pid, tsk->tgid, path, addr, length, offset, vm_flags); #endif - if (path != NULL) { + // We are only interested in the first load of the whole module that + // is executable. But see below for the comment about PR11015. + if (path != NULL && offset == 0 && (vm_flags & VM_EXEC)) { for (i = 0; i < _stp_num_modules; i++) { if (strcmp(path, _stp_modules[i]->path) == 0) { @@ -56,11 +58,18 @@ static int _stp_tf_mmap_cb(struct stap_task_finder_target *tgt, // in (especially the "section" naming is // slightly confusing since what we really // seem to mean are elf segments (which can - // contain multiple elf sections). - if ((strcmp(".dynamic", - module->sections[0].name) == 0) - && module->sections[0].addr == 0) - module->sections[0].addr = addr; + // contain multiple elf sections). PR11015. + if (strcmp(".dynamic", + module->sections[0].name) == 0) + { + if (module->sections[0].addr == 0) + module->sections[0].addr = addr; + else if (module->sections[0].addr != addr) + _stp_error ("Reloaded module '%s'" + " at 0x%lx, was 0x%lx\n", + path, addr, + module->sections[0].addr); + } break; } } -- cgit From 8a77568afb95434e08637268084f4ee65cd6785c Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Tue, 24 Nov 2009 13:22:27 -0800 Subject: Fix uninitialized fields in loc2c. * loc2c.c (alloc_location, location_from_address, c_translate_constant): Initialize ops and nops fields. --- loc2c.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/loc2c.c b/loc2c.c index e995b999..008d5a42 100644 --- a/loc2c.c +++ b/loc2c.c @@ -85,6 +85,8 @@ alloc_location (struct obstack *pool, struct location *origin) loc->emit_address = origin->emit_address; loc->byte_size = 0; loc->frame_base = NULL; + loc->ops = NULL; + loc->nops = 0; return loc; } @@ -669,6 +671,8 @@ location_from_address (struct obstack *pool, loc->emit_address = *input == NULL ? emit_address : (*input)->emit_address; loc->byte_size = 0; loc->frame_base = NULL; + loc->ops = NULL; + loc->nops = 0; bool need_fb = false; size_t loser; @@ -1189,6 +1193,8 @@ c_translate_constant (struct obstack *pool, loc->address.stack_depth = 0; loc->address.declare = NULL; loc->address.used_deref = false; + loc->ops = NULL; + loc->nops = 0; switch (dwarf_whatform (attr)) { -- cgit From aa8c86d6eb940dc06d90a926a262070dd400f9ad Mon Sep 17 00:00:00 2001 From: Dave Brolley Date: Tue, 24 Nov 2009 16:30:23 -0500 Subject: include modverify.h unconditionally. --- runtime/staprun/staprun_funcs.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/runtime/staprun/staprun_funcs.c b/runtime/staprun/staprun_funcs.c index b23d7822..b92067fb 100644 --- a/runtime/staprun/staprun_funcs.c +++ b/runtime/staprun/staprun_funcs.c @@ -12,9 +12,7 @@ #include "config.h" #include "staprun.h" -#if HAVE_NSS #include "modverify.h" -#endif #include #include -- cgit