summaryrefslogtreecommitdiffstats
path: root/lib/libc/sys/stack_protector.c
diff options
context:
space:
mode:
authorguenther <guenther@openbsd.org>2015-11-10 04:30:59 +0000
committerguenther <guenther@openbsd.org>2015-11-10 04:30:59 +0000
commit60d4950662688e997ad441a67807aa227b539842 (patch)
tree7f1194f399b177d5ee9e8189924ed39d1cf56096 /lib/libc/sys/stack_protector.c
parentlibc.so can't be unloaded, so move the hidden atexit() and pthread_atfork() (diff)
downloadwireguard-openbsd-60d4950662688e997ad441a67807aa227b539842.tar.xz
wireguard-openbsd-60d4950662688e997ad441a67807aa227b539842.zip
Split the intra-thread functionality from kill(2) into its own syscall
thrkill(2), rolling the kill(2) syscall number with the ABI change to avoid breaking binaries during during the transition. thrkill(2) includes a 'tcb' argument that eliminates the need for locking in pthread_kill() and simplifies pthread_cancel(). Switch __stack_smash_handler() to use thrkill(2) and explicitly unblock SIGABRT. Minor bump to both libc and libpthread: make sure you install a new kernel! ok semarie@
Diffstat (limited to 'lib/libc/sys/stack_protector.c')
-rw-r--r--lib/libc/sys/stack_protector.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/libc/sys/stack_protector.c b/lib/libc/sys/stack_protector.c
index 75c7ef83d79..e61a5f2f82f 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.18 2015/11/10 04:14:03 guenther Exp $ */
+/* $OpenBSD: stack_protector.c,v 1.19 2015/11/10 04:30:59 guenther Exp $ */
/*
* Copyright (c) 2002 Hiroaki Etoh, Federico G. Schwindt, and Miodrag Vallat.
@@ -57,18 +57,17 @@ __stack_smash_handler(const char func[], int damaged)
/* Immediately block all signal handlers from running code */
sigfillset(&mask);
sigdelset(&mask, SIGABRT);
- sigprocmask(SIG_BLOCK, &mask, NULL);
+ sigprocmask(SIG_SETMASK, &mask, NULL);
- /* This may fail on a chroot jail... */
syslog_r(LOG_CRIT, &sdata, message, func);
- bzero(&sa, sizeof(struct sigaction));
+ memset(&sa, 0, sizeof(sa));
sigemptyset(&sa.sa_mask);
sa.sa_flags = 0;
sa.sa_handler = SIG_DFL;
sigaction(SIGABRT, &sa, NULL);
- kill(getpid(), SIGABRT);
+ thrkill(0, SIGABRT, NULL);
_exit(127);
}