From: Josh Poimboeuf <jpoimboe@kernel.org>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Borislav Petkov <bp@alien8.de>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
x86@kernel.org, Andrew Cooper <andrew.cooper3@citrix.com>
Subject: Re: [PATCH] x86: fix user address masking non-canonical speculation issue
Date: Thu, 24 Oct 2024 12:09:03 -0700 [thread overview]
Message-ID: <20241024190903.qlmfegs4y7rxl6q5@treble.attlocal.net> (raw)
In-Reply-To: <CAHk-=wjBkvHNTy3orkjw=2GH25S4MSFWesSjni2zZNW2+gjomg@mail.gmail.com>
On Thu, Oct 24, 2024 at 11:13:35AM -0700, Linus Torvalds wrote:
> It does result in a few more casts on the C side, since you can't just
> do bitwise 'or' on a pointer, but I think it's still the right thing
> to do. So that thing becomes
>
> static inline void __user *mask_user_address(const void __user *ptr)
> {
> unsigned long mask;
> asm("cmp %1,%0\n\t"
> "sbb %0,%0"
> :"=r" (mask)
> :"r" (ptr),
> "0" (runtime_const_ptr(USER_PTR_MAX)));
> return (__force void __user *)(mask | (__force unsigned long)ptr);
> }
On a non-related note, doesn't the inline asm need a "cc" clobber?
--
Josh
next prev parent reply other threads:[~2024-10-24 19:09 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 [this message]
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
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=20241024190903.qlmfegs4y7rxl6q5@treble.attlocal.net \
--to=jpoimboe@kernel.org \
--cc=andrew.cooper3@citrix.com \
--cc=bp@alien8.de \
--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®