On 25.02.2025 23:45, Andrew Cooper wrote: > A CALL with 0 displacement is handled specially, and is why this logic > functions even with CET Shadow Stacks active. Nevertheless a rip-relative LEA > is the more normal way of doing this in 64bit code. > > The retrieval of flags modifies the stack pointer so needs to state a > dependency on the stack pointer. Despite it's name, ASM_CALL_CONSTRAINT is > the way to do this. > > read_sreg() forces the answer through a register, causing code generation of > the form: > > mov %gs, %eax > mov %eax, %eax > mov %rax, 0x140(%rsi) > > Encode the reads directly with a memory operand. This results in a 16bit > store instead of an 64bit store, but the backing memory is zeroed. > > While cleaning this up, drop one piece of trailing whitespace. > > No functional change. > > Signed-off-by: Andrew Cooper <[email protected]>
With the plan to ultimately drop read_sreg() altogether: Reviewed-by: Jan Beulich <[email protected]> Jan
