[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHk-=wihBAdfL+OgaO71H_n4NFVyDdTXWEA_fjrdEFUc-=D1Sg@mail.gmail.com>
Date: Thu, 24 Oct 2024 10:35:33 -0700
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Josh Poimboeuf <jpoimboe@...nel.org>
Cc: Linux Kernel Mailing List <linux-kernel@...r.kernel.org>, x86@...nel.org,
Andrew Cooper <andrew.cooper3@...rix.com>, Borislav Petkov <bp@...en8.de>
Subject: Re: [PATCH] x86: fix user address masking non-canonical speculation issue
On Wed, 23 Oct 2024 at 23:13, Josh Poimboeuf <jpoimboe@...nel.org> wrote:
>
> I'm probably missing something but once LAM is enabled, how wouldn't
> this allow non-canonical address speculation?
Once LAM is enabled, together with LASS, non-canonical addresses
basically don't exit.
> i.e. when bit 47/56 is
> set and 63 is cleared, would it not go untouched by mask_user_address()
> and thus be speculatively interpreted by AMD as a kernel address?
AMD doesn't _have_ LAM. When they do, they had better not
speculatively mis-interpret addresses.
IOW, notice how the LAM enablement is *dynamic* based on cpu_feature_enabled()?
(Well, right now it's commented out because Intel needs LASS for it to
work right, but that's a separate issue).
> Also, the comment above __access_ok() now seems obsolete:
>
> /*
> * User pointers can have tag bits on x86-64. This scheme tolerates
> * arbitrary values in those bits rather then masking them off.
No. The comment is still correct. The scheme tolerates exactly the LAM
kind of hardware-based address masking.
The difference is just that the constant is now boot-time dynamic, so
if LAM isn't there, the whole tag bit issue goes away, of course.
> * Enforce two rules:
> * 1. 'ptr' must be in the user half of the address space
> * 2. 'ptr+size' must not overflow into kernel addresses
.. except the "user half" should probably be "user part".
Linus
Powered by blists - more mailing lists