From 25814e6c66b461380bbc9ef8fa263c868983efa6 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Wed, 9 Jul 2008 17:14:01 +0200 Subject: Fix PR 6732: Add runtime/autoconf-real-parent.c check for task_struct field. --- runtime/ChangeLog | 8 ++++++++ runtime/autoconf-real-parent.c | 15 +++++++++++++++ runtime/task_finder.c | 3 ++- 3 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 runtime/autoconf-real-parent.c (limited to 'runtime') 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 + + 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 * 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 + +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 -- cgit From 51a3785482396c9f653e3e7647945bfc24f7b160 Mon Sep 17 00:00:00 2001 From: "Frank Ch. Eigler" Date: Wed, 9 Jul 2008 22:36:46 -0400 Subject: fix shutdown race condition for scripts that might exit during begin probes --- runtime/transport/ChangeLog | 4 ++++ runtime/transport/transport.c | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'runtime') diff --git a/runtime/transport/ChangeLog b/runtime/transport/ChangeLog index 3dd65408..0a157390 100644 --- a/runtime/transport/ChangeLog +++ b/runtime/transport/ChangeLog @@ -1,4 +1,8 @@ +2008-07-09 Frank Ch. Eigler + PR5963 + * transport.c (_stp_work_queue): Don't signal a premature exit + if a begin probe happened to exit(). 2008-06-23 Wenji Huang PR 6646 diff --git a/runtime/transport/transport.c b/runtime/transport/transport.c index a4e4e652..8fc06f37 100644 --- a/runtime/transport/transport.c +++ b/runtime/transport/transport.c @@ -160,9 +160,9 @@ static void _stp_work_queue(void *data) wake_up_interruptible(&_stp_ctl_wq); /* if exit flag is set AND we have finished with probe_start() */ - if (unlikely(_stp_exit_flag)) + if (unlikely(_stp_exit_flag && _stp_probes_started)) _stp_cleanup_and_exit(1); - else if (likely(_stp_attached)) + if (likely(_stp_attached)) queue_delayed_work(_stp_wq, &_stp_work, STP_WORK_TIMER); } -- cgit