[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210311152123.GC15552@redhat.com>
Date: Thu, 11 Mar 2021 16:21:23 +0100
From: Oleg Nesterov <oleg@...hat.com>
To: Jim Newsome <jnewsome@...project.org>
Cc: linux-kernel@...r.kernel.org
Subject: Re: [PATCH] ptrace: Allow other threads to access tracee
On 03/10, Jim Newsome wrote:
>
> @@ -238,7 +238,7 @@ static int ptrace_check_attach(struct task_struct *child, bool ignore_state)
> * be changed by us so it's not changing right after this.
> */
> read_lock(&tasklist_lock);
> - if (child->ptrace && child->parent == current) {
> + if (child->ptrace && same_thread_group(child->parent, current)) {
Cough... it is not that simple.
Just suppose that 2 threads call ptrace(tracee) at the same time. Say, the 1st
thread does PTRACE_CONT while the 2nd thread tries to change the registers.
Oleg.
Powered by blists - more mailing lists