bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: struct sigcontext in Hurd/x86_64


From: Bruno Haible
Subject: Re: struct sigcontext in Hurd/x86_64
Date: Mon, 15 May 2023 19:03:15 +0200

Sergey Bugaev wrote:
> Looking at [0]: 'int code' should be 'long code', otherwise you won't
> be able to extract the full 64-bit address from it.

Good point, thanks! I've changed libsigsegv and gnulib accordingly.

> I don't know how
> this works out for the BSDs -- maybe they just don't pass the address
> in there?

On FreeBSD, the argument list (when SA_SIGINFO is not specified) is
  int sig, int code, struct sigcontext *scp, void *addr

> And also, since glibc commit d865ff74ba096d016c9b1542a4e3d305169c9e55
> (2020), the Hurd supports POSIX SA_SIGINFO / siginfo / ucontext
> interface, and the old one is considered legacy / deprecated.

Thanks; I'm adding this possibility to libsigsegv, but don't activate it
now by default, since it's only supported for relatively short time
(since glibc 2.33 and, in Debian, since glibc 2.19 AFAICS).

> You should be able to get the faulting address from si->si_addr,

Yep, that works.

> and the stack pointer from uc->uc_stack.ss_sp.

Taking it from uc->uc_mcontext.gregs[REG_RSP] works as well.

I'm a bit confused about what uc->uc_stack is meant to contain [1][2],
therefore I'm not using that.

Bruno

[1] https://pubs.opengroup.org/onlinepubs/009695399/basedefs/ucontext.h.html
[2] https://www.gnu.org/software/libc/manual/html_node/System-V-contexts.html






reply via email to

[Prev in Thread] Current Thread [Next in Thread]