Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/usermode/usermode Prevent nested SIGIOs ruining the...
details: https://anonhg.NetBSD.org/src/rev/e2bac85966e8
branches: trunk
changeset: 319788:e2bac85966e8
user: reinoud <reinoud%NetBSD.org@localhost>
date: Mon Jun 11 19:23:21 2018 +0000
description:
Prevent nested SIGIOs ruining the system stack
diffstat:
sys/arch/usermode/usermode/trap.c | 14 ++++++++++----
1 files changed, 10 insertions(+), 4 deletions(-)
diffs (42 lines):
diff -r b62ff1b4718b -r e2bac85966e8 sys/arch/usermode/usermode/trap.c
--- a/sys/arch/usermode/usermode/trap.c Mon Jun 11 19:13:38 2018 +0000
+++ b/sys/arch/usermode/usermode/trap.c Mon Jun 11 19:23:21 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: trap.c,v 1.67 2018/05/18 20:24:16 reinoud Exp $ */
+/* $NetBSD: trap.c,v 1.68 2018/06/11 19:23:21 reinoud Exp $ */
/*-
* Copyright (c) 2011 Reinoud Zandijk <reinoud%netbsd.org@localhost>
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.67 2018/05/18 20:24:16 reinoud Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.68 2018/06/11 19:23:21 reinoud Exp $");
#include <sys/types.h>
#include <sys/param.h>
@@ -335,7 +335,9 @@
if (sig == SIGILL)
print_illegal_instruction_siginfo(sig, info, ctx, pc, va, sp);
- /* if we're running on a stack of our own, use the system stack */
+ /* currently running on the dedicated signal stack */
+
+ /* if we're running on a userland stack, switch to the system stack */
from_userland = 0;
if ((sp < (vaddr_t) pcb->sys_stack) ||
(sp > (vaddr_t) pcb->sys_stack_top)) {
@@ -361,7 +363,11 @@
jump_ucp.uc_stack.ss_size = sp - (vaddr_t) pcb->sys_stack;
jump_ucp.uc_link = (void *) fp; /* link to old frame on stack */
- thunk_sigemptyset(&jump_ucp.uc_sigmask);
+ /* prevent multiple nested SIGIOs */
+ if (sig == SIGIO)
+ thunk_sigfillset(&jump_ucp.uc_sigmask);
+ else
+ thunk_sigemptyset(&jump_ucp.uc_sigmask);
jump_ucp.uc_flags = _UC_STACK | _UC_CPU | _UC_SIGMASK;
thunk_makecontext(&jump_ucp,
Home |
Main Index |
Thread Index |
Old Index