[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <yuxpa4k3hdpplol35cdbvcaiwbi2i4mwwkww6tuab6loopdezm@qkhzxo3zlf7g>
Date: Thu, 24 Oct 2024 15:32:32 +0300
From: "Kirill A. Shutemov" <kirill@...temov.name>
To: Borislav Petkov <bp@...en8.de>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>, x86@...nel.org, Andrew Cooper <andrew.cooper3@...rix.com>,
Josh Poimboeuf <jpoimboe@...nel.org>
Subject: Re: [PATCH] x86: fix user address masking non-canonical speculation
issue
On Thu, Oct 24, 2024 at 01:08:22PM +0200, Borislav Petkov wrote:
> > @@ -2389,6 +2390,15 @@ void __init arch_cpu_finalize_init(void)
> > alternative_instructions();
> >
> > if (IS_ENABLED(CONFIG_X86_64)) {
> > + unsigned long USER_PTR_MAX = TASK_SIZE_MAX;
> > +
> > + /*
> > + * Enable this when LAM is gated on LASS support
> > + if (cpu_feature_enabled(X86_FEATURE_LAM))
> > + USER_PTR_MAX = (1ul << 63) - PAGE_SIZE;
> > + */
> > + runtime_const_init(ptr, USER_PTR_MAX);
>
> Looking at Documentation/arch/x86/x86_64/mm.rst, 5 level page tables define
> USR_PTR_MAX as 0x00ffffffffffffff, i.e., bits [55:0].
>
> So I guess that USER_PTR_MAX needs to look at X86_FEATURE_LA57, no?
X86_FEATURE_LA57 is already handled inside TASK_SIZE_MAX definition.
Although, it might be worth updating end of userspace VA in mm.rst with
-PAGE_SIZE.
--
Kiryl Shutsemau / Kirill A. Shutemov
Powered by blists - more mailing lists