aboutsummaryrefslogtreecommitdiff
path: root/hurd/hurdsig.c
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2018-10-09 23:40:09 +0200
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2018-10-28 13:41:51 +0100
commit5c81be53407434ce22b849722a3d691295480016 (patch)
tree930f36f9263b5d02c176d6b13b0ed5a762c8fd83 /hurd/hurdsig.c
parent2d0d1d38761cd9aeb7063c5cce1993cec909f67f (diff)
downloadglibc-5c81be53407434ce22b849722a3d691295480016.zip
glibc-5c81be53407434ce22b849722a3d691295480016.tar.gz
glibc-5c81be53407434ce22b849722a3d691295480016.tar.bz2
hurd: Fix race between calling RPC and handling a signal
* sysdeps/mach/hurd/i386/intr-msg.h (INTR_MSG_TRAP): Make _hurd_intr_rpc_msg_about_to global point to start of controlled assembly snippet. Make it check canceled flag. * hurd/hurdsig.c (_hurdsig_abort_rpcs): Only mutate thread if it passed the _hurd_intr_rpc_msg_about_to point. * hurd/intr-msg.c (_hurd_intr_rpc_mach_msg): Remove comment on mutation issue, remove cancel flag check.
Diffstat (limited to 'hurd/hurdsig.c')
-rw-r--r--hurd/hurdsig.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/hurd/hurdsig.c b/hurd/hurdsig.c
index 48179b4..d105615 100644
--- a/hurd/hurdsig.c
+++ b/hurd/hurdsig.c
@@ -292,6 +292,7 @@ _hurdsig_abort_rpcs (struct hurd_sigstate *ss, int signo, int sigthread,
struct machine_thread_all_state *state, int *state_change,
void (*reply) (void))
{
+ extern const void _hurd_intr_rpc_msg_about_to;
extern const void _hurd_intr_rpc_msg_in_trap;
mach_port_t rcv_port = MACH_PORT_NULL;
mach_port_t intr_port;
@@ -307,7 +308,8 @@ _hurdsig_abort_rpcs (struct hurd_sigstate *ss, int signo, int sigthread,
receive completes immediately or aborts. */
abort_thread (ss, state, reply);
- if (state->basic.PC < (natural_t) &_hurd_intr_rpc_msg_in_trap)
+ if (state->basic.PC >= (natural_t) &_hurd_intr_rpc_msg_about_to &&
+ state->basic.PC < (natural_t) &_hurd_intr_rpc_msg_in_trap)
{
/* The thread is about to do the RPC, but hasn't yet entered
mach_msg. Mutate the thread's state so it knows not to try