Re: [PATCH 1/2] proc: protect ptrace_may_access() with exec_update_lock (part 1)
From: Jann Horn
Date: Tue May 26 2026 - 14:37:27 EST
On Tue, May 26, 2026 at 8:22 PM Oleg Nesterov <oleg@xxxxxxxxxx> wrote:
> On 05/26, Jann Horn wrote:
> >
> > On Tue, May 26, 2026 at 10:48 AM Oleg Nesterov <oleg@xxxxxxxxxx> wrote:
> > > On 05/18, Jann Horn wrote:
> > > >
> > > > Fix the easy cases where procfs currently calls ptrace_may_access() without
> > > > exec_update_lock protection, where the fix is to simply add the extra lock
> > > > or use mm_access():
> > >
> > > I thought about this too, but I do not know if it is fine performance wise...
> > >
> > > And what about proc_coredump_filter_write() which doesn't use ptrace_may_access() ?
> >
> > Yeah, this series doesn't fix everything,
>
> Aah... Of course, I understand. I wasn't clear. Sorry if it looked as
> "you missed proc_coredump_filter_write" from my side.
>
> What I actually tried to ask:
>
> - Do you think it makes sense to fix proc_coredump_filter_write()
> as well?
Yes. Another example I've seen that should probably also be fixed is
seq_show() in fs/proc/fd.c, the handler for /proc/$pid/fdinfo/$fd,
that also currently has zero checks at read() time.
> - If yes. Do you think we should add another down_read(exec_update_lock) +
> ptrace_may_access() into proc_coredump_filter_write() ? Or perhaps we
> should discuss other approaches (exec_id/seqcount/etc) from the very
> beginning?
I had thought that this series would be the easy, uncontroversial
improvements, and that we could then think about the harder aspect
with read handlers afterwards. I guess I was wrong about this being
the uncontroversial part.