lkml.org 
[lkml]   [2023]   [Jan]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Subject[RFC PATCH v6 0/3] sysret_rip update for the Intel FRED architecture
Date
From: Ammar Faizi <ammarfaizi2@gnuweeb.org>

Hi,

This is an RFC patchset v6. There are three patches in this series.

Xin Li reported that the sysret_rip test fails at:

assert(ctx->uc_mcontext.gregs[REG_EFL] ==
ctx->uc_mcontext.gregs[REG_R11]);

on the Intel FRED architecture. Let's handle the FRED system scenario
too. The 'syscall' instruction in a FRED system doesn't set %rcx=%rip
and %r11=%rflags.

Syscall and sysenter in a FRED system are treated equivalently to
software interrupts, e.g. INT 0x80. They do not modify any registers.

Link: https://lore.kernel.org/lkml/5d4ad3e3-034f-c7da-d141-9c001c2343af@intel.com

## Changelog v6:

- Move the check-regs assertion in sigusr1() to check_regs_result()
(HPA).

- Add a new test just like sigusr1(), but don't modify REG_RCX and
REG_R11. This is used to test SYSRET behavior consistency (HPA).

## Changelog v5:

- Fix do_syscall() return value (Ammar).

## Changelog v4:

- Fix the assertion condition inside the SIGUSR1 handler (Xin Li).

- Explain the purpose of patch #2 in the commit message (HPA).

- Update commit message (Ammar).

- Repeat test_syscall_rcx_r11_consistent() 32 times to be more sure
that the result is really consistent (Ammar).

## Changelog v3:

- Test that we don't get a mix of REGS_SAVED and REGS_SYSRET,
which is a major part of the point (HPA).

## Changelog v2:

- Use "+r"(rsp) as the right way to avoid redzone problems
per Andrew's comment (HPA).


Co-developed-by: H. Peter Anvin (Intel) <hpa@zytor.com>
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
Signed-off-by: Ammar Faizi <ammarfaizi2@gnuweeb.org>
---

Ammar Faizi (3):
selftests/x86: sysret_rip: Handle syscall in a FRED system
selftests/x86: sysret_rip: Add more syscall tests with respect to `%rcx` and `%r11`
selftests/x86: sysret_rip: Test opportunistic SYSRET

tools/testing/selftests/x86/sysret_rip.c | 177 +++++++++++++++++++++--
1 file changed, 168 insertions(+), 9 deletions(-)


base-commit: e12ad468c22065a2826b2fc4c11d2113a7975301
--
Ammar Faizi

\
 
 \ /
  Last update: 2023-03-26 23:56    [W:0.475 / U:1.588 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site