From 36f4fdf5d12a8149bad23a3ae2aed90f68fcaca3 Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Sun, 5 Jan 2020 19:59:20 +0100 Subject: Re-fix pager preemption diskfs_start_disk_pager uses a signal preemptor to catch faults on the disk image, so we do need to look at exc_code which contains the address. So put the signal code there as well. --- .topmsg | 31 +++++++++++++++++++++++++++++++ hurd/hurdsig.c | 6 +++--- 2 files changed, 34 insertions(+), 3 deletions(-) diff --git a/.topmsg b/.topmsg index 9ac0a83e6e..431bbab623 100644 --- a/.topmsg +++ b/.topmsg @@ -4,3 +4,34 @@ Subject: [PATCH] implement SA_SIGINFO signal handlers. 52baaca Hurd signals: Copy bits/sigaction.h 4232c66 Hurd signals: SA_SIGINFO support 1831cfe Hurd signals: Use POSIX sigcodes + +XXX: we need to sort out d.code vs d.exc_code vs siginfo.si_code: + +- d.code is meant to contain the signal code as passed in the + msg_sig_post RPC, and used for filtering preemptors such as + setitimer's. +- other preemptors want to filter against the address of the fault +- siginfo.si_code is meant to contain the POSIX code. + +Possibly we should add fields to hurd_signal_detail to avoid mixing +things, and easily get what we want where we want: exception2signal +would indeed provides the posix values, but e.g. in separate fields, and +the sa_siginfo code would be able to pick it up from there, while the +legacy code would be able to easily continue using the same values as +before. + +Notably, the + + if (detail->exc) + { + int nsigno; + _hurd_exception2signal_legacy (detail, &nsigno); + assert (nsigno == signo); + } + else + detail->code = 0; + +piece looks wrong: previously we did not set the code to 0. + +Note: the proc server also calls _hurd_exception2signal, and this +changeset changes its behavior, that needs to be double-checked. diff --git a/hurd/hurdsig.c b/hurd/hurdsig.c index 44605058f2..d66e9109ca 100644 --- a/hurd/hurdsig.c +++ b/hurd/hurdsig.c @@ -720,7 +720,7 @@ post_signal (struct hurd_sigstate *ss, { /* PE cannot be null. */ do { - if (HURD_PREEMPT_SIGNAL_P (pe, signo, detail->code)) + if (HURD_PREEMPT_SIGNAL_P (pe, signo, detail->exc_subcode)) { if (pe->preemptor) { @@ -1366,7 +1366,7 @@ _S_msg_sig_post (mach_port_t me, if (err = signal_allowed (signo, refport)) return err; - d.code = sigcode; + d.code = d.exc_subcode = sigcode; d.exc = 0; /* Post the signal to a global receiver thread (or mark it pending in @@ -1395,7 +1395,7 @@ _S_msg_sig_post_untraced (mach_port_t me, if (err = signal_allowed (signo, refport)) return err; - d.code = sigcode; + d.code = d.exc_subcode = sigcode; d.exc = 0; /* Post the signal to the designated signal-receiving thread. This will -- cgit v1.2.3