From: Frank Ch. Eigler Date: Sun, 27 Apr 2014 21:16:29 +0000 (-0400) Subject: runtime rhel6: avoid kernel crash with buildid checks for process(PID#) probes X-Git-Tag: release-2.5~24 X-Git-Url: https://sourceware.org/git/?a=commitdiff_plain;h=77c5941986cb0e7168dee4deb1457bc84a759a5f;p=systemtap.git runtime rhel6: avoid kernel crash with buildid checks for process(PID#) probes 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. --- diff --git a/runtime/linux/uprobes-common.c b/runtime/linux/uprobes-common.c index ed4df868f..315ed8af0 100644 --- a/runtime/linux/uprobes-common.c +++ b/runtime/linux/uprobes-common.c @@ -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 diff --git a/runtime/sym.c b/runtime/sym.c index 6affa6c43..39cb0a06f 100644 --- a/runtime/sym.c +++ b/runtime/sym.c @@ -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];