diff options
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | buildrun.cxx | 1 | ||||
-rw-r--r-- | runtime/ChangeLog | 8 | ||||
-rw-r--r-- | runtime/autoconf-real-parent.c | 15 | ||||
-rw-r--r-- | runtime/task_finder.c | 3 | ||||
-rw-r--r-- | tapset/ChangeLog | 7 | ||||
-rw-r--r-- | tapset/context.stp | 8 | ||||
-rw-r--r-- | tapset/task.stp | 4 |
8 files changed, 51 insertions, 1 deletions
@@ -1,3 +1,9 @@ +2008-07-09 Mark Wielaard <mwielaard@redhat.com> + + PR 6732 + * buildrun.cxx (compile_pass): Define STAPCONF_REAL_PARENT by + calling autoconf-real-parent.c + 2008-07-09 Frank Ch. Eigler <fche@elastic.org> From James Bottomley <James.Bottomley@HansenPartnership.com> diff --git a/buildrun.cxx b/buildrun.cxx index a39f2b63..3183fe6b 100644 --- a/buildrun.cxx +++ b/buildrun.cxx @@ -96,6 +96,7 @@ compile_pass (systemtap_session& s) o << module_cflags << " += $(call stap_check_build, $(SYSTEMTAP_RUNTIME)/autoconf-nameidata.c, -DSTAPCONF_NAMEIDATA_CLEANUP,)" << endl; o << module_cflags << " += $(call stap_check_build, $(SYSTEMTAP_RUNTIME)/autoconf-unregister-kprobes.c, -DSTAPCONF_UNREGISTER_KPROBES,)" << endl; o << module_cflags << " += $(call stap_check_build, $(SYSTEMTAP_RUNTIME)/autoconf-module-nsections.c, -DSTAPCONF_MODULE_NSECTIONS,)" << endl; + o << module_cflags << " += $(call stap_check_build, $(SYSTEMTAP_RUNTIME)/autoconf-real-parent.c, -DSTAPCONF_REAL_PARENT,)" << endl; #if 0 /* NB: For now, the performance hit of probe_kernel_read/write (vs. our * homegrown safe-access functions) is deemed undesireable, so we'll skip diff --git a/runtime/ChangeLog b/runtime/ChangeLog index f7f1a5a8..25faffe2 100644 --- a/runtime/ChangeLog +++ b/runtime/ChangeLog @@ -1,3 +1,11 @@ +2008-07-09 Mark Wielaard <mwielaard@redhat.com> + + PR 6732 + * autoconf-real-parent.c: New file. + * task_finder.c (__stp_utrace_task_finder_report_exec): Define + real_parent using STAPCONF_REAL_PARENT. Undefine when no longer + needed. + 2008-07-01 David Smith <dsmith@redhat.com> * task_finder.c (__stp_get_mm_path): Corrected error return code. diff --git a/runtime/autoconf-real-parent.c b/runtime/autoconf-real-parent.c new file mode 100644 index 00000000..010792cb --- /dev/null +++ b/runtime/autoconf-real-parent.c @@ -0,0 +1,15 @@ +/* PR6732 - In RHEL5 and F[678] kernels, the utrace patch removed the + * ptrace-related parent field and renamed real_parent to parent. In + * future Fedora kernels, there may or may not be a ptrace-related + * parent field, but the real useful field will go back to being called + * real_parent. + */ +#include <linux/sched.h> + +struct task_struct t; + +void foo (void) +{ + struct task_struct *p; + p = t.real_parent; +} diff --git a/runtime/task_finder.c b/runtime/task_finder.c index 316a9bc0..fc573eb6 100644 --- a/runtime/task_finder.c +++ b/runtime/task_finder.c @@ -485,7 +485,7 @@ __stp_utrace_task_finder_report_exec(struct utrace_attached_engine *engine, // '/bin/bash' clones and then execs '/bin/ls'. If the user // was probing '/bin/bash', the cloned thread is still // '/bin/bash' up until the exec. -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25) +#if ! defined(STAPCONF_REAL_PARENT) #define real_parent parent #endif if (tsk != NULL && tsk->real_parent != NULL @@ -494,6 +494,7 @@ __stp_utrace_task_finder_report_exec(struct utrace_attached_engine *engine, // *could* call exec (although they aren't supposed to). __stp_utrace_attach_match_tsk(tsk->real_parent, tsk, 0, 1); } +#undef real_parent // We assume that all exec's are exec'ing a new process. Note // that we don't use bprm->filename, since that path can be diff --git a/tapset/ChangeLog b/tapset/ChangeLog index b1862324..670f3255 100644 --- a/tapset/ChangeLog +++ b/tapset/ChangeLog @@ -1,3 +1,10 @@ +2008-07-09 Mark Wielaard <mwielaard@redhat.com> + + PR 6732 + * context.stp (ppid): Use STAPCONF_REAL_PARENT. + (pexecname): Likewise. + * task.stp (task_parent): Likewise. + 2008-07-01 Wenji Huang <wenji.huang@oracle.com> * vfs.stp : Make _vfs.generic_commit_write only for kernel<=2.6.25 diff --git a/tapset/context.stp b/tapset/context.stp index 10c52226..017c934c 100644 --- a/tapset/context.stp +++ b/tapset/context.stp @@ -41,11 +41,19 @@ function tid:long () %{ /* pure */ %} function ppid:long () %{ /* pure */ +#if defined(STAPCONF_REAL_PARENT) + THIS->__retvalue = current->real_parent->tgid; +#else THIS->__retvalue = current->parent->tgid; +#endif %} function pexecname:string () %{ /* pure */ +#if defined(STAPCONF_REAL_PARENT) + strlcpy (THIS->__retvalue, current->real_parent->comm, MAXSTRINGLEN); +#else strlcpy (THIS->__retvalue, current->parent->comm, MAXSTRINGLEN); +#endif %} function gid:long () %{ /* pure */ diff --git a/tapset/task.stp b/tapset/task.stp index d89729e8..9215e83f 100644 --- a/tapset/task.stp +++ b/tapset/task.stp @@ -23,7 +23,11 @@ function task_current:long () %{ /* pure */ // Return the parent task_struct of the given task function task_parent:long (task:long) %{ /* pure */ struct task_struct *t = (struct task_struct *)(long)THIS->task; +#if defined(STAPCONF_REAL_PARENT) + THIS->__retvalue = (long)kread(&(t->real_parent)); +#else THIS->__retvalue = (long)kread(&(t->parent)); +#endif CATCH_DEREF_FAULT(); %} |