Re: [GIT PULL] timer fixes

From: Linus Torvalds
Date: Sat Aug 13 2022 - 16:28:11 EST


On Sat, Aug 13, 2022 at 9:25 AM Borislav Petkov <bp@xxxxxxxxx> wrote:
>
> That task_struct.sighand is marked __rcu and thus noderef and sparse
> complains:

I think that RCU marking is misleading.

Doing a

git grep -e '->sighand'

shows that we basically never treat that as some kind of RCU pointer.

Adding a

grep -i rcu

to the above shows that we have a couple of places that do this
carefully, but they are the exception rather than the rule.

I think the issue is that "current->sighand" is always safe (and that
"me->sighand" is the same thing), and that sighand has RCU-delayed
freeing so that __lock_task_sighand() can safely try to take the lock
of another process' sighand.

And we have no real way to explain to sparse that *some* cases are
fine, others are not and need the sighand lock (after that careful
__lock_task_sighand thing).

Linus