On Thu, Dec 29, 2022 at 6:42 PM Ammar Faizi wrote:
On 12/28/22 8:35 PM, Willy Tarreau wrote:
It gives me the correct code for x86_64 and i586. I don't know if other architectures will want to add a prologue. I tried with "naked" but it's ignored by the compiler since the function is not purely asm. Not very important but given that we already have everything to perform our calls it would make sense to stay on this. By the way, for the sake of consistency with other syscalls, I do think the function (or label if we can't do otherwise) should be called "sys_rt_sigreturn" as it just performs a syscall.
Will call that 'sys_rt_sigreturn' in the next series.
From glibc source code says: GDB needs some intimate knowledge about it to recognize them as signal trampolines, and make backtraces through signal handlers work right. Important are both the names (__restore_rt) and the exact instruction sequence.
link: https://sourceware.org/git/?p=glibc.git%3Ba=blob%3Bf=sysdeps/unix/sysv/linux...
glibc does this:
" .type __" #name ",@function\n" \ "__" #name ":\n" \ " movq $" #syscall ", %rax\n" \ " syscall\n" \
where
#name = "restore_rt" #syscall = __NR_rt_sigreturn
I think it should be called "__restore_rt" instead of "sys_rt_sigreturn"? glibc also has unwind information, but we probably don't need to care with that much