]> sourceware.org Git - systemtap.git/commitdiff
runtime rhel6: avoid kernel crash with buildid checks for process(PID#) probes
authorFrank Ch. Eigler <fche@redhat.com>
Sun, 27 Apr 2014 21:16:29 +0000 (17:16 -0400)
committerFrank Ch. Eigler <fche@redhat.com>
Sun, 27 Apr 2014 21:16:29 +0000 (17:16 -0400)
Crash observed on rhel6 (utrace -> process(NUM).statement(ADDR).absolute probes)
in unprivileged_myproc.exp test case.

* runtime/linux/uprobes-common.c (stap_uprobe_change_plus): Don't try to check
  process against _stp_module entry, if we don't even have a process pathname.
* runtime/sym.c (_stp_usermodule_check): WARN_ON incoming null pathname.

runtime/linux/uprobes-common.c
runtime/sym.c

index ed4df868f4d9996ee2c3417f55858412cb20d81f..315ed8af07fca4aced078e2b3997f3c978767892 100644 (file)
@@ -68,8 +68,14 @@ static int stap_uprobe_change_plus (struct task_struct *tsk, unsigned long reloc
     #ifdef DEBUG_UPROBES
     _stp_dbug(__FUNCTION__,__LINE__, "+uprobe spec %d idx %d process %s[%d] addr %p pp %s\n", spec_index, (slotted_p ? i : -1), tsk->comm, tsk->tgid, (void*)(relocation+sups->address), sups->probe->pp);
     #endif
-    if ((rc = _stp_usermodule_check(tsk, (const char*)stf->pathname, relocation)))
-      return rc;
+
+    /* NB: check for user-module build-id only if we have a pathname
+       at all; for a process(PID#).* probe, we may not.  If at some
+       point we map process(PID#) to process("/proc/PID#/exe"), we'll
+       get a pathname. */
+    if (stf->pathname)
+            if ((rc = _stp_usermodule_check(tsk, stf->pathname, relocation)))
+                    return rc;
 
     /* Here, slotted_p implies that `i' points to the single
        stap_uprobes[] element that has been slotted in for registration
index 6affa6c43a16f54fbe60a3cb28b5acd87385e93f..39cb0a06fa3847ed78d4062f55082ee7d101272f 100644 (file)
@@ -413,6 +413,8 @@ static int _stp_usermodule_check(struct task_struct *tsk, const char *path_name,
   return 0;
 #endif
 
+  WARN_ON(!path_name);
+
   for (i = 0; i < _stp_num_modules; i++)
     {
       m = _stp_modules[i];
This page took 0.030324 seconds and 5 git commands to generate.