Re: [GIT PULL] sched/urgent for 5.17-rc4

From: Linus Torvalds
Date: Sun Feb 13 2022 - 13:02:46 EST


On Sun, Feb 13, 2022 at 4:37 AM Borislav Petkov <bp@xxxxxxx> wrote:
>
> Tadeusz Struk (1):
> sched/fair: Fix fault in reweight_entity

I've pulled this, but this really smells bad to me.

If set_load_weight() can see a process that hasn't even had the
runqueue pointer set yet, then what keeps *others* from the same
thing?

Adding a test like this in set_load_weight() just makes me go "what
makes this function so special"? IOW, why could only that function see
this situation with a missing cfs_rq pointer?

I really get the feeling that this is papering over a serious mistake
in how commit 4ef0c5c6b5ba ("kernel/sched: Fix sched_fork() access an
invalid sched_task_group") now causes fundamental process state to be
initialized too late - when the process is already visible to others.

The setpriority() -> dequeue_load_avg() chain just seems to be one
possible case.

*ANYBODY* that does find_task_by_vpid(who) would seem to be able to
find a task that hasn't actually been fully set up yet, and

Somebody tell me why I'm wrong, and what makes that setpriority thing
so magically special. Please.

Linus