lkml.org 
[lkml]   [2022]   [Jun]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCHv3 5/8] x86/uaccess: Provide untagged_addr() and remove tags before address check
On Fri, Jun 17, 2022 at 07:22:57AM -0700, H.J. Lu wrote:
> On Fri, Jun 17, 2022 at 4:36 AM Peter Zijlstra <peterz@infradead.org> wrote:
> >
> > On Thu, Jun 16, 2022 at 07:44:40PM +0300, Kirill A. Shutemov wrote:
> > > Any objection against this variant (was posted in the thread):
> > >
> > > #define untagged_addr(mm, addr) ({ \
> > > u64 __addr = (__force u64)(addr); \
> > > s64 sign = (s64)__addr >> 63; \
> > > __addr &= (mm)->context.untag_mask | sign; \
> > > (__force __typeof__(addr))__addr; \
> > > })
> > >
> > > ?
> >
> > Yeah, I suppose that should work fine.
>
> Won't the sign bit be put at the wrong place?

sign is either 0 or ~0, by or-ing ~0 into the mask, the masking becomes
no-op.

\
 
 \ /
  Last update: 2022-06-17 16:33    [W:0.290 / U:0.472 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site