From ac08441a0456aa47c240aeeb725863c14165dce8 Mon Sep 17 00:00:00 2001 From: "Frank Ch. Eigler" Date: Fri, 9 Sep 2011 17:29:12 -0400 Subject: [PATCH] PR6503: actually allow module init/exit probes * dwflpp.cxx (dwflpp::blacklisted_p): Skip blacklist_section processing for modules, since we can (sometimes) probe their .init / .exit sections now. * runtime/staprun/staprun.c (send_relocation_modules): Hey, we only said "sometimes". Preexisting modules lie in /sys/module/... about having their init stuff still in memory. Skip those. --- dwflpp.cxx | 3 ++- runtime/staprun/staprun.c | 8 +++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/dwflpp.cxx b/dwflpp.cxx index 97c6ae38d..e0264b965 100644 --- a/dwflpp.cxx +++ b/dwflpp.cxx @@ -2890,7 +2890,8 @@ dwflpp::blacklisted_p(const string& funcname, // check against section blacklist string section = get_blacklist_section(addr); - if (!regexec (&blacklist_section, section.c_str(), 0, NULL, 0)) + // PR6503: modules don't need special init/exit treatment + if (module == TOK_KERNEL && !regexec (&blacklist_section, section.c_str(), 0, NULL, 0)) { blacklisted = true; if (sess.verbose>1) diff --git a/runtime/staprun/staprun.c b/runtime/staprun/staprun.c index 3249de1eb..3de92bcce 100644 --- a/runtime/staprun/staprun.c +++ b/runtime/staprun/staprun.c @@ -2,7 +2,7 @@ * * staprun.c - SystemTap module loader * - * Copyright (C) 2005-2010 Red Hat, Inc. + * Copyright (C) 2005-2011 Red Hat, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -473,6 +473,12 @@ void send_relocation_modules () is open so we won't need the full name again. */ *module_name_end = '\0'; + /* PR6503. /sys/module/.../sections/...init.... sometimes contain + non-0 addresses, even though the respective module-initialization + sections were already unloaded. We override the addresses here. */ + if (strstr (section_name, "init.") != NULL) /* .init.text, .devinit.rodata, ... */ + section_address = 0; + send_a_relocation (module_name, section_name, section_address); } -- 2.43.5