From: Ingo Molnar <mingo@elte.hu>
To: Oleg Nesterov <oleg@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Markus Metzger <markus.t.metzger@intel.com>,
Roland McGrath <roland@redhat.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH, for 2.6.29] ptrace: fix the usage of ptrace_fork()
Date: Wed, 11 Feb 2009 10:33:54 +0100 [thread overview]
Message-ID: <20090211093354.GD14265@elte.hu> (raw)
In-Reply-To: <20090209010233.GA26444@redhat.com>
* Oleg Nesterov <oleg@redhat.com> wrote:
> I noticed by pure accident we have ptrace_fork() and friends. This was
> added by "x86, bts: add fork and exit handling", commit
> bf53de907dfdaac178c92d774aae7370d7b97d20
>
> I can't test this, ds_request_bts() returns -EOPNOTSUPP, but I strongly
> believe this needs the fix. I think something like this program
>
> int main(void)
> {
> int pid = fork();
>
> if (!pid) {
> ptrace(PTRACE_TRACEME, 0, NULL, NULL);
> kill(getpid(), SIGSTOP);
> fork();
> } else {
> struct ptrace_bts_config bts = {
> .flags = PTRACE_BTS_O_ALLOC,
> .size = 4 * 4096,
> };
>
> wait(NULL);
>
> ptrace(PTRACE_SETOPTIONS, pid, NULL, PTRACE_O_TRACEFORK);
> ptrace(PTRACE_BTS_CONFIG, pid, &bts, sizeof(bts));
> ptrace(PTRACE_CONT, pid, NULL, NULL);
>
> sleep(1);
> }
>
> return 0;
> }
>
> should crash the kernel.
>
> If the task is traced by its natural parent ptrace_reparented() returns 0
> but we should clear ->btsxxx anyway.
>
> This is a minimal fix for 2.6.29, we need further cleanups imho.
I've applied this fix to tip:x86/urgent for now, until the other fix
from Markus gets finalized.
Ingo
prev parent reply other threads:[~2009-02-11 9:34 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-09 1:02 [PATCH, for 2.6.29] ptrace: fix the usage of ptrace_fork() Oleg Nesterov
2009-02-09 1:28 ` Oleg Nesterov
2009-02-09 1:54 ` Roland McGrath
2009-02-09 9:28 ` Metzger, Markus T
2009-02-09 19:36 ` Oleg Nesterov
2009-02-10 9:47 ` Metzger, Markus T
2009-02-10 18:40 ` Oleg Nesterov
2009-02-10 20:21 ` Markus Metzger
2009-02-10 21:00 ` Markus Metzger
2009-02-10 21:48 ` Oleg Nesterov
2009-02-11 7:03 ` Markus Metzger
2009-02-10 20:08 ` Andrew Morton
2009-02-11 9:33 ` Ingo Molnar [this message]
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=20090211093354.GD14265@elte.hu \
--to=mingo@elte.hu \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=markus.t.metzger@intel.com \
--cc=oleg@redhat.com \
--cc=roland@redhat.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.