From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: linux-kernel@vger.kernel.org, Ingo Molnar <mingo@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
Oleg Nesterov <oleg@redhat.com>,
Frederic Weisbecker <fweisbec@gmail.com>
Subject: Re: [for-next][PATCH v2 1/3] tracing: Fix syscall_*regfunc() vs copy_process() race
Date: Fri, 20 Jun 2014 18:11:25 -0700 [thread overview]
Message-ID: <20140621011125.GA23415@linux.vnet.ibm.com> (raw)
In-Reply-To: <20140620104711.140660296@goodmis.org>
On Fri, Jun 20, 2014 at 06:45:19AM -0400, Steven Rostedt wrote:
> From: Oleg Nesterov <oleg@redhat.com>
>
> syscall_regfunc() and syscall_unregfunc() should set/clear
> TIF_SYSCALL_TRACEPOINT system-wide, but do_each_thread() can race
> with copy_process() and miss the new child which was not added to
> the process/thread lists yet.
>
> Change copy_process() to update the child's TIF_SYSCALL_TRACEPOINT
> under tasklist.
>
> Link: http://lkml.kernel.org/p/20140413185854.GB20668@redhat.com
>
> Cc: stable@vger.kernel.org # 2.6.33
> Fixes: a871bd33a6c0 "tracing: Add syscall tracepoints"
> Acked-by: Frederic Weisbecker <fweisbec@gmail.com>
> Signed-off-by: Oleg Nesterov <oleg@redhat.com>
> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> ---
> include/trace/syscall.h | 15 +++++++++++++++
> kernel/fork.c | 2 ++
> 2 files changed, 17 insertions(+)
>
> diff --git a/include/trace/syscall.h b/include/trace/syscall.h
> index fed853f3d7aa..9674145e2f6a 100644
> --- a/include/trace/syscall.h
> +++ b/include/trace/syscall.h
> @@ -4,6 +4,7 @@
> #include <linux/tracepoint.h>
> #include <linux/unistd.h>
> #include <linux/ftrace_event.h>
> +#include <linux/thread_info.h>
>
> #include <asm/ptrace.h>
>
> @@ -32,4 +33,18 @@ struct syscall_metadata {
> struct ftrace_event_call *exit_event;
> };
>
> +#if defined(CONFIG_TRACEPOINTS) && defined(CONFIG_HAVE_SYSCALL_TRACEPOINTS)
> +static inline void syscall_tracepoint_update(struct task_struct *p)
> +{
> + if (test_thread_flag(TIF_SYSCALL_TRACEPOINT))
> + set_tsk_thread_flag(p, TIF_SYSCALL_TRACEPOINT);
> + else
> + clear_tsk_thread_flag(p, TIF_SYSCALL_TRACEPOINT);
> +}
> +#else
> +static inline void syscall_tracepoint_update(struct task_struct *p)
> +{
> +}
> +#endif
> +
> #endif /* _TRACE_SYSCALL_H */
> diff --git a/kernel/fork.c b/kernel/fork.c
> index d2799d1fc952..6a13c46cd87d 100644
> --- a/kernel/fork.c
> +++ b/kernel/fork.c
> @@ -1487,7 +1487,9 @@ static struct task_struct *copy_process(unsigned long clone_flags,
>
> total_forks++;
> spin_unlock(¤t->sighand->siglock);
> + syscall_tracepoint_update(p);
> write_unlock_irq(&tasklist_lock);
> +
> proc_fork_connector(p);
> cgroup_post_fork(p);
> if (clone_flags & CLONE_THREAD)
> --
> 2.0.0
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
next prev parent reply other threads:[~2014-06-21 1:11 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-20 10:45 [for-next][PATCH v2 0/3] tracing: Fixes to syscall tracing Steven Rostedt
2014-06-20 10:45 ` [for-next][PATCH v2 1/3] tracing: Fix syscall_*regfunc() vs copy_process() race Steven Rostedt
2014-06-21 1:11 ` Paul E. McKenney [this message]
2014-06-21 1:19 ` Steven Rostedt
2014-06-24 6:55 ` Namhyung Kim
2014-06-26 17:49 ` Steven Rostedt
2014-06-20 10:45 ` [for-next][PATCH v2 2/3] tracing: Change syscall_*regfunc() to check PF_KTHREAD and use for_each_process_thread() Steven Rostedt
2014-06-20 10:45 ` [for-next][PATCH v2 3/3] tracing: syscall_regfunc() should not skip kernel threads Steven Rostedt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140621011125.GA23415@linux.vnet.ibm.com \
--to=paulmck@linux.vnet.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=fweisbec@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=oleg@redhat.com \
--cc=rostedt@goodmis.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox