Re: [GIT pull] locking/urgent for 5.19-rc3

From: Linus Torvalds
Date: Sun Jun 19 2022 - 16:05:50 EST


On Sun, Jun 19, 2022 at 11:38 AM Jason A. Donenfeld <Jason@xxxxxxxxx> wrote:
>
> This was initially my concern too, which I expressed to Sebastian, but
> he made the point that this area here is rather "special". Actually,
> randomness isn't really required here.

That wasn't really my point.

My point was that there are a lot of uses of prandom_u32() and friends
in random places. Just grepping for it, there's lots of different
drivers that use it. Who knows what locking they have.

Clearly nobody *thought* about it. This one issue is purely about RT
correctness, but how about all the uses that just want a pseudo-random
number and may have performance issues, or may be calling things so
much that a lock is just bad.

The thing is, that prandom code used to be FAST. Not just "no locks",
but also "fairly simple siphash round because its a PSEUDO random
thing and shouldn't be anything more".

The whole "make it use the same randomness" may just have been a huge
and fundamental mistake.

We've seen one actual outright bug because of it already. That was
easy to fix by avoiding the new thing that now was a mistake. What
about all the other uses with lock bouncing or whatever subtler issues
that aren't pointed out by outright correctness tests?

Linus