[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250915120537.GB23082@redhat.com>
Date: Mon, 15 Sep 2025 14:05:38 +0200
From: Oleg Nesterov <oleg@...hat.com>
To: Mateusz Guzik <mjguzik@...il.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Christian Brauner <brauner@...nel.org>,
Jiri Slaby <jirislaby@...nel.org>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/2] fix the racy usage of task_lock(tsk->group_leader)
in sys_prlimit64() paths
On 09/14, Mateusz Guzik wrote:
>
> On Sun, Sep 14, 2025 at 1:11 PM Oleg Nesterov <oleg@...hat.com> wrote:
> >
> > Change sys_prlimit64() to take tasklist_lock when necessary. This is not
> > nice, but I don't see a better fix for -stable.
> >
> > Cc: stable@...r.kernel.org
> > Fixes: c022a0acad53 ("rlimits: implement prlimit64 syscall")
>
> I think this is more accurate:
> Fixes: 18c91bb2d872 ("prlimit: do not grab the tasklist_lock")
Yes, thanks again.
> Unfortunately this syscall is used by glibc to get/set limits, the
> good news is that almost all real-world calls (AFAICS) with the
> calling task as the target. As in, performance-wise, this should not
> be a regression and I agree it is more than adequate for stable.
OK, good, I'll send v2 with the corrected "Fixes" tag.
> 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.
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.
Thanks!
Oleg.
Powered by blists - more mailing lists