linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: Jim Newsome <jnewsome@torproject.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ptrace: Allow other threads to access tracee
Date: Fri, 12 Mar 2021 18:07:10 +0100	[thread overview]
Message-ID: <20210312170709.GD27820@redhat.com> (raw)
In-Reply-To: <f82d5f3a-63f7-2f3f-0e34-aa53ade15bfc@torproject.org>

On 03/11, Jim Newsome wrote:
>
> I suppose even if the corruption of the register-values-themselves is
> acceptable, some synchronization may be needed to avoid the possibility
> of corrupting the kernel's data structures?

Yes, the kernel can crash. Just look at the comment above ptrace_freeze_traced().
The kernel assumes that the tracee is frozen, in particular it can't exit.
Say, ptrace_peek_siginfo() can crash the tracee exits and clears ->sighand,
and this can obviously happen if another thread does PTRACE_CONT + SIGKILL.

> Is it "just" a matter of adding some locking? Would a relatively coarse
> lock on the target task over the duration of the ptrace call

Yes I think needs a mutex in task_struct. But honestly I am not sure
it makes sense.... I dunno.

> (which I
> believe is always non-blocking?)

Why? It is blocking.

Oleg.


      reply	other threads:[~2021-03-12 17:07 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-10 20:59 [PATCH] ptrace: Allow other threads to access tracee Jim Newsome
2021-03-11  1:31 ` kernel test robot
2021-03-11 15:21 ` Oleg Nesterov
2021-03-11 16:49   ` Jim Newsome
2021-03-12 17:07     ` Oleg Nesterov [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=20210312170709.GD27820@redhat.com \
    --to=oleg@redhat.com \
    --cc=jnewsome@torproject.org \
    --cc=linux-kernel@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).