Re: [PATCH v2] sched/rt: Fix race in push_rt_task
From: Phil Auld
Date: Wed Mar 26 2025 - 09:19:39 EST
On Mon, Feb 17, 2025 at 11:54:09AM -0500 Steven Rostedt wrote:
> On Fri, 14 Feb 2025 17:08:44 +0000
> Harshit Agarwal <harshit@xxxxxxxxxxx> wrote:
>
> > Co-developed-by: Jon Kohler <jon@xxxxxxxxxxx>
> > Signed-off-by: Jon Kohler <jon@xxxxxxxxxxx>
> > Co-developed-by: Gauri Patwardhan <gauri.patwardhan@xxxxxxxxxxx>
> > Signed-off-by: Gauri Patwardhan <gauri.patwardhan@xxxxxxxxxxx>
> > Co-developed-by: Rahul Chunduru <rahul.chunduru@xxxxxxxxxxx>
> > Signed-off-by: Rahul Chunduru <rahul.chunduru@xxxxxxxxxxx>
> > Signed-off-by: Harshit Agarwal <harshit@xxxxxxxxxxx>
> > Tested-by: Will Ton <william.ton@xxxxxxxxxxx>
> > ---
> > Changes in v2:
> > - As per Steve's suggestion, removed some checks that are done after
> > obtaining the lock that are no longer needed with the addition of new
> > check.
> > - Moved up is_migration_disabled check.
> > - Link to v1:
> > https://lore.kernel.org/lkml/20250211054646.23987-1-harshit@xxxxxxxxxxx/
> > ---
> > kernel/sched/rt.c | 54 +++++++++++++++++++++++------------------------
> > 1 file changed, 26 insertions(+), 28 deletions(-)
>
>
> Reviewed-by: Steven Rostedt (Google) <rostedt@xxxxxxxxxxx>
>
We've got some cases that look to be hitting this as well.
I'm a little concerned about turning some runtime checks into
BUG_ON()s but in this case I think we are really just going to
trap out on !has_pushable_tasks() check first and if not, pick
a different task and don't drop the lock so it should pass the
BUG_ON()s and fail to match the original task. So...
Reviewed-by: Phil Auld <pauld@xxxxxxxxxx>
Cheers,
Phil
> Peter or Ingo,
>
> Care to take his patch
>
> Thanks,
>
> -- Steve
>
--