mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Linus Torvalds <torvalds@linux-foundation.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Cc: x86@kernel.org, Josh Poimboeuf <jpoimboe@kernel.org>,
	Borislav Petkov <bp@alien8.de>
Subject: Re: [PATCH] x86: fix user address masking non-canonical speculation issue
Date: Fri, 25 Oct 2024 20:00:17 +0100	[thread overview]
Message-ID: <fda92169-224d-45e5-8645-7f4b12fc5ba4@citrix.com> (raw)
In-Reply-To: <20241024013214.129639-1-torvalds@linux-foundation.org>

On 24/10/2024 2:31 am, Linus Torvalds wrote:
> It turns out that AMD has a "Meltdown Lite(tm)" issue with non-canonical
> accesses in kernel space.  And so using just the high bit to decide
> whether an access is in user space or kernel space ends up with the good
> old "leak speculative data" if you have the right gadget using the
> result:
>
>   CVE-2020-12965 “Transient Execution of Non-Canonical Accesses“
>
> Now, the kernel surrounds the access with a STAC/CLAC pair, and those
> instructions end up serializing execution on older Zen architectures,
> which closes the speculation window.
>
> But that was true only up until Zen 5, which renames the AC bit [1].
> That improves performance of STAC/CLAC a lot, but also means that the
> speculation window is now open.
>
> Note that this affects not just the new address masking, but also the
> regular valid_user_address() check used by access_ok(), and the asm
> version of the sign bit check in the get_user() helpers.
>
> It does not affect put_user() or clear_user() variants, since there's no
> speculative result to be used in a gadget for those operations.
>
> Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
> Link: https://lore.kernel.org/all/80d94591-1297-4afb-b510-c665efd37f10@citrix.com/
> Link: https://lore.kernel.org/all/20241023094448.GAZxjFkEOOF_DM83TQ@fat_crate.local/ [1]
> Link: https://www.amd.com/en/resources/product-security/bulletin/amd-sb-1010.html
> Link: https://arxiv.org/pdf/2108.10771
> Cc: Josh Poimboeuf <jpoimboe@kernel.org>
> Cc: Borislav Petkov <bp@alien8.de>
> Fixes: 2865baf54077 ("x86: support user address masking instead of non-speculative conditional")
> Fixes: 6014bc27561f ("x86-64: make access_ok() independent of LAM")
> Fixes: b19b74bc99b1 ("x86/mm: Rework address range check in get_user() and put_user()")
> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Thankyou.  This looks a whole lot safer than the prior options.

Tentatively Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>, but
it's probably worth trying to get AMD to rubber stamp it too.



      parent reply	other threads:[~2024-10-25 19:00 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-24  1:31 Linus Torvalds
2024-10-24  6:13 ` Josh Poimboeuf
2024-10-24 14:02   ` Kirill A. Shutemov
2024-10-24 15:42     ` Josh Poimboeuf
2024-10-24 17:35   ` Linus Torvalds
2024-10-24 18:47     ` Josh Poimboeuf
2024-10-25 18:52       ` Andrew Cooper
2024-10-25  9:01     ` Kirill A. Shutemov
2024-10-24 11:08 ` Borislav Petkov
2024-10-24 12:32   ` Kirill A. Shutemov
2024-10-24 13:02     ` Borislav Petkov
2024-10-24 17:53   ` Linus Torvalds
2024-10-24 18:13     ` Linus Torvalds
2024-10-24 19:09       ` Josh Poimboeuf
2024-10-24 20:00         ` Linus Torvalds
2024-10-25 11:24       ` Borislav Petkov
2024-10-24 14:09 ` Kirill A. Shutemov
2024-10-25 14:15 ` Maciej Wieczor-Retman
2024-10-25 17:41   ` Linus Torvalds
2024-10-25 19:00 ` Andrew Cooper [this message]

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=fda92169-224d-45e5-8645-7f4b12fc5ba4@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=bp@alien8.de \
    --cc=jpoimboe@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®