diff options
| author | Dan McDonald <danmcd@joyent.com> | 2020-11-17 14:48:44 -0500 |
|---|---|---|
| committer | Dan McDonald <danmcd@joyent.com> | 2020-11-17 14:48:44 -0500 |
| commit | 2d6415143e9c1044d04ebf846f72f232883413cb (patch) | |
| tree | 555fae9f2f89b0c9a4d8c4bbd66b02b70ded9fc7 /usr/src/lib/libc/port/threads | |
| parent | 5a1b3228538dfeb09e05cc2bdfad707ee4d698d7 (diff) | |
| parent | 5a0af8165ce9590e7a18f1ef4f9badc4dd72c6e6 (diff) | |
| download | illumos-joyent-2d6415143e9c1044d04ebf846f72f232883413cb.tar.gz | |
[illumos-gate merge]release-20201119
commit 5a0af8165ce9590e7a18f1ef4f9badc4dd72c6e6
13274 enable -fstack-protector-strong by default in user land
commit 6a817834d81cc75ce12d0d393320837b1fec1e85
5788 Want support for GCC's stack protector in libc
commit 350ffdd54baf880f440ddf9697666e283894ded1
13273 want upanic(2)
commit 7fdea60d55a95f0e46066fd021c4ef1b1321bafc
13300 mlxcx_cq_setup() doesn't take required locks for ASSERTs
Merge notes:
- Manifest changes to match package changes (including shipping libssp_ns.a)
- Modified lx_vdso tools to not include SSP, to match other build-only tools.
Diffstat (limited to 'usr/src/lib/libc/port/threads')
| -rw-r--r-- | usr/src/lib/libc/port/threads/assfail.c | 32 | ||||
| -rw-r--r-- | usr/src/lib/libc/port/threads/thr.c | 6 |
2 files changed, 15 insertions, 23 deletions
diff --git a/usr/src/lib/libc/port/threads/assfail.c b/usr/src/lib/libc/port/threads/assfail.c index 1c032d8ea7..4af2fc5664 100644 --- a/usr/src/lib/libc/port/threads/assfail.c +++ b/usr/src/lib/libc/port/threads/assfail.c @@ -26,10 +26,12 @@ /* * Copyright (c) 2012, 2014 by Delphix. All rights reserved. * Copyright 2015 Joyent, Inc. + * Copyright 2020 Oxide Computer Company */ #include "lint.h" #include "thr_uberdata.h" +#include <upanic.h> const char *panicstr; ulwp_t *panic_thread; @@ -60,35 +62,19 @@ grab_assert_lock() } static void -Abort(const char *msg) +Abort(const char *msg, size_t buflen) { ulwp_t *self; struct sigaction act; sigset_t sigmask; - lwpid_t lwpid; /* to help with core file debugging */ panicstr = msg; if ((self = __curthread()) != NULL) { panic_thread = self; - lwpid = self->ul_lwpid; - } else { - lwpid = _lwp_self(); } - /* set SIGABRT signal handler to SIG_DFL w/o grabbing any locks */ - (void) memset(&act, 0, sizeof (act)); - act.sa_sigaction = SIG_DFL; - (void) __sigaction(SIGABRT, &act, NULL); - - /* delete SIGABRT from the signal mask */ - (void) sigemptyset(&sigmask); - (void) sigaddset(&sigmask, SIGABRT); - (void) __lwp_sigmask(SIG_UNBLOCK, &sigmask); - - (void) _lwp_kill(lwpid, SIGABRT); /* never returns */ - (void) kill(getpid(), SIGABRT); /* if it does, try harder */ - _exit(127); + upanic(msg, buflen); } /* @@ -117,7 +103,7 @@ common_panic(const char *head, const char *why) if (msg[len1 - 1] != '\n') msg[len1++] = '\n'; (void) __write(2, msg, len1); - Abort(msg); + Abort(msg, sizeof (msg)); } void @@ -246,7 +232,7 @@ lock_error(const mutex_t *mp, const char *who, void *cv, const char *msg) (void) strcat(buf, "\n\n"); (void) __write(2, buf, strlen(buf)); if (udp->uberflags.uf_thread_error_detection >= 2) - Abort(buf); + Abort(buf, sizeof (buf)); assert_thread = NULL; (void) _lwp_mutex_unlock(&assert_lock); if (self != NULL) @@ -335,7 +321,7 @@ rwlock_error(const rwlock_t *rp, const char *who, const char *msg) (void) strcat(buf, "\n\n"); (void) __write(2, buf, strlen(buf)); if (udp->uberflags.uf_thread_error_detection >= 2) - Abort(buf); + Abort(buf, sizeof (buf)); assert_thread = NULL; (void) _lwp_mutex_unlock(&assert_lock); if (self != NULL) @@ -383,7 +369,7 @@ thread_error(const char *msg) (void) strcat(buf, "\n\n"); (void) __write(2, buf, strlen(buf)); if (udp->uberflags.uf_thread_error_detection >= 2) - Abort(buf); + Abort(buf, sizeof (buf)); assert_thread = NULL; (void) _lwp_mutex_unlock(&assert_lock); if (self != NULL) @@ -455,7 +441,7 @@ __assfail(const char *assertion, const char *filename, int line_num) * if (self != NULL) * exit_critical(self); */ - Abort(buf); + Abort(buf, sizeof (buf)); } /* diff --git a/usr/src/lib/libc/port/threads/thr.c b/usr/src/lib/libc/port/threads/thr.c index 8026ffad9c..66d0e524c2 100644 --- a/usr/src/lib/libc/port/threads/thr.c +++ b/usr/src/lib/libc/port/threads/thr.c @@ -1308,6 +1308,11 @@ libc_init(void) */ if (oldself != NULL && (oldself->ul_primarymap || !primary_link_map)) { __tdb_bootstrap = oldself->ul_uberdata->tdb_bootstrap; + /* + * Each link map has its own copy of the stack protector guard + * and must always be initialized. + */ + ssp_init(); mutex_setup(); atfork_init(); /* every link map needs atfork() processing */ init_progname(); @@ -1448,6 +1453,7 @@ libc_init(void) /* tls_size was zero when oldself was allocated */ lfree(oldself, sizeof (ulwp_t)); } + ssp_init(); mutex_setup(); atfork_init(); signal_init(); |
