On 1/23/23 18:27, Ammar Faizi wrote:
From: Ammar Faizi ammarfaizi2@gnuweeb.org
The current selftest asserts %r11 == %rflags after the 'syscall' returns to user. Such an assertion doesn't apply to a FRED system because in a FRED system the 'syscall' instruction does not set %r11=%rflags and %rcx=%rip.
Handle the FRED case. Now, test that:
- "syscall" in a FRED system doesn't clobber %rcx and %r11.
- "syscall" in a non-FRED system sets %rcx=%rip and %r11=%rflags.
The 'raise()' function from libc can't be used to control those registers. Therefore, create a syscall wrapper in inline Assembly to fully control them.
Fixes: 660602140103 ("selftests/x86: Add a selftest for SYSRET to noncanonical addresses") Link: https://lore.kernel.org/lkml/25b96960-a07e-a952-5c23-786b55054126@zytor.com Reported-by: Xin Li xin3.li@intel.com Co-developed-by: "H. Peter Anvin" hpa@zytor.com Signed-off-by: Ammar Faizi ammarfaizi2@gnuweeb.org
Need hpa's sign off.
For both patches:
Acked-by: H. Peter Anvin (Intel) hpa@zytor.com