Re: [RFC PATCH] ptrace: make ptrace() fail if the tracee changed its pid unexpectedly

From: Simon Marchi
Date: Sat Dec 19 2020 - 23:49:22 EST


On 2020-12-19 2:33 p.m., Oleg Nesterov wrote:
> OOPS! Sorry Simon, yes I forgot to add reported-by. Andrew, or Eric, if
> you take this patch, could you also add
>
> Reported-by: Simon Marchi <simon.marchi@xxxxxxxxxxxx>

I tried the original reproducer on a patched kernel, and it looks good.
GDB's behavior is still not super clean when this situation happens: a
PTRACE_GETREGS on the (disappeared) leader now fails with ESRCH (that's
what we want), and that interrupts the "continue" command and
unexpectedly brings back the prompt while leaving the other thread
running. But that is all logic that will have to be fixed inside GDB.

So, feel free to add

Acked-by: Simon Marchi <simon.marchi@xxxxxxxxxxxx>

too.

Thanks!

Simon