Re: [PATCH v2 00/12] uaccess: Refuse and warn on user accesses when current->mm is NULL
From: Christophe Leroy (CS GROUP)
Date: Wed Dec 02 2026 - 11:06:53 EST
Le 02/12/2026 à 16:24, Dave Hansen a écrit :
On 12/2/26 07:04, Christophe Leroy (CS GROUP) wrote:
Also about the masked user access path, the principle of that path is to
be branch-less, the whole purpose was the remove the test/branch from
access_ok(). With your new check it is not anymore branch-less
Branches themselves are OK. The problem branches are around access
checks because they potentially allow transient execution paths to skip
the checking.
In this case, the new check forces a return before any accesses happen
or any bounds checks are done. If the new check was incorrectly
speculated, we'd just have transient execution doing what the
*architectural* path is allowed to do today.
I _think_ that's OK, at least from a spectre v1 perspective. But it
could definitely use some more eyeballs on it.
Thanks for the explanation.
I do agree with you about the code size concerns.
Behind the code size, my worry is that for a simple get_user() with is more or less a simple memory read, we end up with 3 memory reads because we first need to read paca->__current, then paca->__current->mm
Other point, is current->mm == NULL the only problematic situation ? No risk to have ->mm not NULL yet not the right one ? Isn't it this that had to be fixed by commit 2520694e6048 ("KVM: Reject user accesses to guest memory if current->mm != kvm->mm") ?
Christophe