[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHk-=whLqbTNc1T+rHCm-kxbVAuhK3hjo5fOgDVf5-z--x1mvQ@mail.gmail.com>
Date:   Tue, 11 May 2021 10:28:13 -0700
From:   Linus Torvalds <torvalds@...ux-foundation.org>
To:     Oleg Nesterov <oleg@...hat.com>
Cc:     Andrew Morton <akpm@...ux-foundation.org>,
        "Eric W. Biederman" <ebiederm@...ssion.com>,
        Eugene Syromiatnikov <esyr@...hat.com>,
        Jan Kratochvil <jan.kratochvil@...hat.com>,
        Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
        Michael Kerrisk <mtk.manpages@...il.com>,
        Pedro Alves <palves@...hat.com>,
        Simon Marchi <simon.marchi@...icios.com>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH RESEND2] ptrace: make ptrace() fail if the tracee changed
 its pid unexpectedly
On Tue, May 11, 2021 at 9:56 AM Oleg Nesterov <oleg@...hat.com> wrote:
>
> This patch makes ptrace() fail in this case until debugger does wait()
> and consumes PTHREAD_EVENT_EXEC which reports old_pid.
I'm ok with the patch, just wondering which way it's supposed to come
to me. Should I just apply it directly?
That said, why this:
> +       rcu_read_lock();
> +       pid = task_pid_nr_ns(task, task_active_pid_ns(task->parent));
> +       rcu_read_unlock();
I don't see why the RCU read lock would be needed? task_pid_nr_ns()
does any required locking itself, afaik.
And even if it wasn't, this all happens with siglock held, can
anything actually change.
             Linus
Powered by blists - more mailing lists