Messages in this thread | | | From | David Laight <> | Subject | RE: [PATCH 13/15] x86/fsgsbase/64: With FSGSBASE, compare GS bases on paranoid_entry | Date | Tue, 20 Mar 2018 10:16:36 +0000 |
| |
From: Chang S. Bae > Sent: 19 March 2018 17:49 ... > When FSGSBASE is enabled, SWAPGS needs if and only if (current) > GS base is not the kernel's. > > FSGSBASE instructions allow user to write any value on GS base; > even negative. Sign check on the current GS base is not > sufficient. Fortunately, reading GS base is fast. Kernel GS > base is also known from the offset table with the CPU number. ...
Use code might want to put a negative value into GSBASE. While it is normal to put a valid address into GSBASE there is no reason why the code can't put an offset into GSBASE, in which case it might be negative.
Yes, I know you can't put arbitrary 64bit values into GSBASE. But the difference between 2 user pointers will always be valid.
David
| |