[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20090211093354.GD14265@elte.hu>
Date: Wed, 11 Feb 2009 10:33:54 +0100
From: Ingo Molnar <mingo@...e.hu>
To: Oleg Nesterov <oleg@...hat.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Markus Metzger <markus.t.metzger@...el.com>,
Roland McGrath <roland@...hat.com>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH, for 2.6.29] ptrace: fix the usage of ptrace_fork()
* Oleg Nesterov <oleg@...hat.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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists