Re: [PATCH] x86: Implement Linear Address Masking support

From: Peter Zijlstra
Date: Thu May 12 2022 - 10:35:34 EST


On Thu, May 12, 2022 at 01:01:07PM +0000, David Laight wrote:

> > +static inline int64_t sign_extend64(uint64_t value, int index)
> > +{
> > + int shift = 63 - index;
> > + return (int64_t)(value << shift) >> shift;
> > +}
>
> Shift of signed integers are UB.

The kernel uses -fno-strict-overflow, all the signed UB is gone.