Samuel Thibault, on Wed 16 Nov 2016 19:50:07 +0100, wrote:
> Samuel Thibault, on Wed 16 Nov 2016 19:46:52 +0100, wrote:
> > The attached testcase does get the faulting address.
>
> And the attached testcase doesn't.
And is fixed by the attached patch, could you try it?
Samuel
Index: glibc-2.24/sysdeps/mach/hurd/i386/trampoline.c
===================================================================
--- glibc-2.24.orig/sysdeps/mach/hurd/i386/trampoline.c
+++ glibc-2.24/sysdeps/mach/hurd/i386/trampoline.c
@@ -90,7 +90,7 @@ _hurd_setup_sighandler (struct hurd_sigs
void firewall (void);
extern const void _hurd_intr_rpc_msg_cx_sp;
extern const void _hurd_intr_rpc_msg_sp_restored;
- struct sigaction *action;
+ const struct sigaction *action;
void *volatile sigsp;
struct sigcontext *scp;
struct
@@ -123,6 +123,11 @@ _hurd_setup_sighandler (struct hurd_sigs
siginfo_t siginfo;
} *stackframe;
+ /* sigaction for preemptors */
+ static const struct sigaction legacy_sigaction = {
+ .sa_flags = SA_RESTART
+ };
+
if (ss->context)
{
/* We have a previous sigcontext that sigreturn was about
@@ -146,9 +151,13 @@ _hurd_setup_sighandler (struct hurd_sigs
interrupted RPC frame. */
state->basic.esp = state->basic.uesp;
- /* XXX what if handler != action->handler (for instance, if a signal
- * preemptor took over) ? */
action = & _hurd_sigstate_actions (ss) [signo];
+ if ( (action->sa_flags & SA_SIGINFO)
+ && handler != (__sighandler_t) action->sa_sigaction
+ || !(action->sa_flags & SA_SIGINFO)
+ && handler != action->sa_handler)
+ /* A signal preemptor took over, use legacy semantic. */
+ action = &legacy_sigaction;
if ((action->sa_flags & SA_ONSTACK) &&
!(ss->sigaltstack.ss_flags & (SS_DISABLE|SS_ONSTACK)))