[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <74a1ec83d9f44875b86d84f52d65a32c@AcuMS.aculab.com>
Date: Mon, 10 Sep 2018 13:52:24 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Linus Torvalds' <torvalds@...ux-foundation.org>,
Tony Luck <tony.luck@...el.com>
CC: Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Peter Anvin <hpa@...or.com>,
Borislav Petkov <bp@...en8.de>,
linux-edac <linux-edac@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
the arch/x86 maintainers <x86@...nel.org>,
Dan Williams <dan.j.williams@...el.com>,
Dave Jiang <dave.jiang@...el.com>
Subject: RE: [PATCH] x86/mce: Fix set_mce_nospec() to avoid #GP fault
From: Linus Torvalds
> ...
> You could literally do something like
>
> /* Make it canonical in case we flipped the high bit */
> addr = (long)(addr<<1)>>1;
Isn't it safer to use a mask and let the compiler decide if two
shifts are a good implementation?
addr &= ~HIGH_MAGIC_BIT;
ISTR fixing a bug in gld where it had (foo << 16) >> 16 instead
of foo & 0xffff. Didn't work well on 64bit.
(I may need to recompile that old gcc/gld again.
Failed miserably last time I tried.)
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
Powered by blists - more mailing lists