[lkml]   [2023]   [Jan]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: RE: the x86 sysret_rip test fails on the Intel FRED architecture
On 1/22/23 3:22 PM, Li, Xin3 wrote:
> The problem is where/how to set %r11 = %rflags in the test code.
> The check happens in the USER1 signal handler, and we could set %r11
> just before calling raise(SIGUSR1). However, the C library implementation
> of raise() modifies %r11, thus we can't preserve %r11 until the SYSCALL
> instruction. And the test still fails.

From "man 3 raise":

The raise() function sends a signal to the calling process or thread.
In a single-threaded program it is equivalent to

kill(getpid(), sig);

Implementing kill syscall with %r11 modified before entering the kernel
may look like this?

static void __raise(int sig)
__asm__ volatile (
"popq %%r11\n\t"
: "D"(getpid()), /* %rdi */
"S"(sig), /* %rsi */
"a"(__NR_kill) /* %rax */
: "rcx", "r11", "memory"

Ammar Faizi

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