diff options
author | fche <fche> | 2005-08-22 19:14:35 +0000 |
---|---|---|
committer | fche <fche> | 2005-08-22 19:14:35 +0000 |
commit | df8fadee215f81b07f809f4d3ebb016e390f2c9b (patch) | |
tree | 939c4c58a018c58063d2db6a80c277f5989fd9a4 | |
parent | e718a34db01f32bd7a6ca01001546daa1f3b5fc7 (diff) | |
download | systemtap-steved-df8fadee215f81b07f809f4d3ebb016e390f2c9b.tar.gz systemtap-steved-df8fadee215f81b07f809f4d3ebb016e390f2c9b.tar.xz systemtap-steved-df8fadee215f81b07f809f4d3ebb016e390f2c9b.zip |
2005-08-22 Frank Ch. Eigler <fche@elastic.org>
PR systemtap/1134
* elaborate.h (module_fds): New member in systemtap_session.
* tapsets.cxx (dwarf_derived_probe ctor): Open /sys/module/$MOD/.text
for the duration of a systemtap session, to lock module in memory.
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | elaborate.h | 3 | ||||
-rw-r--r-- | tapsets.cxx | 17 |
3 files changed, 27 insertions, 0 deletions
@@ -1,3 +1,10 @@ +2005-08-22 Frank Ch. Eigler <fche@elastic.org> + + PR systemtap/1134 + * elaborate.h (module_fds): New member in systemtap_session. + * tapsets.cxx (dwarf_derived_probe ctor): Open /sys/module/$MOD/.text + for the duration of a systemtap session, to lock module in memory. + 2005-08-21 Frank Ch. Eigler <fche@redhat.com> PR systemtap/1195, systemtap/1193 diff --git a/elaborate.h b/elaborate.h index c3c35fee..43816e61 100644 --- a/elaborate.h +++ b/elaborate.h @@ -231,6 +231,9 @@ struct systemtap_session std::vector<derived_probe*> probes; std::vector<embeddedcode*> embeds; + // module-referencing file handles + std::map<std::string,int> module_fds; + // unparser data translator_output* op; unparser* up; diff --git a/tapsets.cxx b/tapsets.cxx index 43f18c66..34834033 100644 --- a/tapsets.cxx +++ b/tapsets.cxx @@ -22,6 +22,7 @@ #include <cstdarg> extern "C" { +#include <fcntl.h> #include <elfutils/libdwfl.h> #include <elfutils/libdw.h> #include <dwarf.h> @@ -1484,6 +1485,22 @@ dwarf_derived_probe::dwarf_derived_probe (dwarf_query & q, module_bias(q.dw.module_bias), has_return (q.has_return) { + // Lock the kernel module in memory. + if (module_name != TOK_KERNEL) + { + // XXX: There is a race window here, between the time that libdw + // opened up this same file for its relocation duties, and now. + int fd = q.sess.module_fds[module_name]; + if (fd == 0) + { + string sys_module = "/sys/module/" + module_name + "/sections/.text"; + fd = open (sys_module.c_str(), O_RDONLY); + if (fd < 0) + throw semantic_error ("error opening module refcount-bumping file."); + q.sess.module_fds[module_name] = fd; + } + } + // first synthesize an "expanded" location vector<probe_point::component*> comps; comps.push_back |