From: David Laight <David.Laight@ACULAB.COM>
To: 'Linus Torvalds' <torvalds@linux-foundation.org>,
Andrew Cooper <andrew.cooper3@citrix.com>,
"bp@alien8.de" <bp@alien8.de>,
Josh Poimboeuf <jpoimboe@kernel.org>
Cc: "x86@kernel.org" <x86@kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
'Arnd Bergmann' <arnd@kernel.org>,
"'Mikel Rychliski'" <mikel@mikelr.com>,
'Thomas Gleixner' <tglx@linutronix.de>,
"'Ingo Molnar'" <mingo@redhat.com>,
'Borislav Petkov' <bp@alien8.de>,
'Dave Hansen' <dave.hansen@linux.intel.com>,
"'H. Peter Anvin'" <hpa@zytor.com>
Subject: [PATCH] x86: Allow user accesses to the base of the guard page
Date: Sat, 23 Nov 2024 18:48:50 +0000 [thread overview]
Message-ID: <680c14b5af9d43d6bc70d2c1e9321e01@AcuMS.aculab.com> (raw)
A user buffer can validly end with the last valid user address.
In that case access_ok(ptr, size) will check that 'ptr + size'
is a valid user address - and it needs to succeed.
access_ok() can't decrement the length because access_ok(ptr, 0)
also has to be valid.
Any actual access will fault.
Fixes: 86e6b1547b3d0 ("x86: fix user address masking non-canonical speculation issue")
Signed-off-by: David Laight <david.laight@aculab.com>
---
arch/x86/kernel/cpu/common.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index 06a516f6795b..ca327cfa42ae 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -2389,12 +2389,12 @@ void __init arch_cpu_finalize_init(void)
alternative_instructions();
if (IS_ENABLED(CONFIG_X86_64)) {
- unsigned long USER_PTR_MAX = TASK_SIZE_MAX-1;
+ 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 - 1;
+ USER_PTR_MAX = (1ul << 63) - PAGE_SIZE;
*/
runtime_const_init(ptr, USER_PTR_MAX);
--
2.17.1
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
next reply other threads:[~2024-11-23 18:48 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-23 18:48 David Laight [this message]
2024-11-23 19:02 ` [PATCH] x86: Allow user accesses to the base of the guard page Linus Torvalds
2024-11-23 22:36 ` David Laight
2024-11-23 23:44 ` Linus Torvalds
2024-11-24 0:24 ` Mikel Rychliski
2024-11-24 0:30 ` Linus Torvalds
2024-11-24 3:10 ` Mikel Rychliski
2024-11-24 10:28 ` David Laight
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=680c14b5af9d43d6bc70d2c1e9321e01@AcuMS.aculab.com \
--to=david.laight@aculab.com \
--cc=andrew.cooper3@citrix.com \
--cc=arnd@kernel.org \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=jpoimboe@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mikel@mikelr.com \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.