Re: [PATCH 2/2] fix the racy usage of task_lock(tsk->group_leader) in sys_prlimit64() paths

Mateusz Guzik
2025-09-15T13:19:38Z

On Mon, Sep 15, 2025 at 2:07 PM Oleg Nesterov <oleg@redhat.com> wrote:
>
> On 09/14, Mateusz Guzik wrote:
> > As for something more longterm, what would you think about
> > synchronizing changes with a lock within ->signal?
>
> Agreed, we should probably change the locking, but I am not a new lock
> to protect just signal->rlim makes a lot of sense...
>
> We can probably reuse signal->stats_lock, but it needs to disable IRQs.
> Or ->siglock, but it is already overused.
>

The woes from a lock from a different structure aside, I find it
pretty weird that reading rlimits requires taking a lock to begin
with.

I'm not going to argue for a new dedicated lock. I do argue for
sequence counters to read this. With this in place even the
irq-shafted lock wont be much of a problem.

Again I can write a patch to that extent, but no ETA.

> I dunno. In any case we need to cleanup the usage of ->group_leader,
> it seems there are more buggy users. I'll try to take another look
> this week. And probably it and ->real_parent should be moved to
> signal_struct.
>

I got myself into some vfs-related stuff, so I'm going to spare a rant
about linux not having a 'struct process' or similar. ;->