summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2003-03-03 19:52:42 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2003-03-03 19:52:42 +0000
commitf0ab253155b90012d76c7e25c6a6e0bc962973e7 (patch)
tree22b44549d32b38faf32d3a1492172462f6001d90 /lib
parent0f26b03dadf962abfff86f095d75e23e716e87f8 (diff)
in the handler, block signals handlers as soon as possible; ok miod millert
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/sys/stack_protector.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/libc/sys/stack_protector.c b/lib/libc/sys/stack_protector.c
index 79f5c825562..e954f76a71f 100644
--- a/lib/libc/sys/stack_protector.c
+++ b/lib/libc/sys/stack_protector.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: stack_protector.c,v 1.3 2002/12/10 08:53:42 etoh Exp $ */
+/* $OpenBSD: stack_protector.c,v 1.4 2003/03/03 19:52:41 deraadt Exp $ */
/*
* Copyright (c) 2002 Hiroaki Etoh, Federico G. Schwindt, and Miodrag Vallat.
@@ -28,7 +28,7 @@
*/
#if defined(LIBC_SCCS) && !defined(list)
-static char rcsid[] = "$OpenBSD: stack_protector.c,v 1.3 2002/12/10 08:53:42 etoh Exp $";
+static char rcsid[] = "$OpenBSD: stack_protector.c,v 1.4 2003/03/03 19:52:41 deraadt Exp $";
#endif
#include <sys/param.h>
@@ -71,8 +71,14 @@ __stack_smash_handler(char func[], int damaged)
struct syslog_data sdata = SYSLOG_DATA_INIT;
const char message[] = "stack overflow in function %s";
struct sigaction sa;
+ sigset_t mask;
- /* this may fail on a chroot jail, though luck */
+ /* Immediately block all signal handlers from running code */
+ sigfillset(&mask);
+ sigdelset(&mask, SIGABRT);
+ sigprocmask(SIG_BLOCK, &mask, NULL);
+
+ /* This may fail on a chroot jail... */
syslog_r(LOG_CRIT, &sdata, message, func);
bzero(&sa, sizeof(struct sigaction));