+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
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;
#include <cstdarg>
extern "C" {
+#include <fcntl.h>
#include <elfutils/libdwfl.h>
#include <elfutils/libdw.h>
#include <dwarf.h>
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