Message ID | 20230413184219.36404-14-minipli@grsecurity.net (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | x86: cleanups, fixes and new tests | expand |
diff --git a/x86/emulator64.c b/x86/emulator64.c index a98c66c2b44f..492e8a292839 100644 --- a/x86/emulator64.c +++ b/x86/emulator64.c @@ -401,6 +401,13 @@ static void test_sreg(volatile uint16_t *mem) exception_error_code() == 0 && read_ss() == 0, "mov null, %%ss (with ss.rpl != cpl)"); + // check for exception when ss.rpl != cpl on non-null segment load + *mem = KERNEL_DS | 3; + asm volatile(ASM_TRY("1f") "mov %0, %%ss; 1:" : : "m"(*mem)); + report(exception_vector() == GP_VECTOR && + exception_error_code() == KERNEL_DS && read_ss() == 0, + "mov non-null, %%ss (with ss.rpl != cpl)"); + write_ss(ss); }
Complement the NULL selector based RPL!=CPL test with a non-NULL one to ensure the failing segment selector is correctly reported through the exception error code. Signed-off-by: Mathias Krause <minipli@grsecurity.net> --- x86/emulator64.c | 7 +++++++ 1 file changed, 7 insertions(+)