diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2023-10-30 07:13:11 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2023-10-30 07:13:11 +0000 |
commit | 741ee83429f27619b99c3a58a00b82c566e2a126 (patch) | |
tree | c11baac482fba94664be4e4da2f882d331e788be /sys | |
parent | 58913c290b90c0cf29424be4743b7d061e1da69e (diff) |
Use ERESTART for any single_thread_set() error in sys_execve().
If single thread is already held by another thread just unwind to userret()
wait there and retry the system call later (if at all).
OK mpi@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/kern/kern_exec.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c index a85010da5ae..9d8ec981347 100644 --- a/sys/kern/kern_exec.c +++ b/sys/kern/kern_exec.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_exec.c,v 1.251 2023/09/29 12:47:34 claudio Exp $ */ +/* $OpenBSD: kern_exec.c,v 1.252 2023/10/30 07:13:10 claudio Exp $ */ /* $NetBSD: kern_exec.c,v 1.75 1996/02/09 18:59:28 christos Exp $ */ /*- @@ -283,9 +283,12 @@ sys_execve(struct proc *p, void *v, register_t *retval) return (0); } - /* get other threads to stop */ - if ((error = single_thread_set(p, SINGLE_UNWIND | SINGLE_DEEP))) - return (error); + /* + * Get other threads to stop, if contested return ERESTART, + * so the syscall is restarted after halting in userret. + */ + if (single_thread_set(p, SINGLE_UNWIND | SINGLE_DEEP)) + return (ERESTART); /* * Cheap solution to complicated problems. |