Module Name: src
Committed By: reinoud
Date: Wed Feb 15 15:20:53 UTC 2012
Modified Files:
src/sys/arch/usermode/usermode: trap.c
Log Message:
Prevent recursive IO signals. This prevents crashes when pieces of text are
pasted in say an Xterm. Each char might create a SIGIO running out of
stackspace very quickly!
To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 src/sys/arch/usermode/usermode/trap.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/usermode/usermode/trap.c
diff -u src/sys/arch/usermode/usermode/trap.c:1.62 src/sys/arch/usermode/usermode/trap.c:1.63
--- src/sys/arch/usermode/usermode/trap.c:1.62 Sun Jan 22 17:51:39 2012
+++ src/sys/arch/usermode/usermode/trap.c Wed Feb 15 15:20:53 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: trap.c,v 1.62 2012/01/22 17:51:39 reinoud Exp $ */
+/* $NetBSD: trap.c,v 1.63 2012/02/15 15:20:53 reinoud Exp $ */
/*-
* Copyright (c) 2011 Reinoud Zandijk <[email protected]>
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.62 2012/01/22 17:51:39 reinoud Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.63 2012/02/15 15:20:53 reinoud Exp $");
#include <sys/types.h>
#include <sys/param.h>
@@ -362,6 +362,11 @@ handle_signal(int sig, siginfo_t *info,
thunk_sigemptyset(&jump_ucp.uc_sigmask);
jump_ucp.uc_flags = _UC_STACK | _UC_CPU | _UC_SIGMASK;
+
+ /* prevent recursive IO signals */
+ if (sig == SIGIO)
+ thunk_sigaddset(&jump_ucp.uc_sigmask, SIGIO);
+
thunk_makecontext(&jump_ucp,
(void (*)(void)) f,
3, (void *) from_userland, (void *) pc, (void *) va);