[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241024190903.qlmfegs4y7rxl6q5@treble.attlocal.net>
Date: Thu, 24 Oct 2024 12:09:03 -0700
From: Josh Poimboeuf <jpoimboe@...nel.org>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Borislav Petkov <bp@...en8.de>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
x86@...nel.org, Andrew Cooper <andrew.cooper3@...rix.com>
Subject: Re: [PATCH] x86: fix user address masking non-canonical speculation
issue
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
Powered by blists - more mailing lists