Re: [GIT PULL] SELinux fixes for v5.15 (#1)

From: Linus Torvalds
Date: Wed Sep 22 2021 - 17:10:58 EST


On Wed, Sep 22, 2021 at 1:55 PM Linus Torvalds
<torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:
>
> Make the regular security_locked_down() function do that, and add a
>
> if (WARN_ON_ONCE(!in_task()))
> return -EPERM;
>
> so that any bad cases get flagged and refuse to continue.

Actually, no, I take that back.

It's not the "!in_task()" case that is the problem. That's just the symptom.

The real problem is that we clearly have some lock-down rule that
seems to care about credentials and who it is that does the lockdown
query. That seems to be the real issue here. Doing lockdown checks
from interrupts should be fine.

The security layer really seems to be doing odd and random things.
Maybe we should have some debug switch with the above WARN_ON() inside
current_cred() (and a number of other 'current' users too). Just to
see if there are other cases where people look up basically random
credentials.

When the security layer is confused, that's not a good sign.

Linus