diff options
author | 2003-03-03 19:52:41 +0000 | |
---|---|---|
committer | 2003-03-03 19:52:41 +0000 | |
commit | dcbc515cb398d6ad3ccf00aa5de5d9ce72fbcf56 (patch) | |
tree | 5d86649b2e66c1c0a536f92d3026ad9077582c2f /lib/libc/sys/stack_protector.c | |
parent | oops, removed a char from rend (diff) | |
download | wireguard-openbsd-dcbc515cb398d6ad3ccf00aa5de5d9ce72fbcf56.tar.xz wireguard-openbsd-dcbc515cb398d6ad3ccf00aa5de5d9ce72fbcf56.zip |
in the handler, block signals handlers as soon as possible; ok miod millert
Diffstat (limited to 'lib/libc/sys/stack_protector.c')
-rw-r--r-- | lib/libc/sys/stack_protector.c | 12 |
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)); |