diff options
| author | Roger A. Faulkner <Roger.Faulkner@Sun.COM> | 2010-03-12 12:19:46 -0800 |
|---|---|---|
| committer | Roger A. Faulkner <Roger.Faulkner@Sun.COM> | 2010-03-12 12:19:46 -0800 |
| commit | bdf0047c9427cca40961a023475891c898579c37 (patch) | |
| tree | c7e7aa7728de40305ad5f83474b817aab23bf4fb /usr/src | |
| parent | 5b31066847d2c7adf43d7ba49334d637cea3613f (diff) | |
| download | illumos-joyent-bdf0047c9427cca40961a023475891c898579c37.tar.gz | |
PSARC 2010/062 increase number of realtime signals
6820737 Solaris needs to increase the number of realtime signals for platform parity
Diffstat (limited to 'usr/src')
47 files changed, 1483 insertions, 456 deletions
diff --git a/usr/src/cmd/truss/systable.c b/usr/src/cmd/truss/systable.c index 0046110e2b..fe49984a29 100644 --- a/usr/src/cmd/truss/systable.c +++ b/usr/src/cmd/truss/systable.c @@ -382,7 +382,7 @@ const struct systable systable[] = { {"lwp_continue", 1, DEC, NOV, DEC}, /* 162 */ {"lwp_kill", 2, DEC, NOV, DEC, SIG}, /* 163 */ {"lwp_self", 0, DEC, NOV}, /* 164 */ -{"lwp_sigmask", 3, HEX, HEX, SPM, HEX, HEX}, /* 165 */ +{"lwp_sigmask", 5, HEX, HEX, SPM, HEX, HEX, HEX, HEX}, /* 165 */ {"lwp_private", 3, HEX, NOV, DEC, DEC, HEX}, /* 166 */ {"lwp_wait", 2, DEC, NOV, DEC, HEX}, /* 167 */ {"lwp_mutex_wakeup", 2, DEC, NOV, HEX, DEC}, /* 168 */ diff --git a/usr/src/common/brand/lx/lx_signum.c b/usr/src/common/brand/lx/lx_signum.c index 1248931085..5554750874 100644 --- a/usr/src/common/brand/lx/lx_signum.c +++ b/usr/src/common/brand/lx/lx_signum.c @@ -18,13 +18,12 @@ * * CDDL HEADER END */ + /* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <sys/signal.h> #include <lx_signum.h> @@ -67,16 +66,16 @@ * signal map to a Linux counterpart. However, when signals do map, the * mapping is unique. * - * One mapping issue is that Linux supports 32 real time signals, with SIGRTMIN - * typically starting at or near 32 (SIGRTMIN) and proceeding to 63 (SIGRTMAX) + * One mapping issue is that Linux supports 33 real time signals, with SIGRTMIN + * typically starting at or near 32 (SIGRTMIN) and proceeding to 64 (SIGRTMAX) * (SIGRTMIN is "at or near" 32 because glibc usually "steals" one ore more of * these signals for its own internal use, adjusting SIGRTMIN and SIGRTMAX as * needed.) Conversely, Solaris actively uses signals 32-40 for other purposes - * and and only supports seven real time signals, in the range 41 (SIGRTMIN) - * to 48 (SIGRTMAX). + * and supports exactly 32 real time signals, in the range 41 (SIGRTMIN) + * to 72 (SIGRTMAX). * - * At present, attempting to translate a Linux signal greater than 39 but - * less than 62 will generate an error (we allow SIGRTMAX because a program + * At present, attempting to translate a Linux signal equal to 63 + * will generate an error (we allow SIGRTMAX because a program * should be able to send SIGRTMAX without getting an EINVAL, though obviously * anything that loops through the signals from SIGRTMIN to SIGRTMAX will * fail.) @@ -132,31 +131,31 @@ ltos_signo[LX_NSIG] = { _SIGRTMIN + 4, _SIGRTMIN + 5, _SIGRTMIN + 6, - -1, /* 38 Linux SIGRTMIN + 7 */ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, /* 63: Linux SIGRTMIN + 32, or SIGRTMAX - 1 */ + _SIGRTMIN + 7, + _SIGRTMIN + 8, + _SIGRTMIN + 9, + _SIGRTMIN + 10, + _SIGRTMIN + 11, + _SIGRTMIN + 12, + _SIGRTMIN + 13, + _SIGRTMIN + 14, + _SIGRTMIN + 15, + _SIGRTMIN + 16, + _SIGRTMIN + 17, + _SIGRTMIN + 18, + _SIGRTMIN + 19, + _SIGRTMIN + 20, + _SIGRTMIN + 21, + _SIGRTMIN + 22, + _SIGRTMIN + 23, + _SIGRTMIN + 24, + _SIGRTMIN + 25, + _SIGRTMIN + 26, + _SIGRTMIN + 27, + _SIGRTMIN + 28, + _SIGRTMIN + 29, + _SIGRTMIN + 30, + -1, /* 63: Linux SIGRTMIN + 31, or SIGRTMAX - 1 */ _SIGRTMAX, /* 64: Linux SIGRTMAX */ }; @@ -215,5 +214,29 @@ stol_signo[NSIG] = { LX_SIGRTMIN + 4, LX_SIGRTMIN + 5, LX_SIGRTMIN + 6, - LX_SIGRTMAX, /* 48: Solaris _SIGRTMAX */ + LX_SIGRTMIN + 7, + LX_SIGRTMIN + 8, + LX_SIGRTMIN + 9, + LX_SIGRTMIN + 10, + LX_SIGRTMIN + 11, + LX_SIGRTMIN + 12, + LX_SIGRTMIN + 13, + LX_SIGRTMIN + 14, + LX_SIGRTMIN + 15, + LX_SIGRTMIN + 16, + LX_SIGRTMIN + 17, + LX_SIGRTMIN + 18, + LX_SIGRTMIN + 19, + LX_SIGRTMIN + 20, + LX_SIGRTMIN + 21, + LX_SIGRTMIN + 22, + LX_SIGRTMIN + 23, + LX_SIGRTMIN + 24, + LX_SIGRTMIN + 25, + LX_SIGRTMIN + 26, + LX_SIGRTMIN + 27, + LX_SIGRTMIN + 28, + LX_SIGRTMIN + 29, + LX_SIGRTMIN + 30, + LX_SIGRTMAX, /* 72: Solaris _SIGRTMAX */ }; diff --git a/usr/src/lib/brand/solaris10/s10_brand/Makefile.com b/usr/src/lib/brand/solaris10/s10_brand/Makefile.com index 078dec2b6f..a90d56d4cd 100644 --- a/usr/src/lib/brand/solaris10/s10_brand/Makefile.com +++ b/usr/src/lib/brand/solaris10/s10_brand/Makefile.com @@ -25,7 +25,7 @@ LIBRARY = s10_brand.a VERS = .1 -COBJS = s10_brand.o s10_deleted.o +COBJS = s10_brand.o s10_deleted.o s10_signal.o ASOBJS = s10_crt.o s10_handler.o s10_runexe.o OFFSETS_SRC = ../common/offsets.in OFFSETS_H = assym.h diff --git a/usr/src/lib/brand/solaris10/s10_brand/common/s10_brand.c b/usr/src/lib/brand/solaris10/s10_brand/common/s10_brand.c index fbbd503969..f554e887a6 100644 --- a/usr/src/lib/brand/solaris10/s10_brand/common/s10_brand.c +++ b/usr/src/lib/brand/solaris10/s10_brand/common/s10_brand.c @@ -40,6 +40,7 @@ #include <sys/syscall.h> #include <sys/systm.h> #include <sys/utsname.h> +#include <sys/sysconfig.h> #include <sys/systeminfo.h> #include <sys/zone.h> #include <sys/stat.h> @@ -60,6 +61,7 @@ #include <s10_brand.h> #include <s10_misc.h> +#include <s10_signal.h> /* * Principles of emulation 101. @@ -1378,17 +1380,6 @@ s10_issetugid(sysret_t *rval) 0, 0, 0, 0, 0)); } -/* - * New last arg "block" flag should be zero. The block flag is used by - * the Opensolaris AIO implementation, which is now part of libc. - */ -static int -s10_sigqueue(sysret_t *rval, pid_t pid, int signo, void *value, int si_code) -{ - return (__systemcall(rval, SYS_sigqueue + 1024, pid, signo, value, - si_code, 0)); -} - static long s10_uname(sysret_t *rv, uintptr_t p1) { @@ -1410,6 +1401,37 @@ s10_uname(sysret_t *rv, uintptr_t p1) } int +s10_sysconfig(sysret_t *rv, int which) +{ + long value; + + /* + * We must interpose on the sysconfig(2) requests + * that deal with the realtime signal number range. + * All others get passed to the native sysconfig(2). + */ + switch (which) { + case _CONFIG_RTSIG_MAX: + value = S10_SIGRTMAX - S10_SIGRTMIN + 1; + break; + case _CONFIG_SIGRT_MIN: + value = S10_SIGRTMIN; + break; + case _CONFIG_SIGRT_MAX: + value = S10_SIGRTMAX; + break; + default: + return (__systemcall(rv, SYS_sysconfig + 1024, which)); + } + + (void) S10_TRUSS_POINT_1(rv, SYS_sysconfig, 0, which); + rv->sys_rval1 = value; + rv->sys_rval2 = 0; + + return (0); +} + +int s10_sysinfo(sysret_t *rv, int command, char *buf, long count) { char *value; @@ -1564,6 +1586,11 @@ s10_lwp_create_correct_fs(sysret_t *rval, ucontext_t *ucp, int flags, s10_uc.uc_mcontext.gregs[REG_R14] = s10_uc.uc_mcontext.gregs[REG_RIP]; s10_uc.uc_mcontext.gregs[REG_RIP] = (greg_t)s10_lwp_create_entry_point; + /* fix up the signal mask */ + if (s10_uc.uc_flags & UC_SIGMASK) + (void) s10sigset_to_native(&s10_uc.uc_sigmask, + &s10_uc.uc_sigmask); + /* * Issue SYS_lwp_create to create the new LWP. We pass the * modified ucontext_t to make sure that the new LWP starts at @@ -1575,18 +1602,6 @@ s10_lwp_create_correct_fs(sysret_t *rval, ucontext_t *ucp, int flags, #endif /* __amd64 */ /* - * This function is invoked on x86 systems when SYS_lwp_create is issued but no - * %fs register correction is necessary. - * - * See the comment above s10_lwp_create_correct_fs() above for more details. - */ -static int -s10_lwp_create(sysret_t *rval, ucontext_t *ucp, int flags, id_t *new_lwp) -{ - return (__systemcall(rval, SYS_lwp_create + 1024, ucp, flags, new_lwp)); -} - -/* * SYS_lwp_private is issued by libc_init() to set %fsbase in 64-bit x86 * processes. The Nevada kernel sets %fs to zero but the S10 libc expects * %fs to be nonzero. We'll pass the issued system call to the kernel untouched @@ -2027,7 +2042,7 @@ s10_sysent_table_t s10_sysent_table[] = { NOSYS, /* 34 */ NOSYS, /* 35 */ NOSYS, /* 36 */ - NOSYS, /* 37 */ + EMULATE(s10_kill, 2 | RV_DEFAULT), /* 37 */ NOSYS, /* 38 */ NOSYS, /* 39 */ NOSYS, /* 40 */ @@ -2085,20 +2100,20 @@ s10_sysent_table_t s10_sysent_table[] = { NOSYS, /* 92 */ NOSYS, /* 93 */ EMULATE(s10_fchown, 3 | RV_DEFAULT), /* 94 */ - NOSYS, /* 95 */ - NOSYS, /* 96 */ + EMULATE(s10_sigprocmask, 3 | RV_DEFAULT), /* 95 */ + EMULATE(s10_sigsuspend, 1 | RV_DEFAULT), /* 96 */ NOSYS, /* 97 */ - NOSYS, /* 98 */ - NOSYS, /* 99 */ - NOSYS, /* 100 */ + EMULATE(s10_sigaction, 3 | RV_DEFAULT), /* 98 */ + EMULATE(s10_sigpending, 2 | RV_DEFAULT), /* 99 */ + EMULATE(s10_context, 2 | RV_DEFAULT), /* 100 */ NOSYS, /* 101 */ NOSYS, /* 102 */ NOSYS, /* 103 */ NOSYS, /* 104 */ NOSYS, /* 105 */ NOSYS, /* 106 */ - NOSYS, /* 107 */ - NOSYS, /* 108 */ + EMULATE(s10_waitid, 4 | RV_DEFAULT), /* 107 */ + EMULATE(s10_sigsendsys, 2 | RV_DEFAULT), /* 108 */ NOSYS, /* 109 */ NOSYS, /* 110 */ NOSYS, /* 111 */ @@ -2134,14 +2149,14 @@ s10_sysent_table_t s10_sysent_table[] = { EMULATE(s10_rename, 2 | RV_DEFAULT), /* 134 */ EMULATE(s10_uname, 1 | RV_DEFAULT), /* 135 */ NOSYS, /* 136 */ - NOSYS, /* 137 */ + EMULATE(s10_sysconfig, 1 | RV_DEFAULT), /* 137 */ NOSYS, /* 138 */ EMULATE(s10_sysinfo, 3 | RV_DEFAULT), /* 139 */ NOSYS, /* 140 */ NOSYS, /* 141 */ NOSYS, /* 142 */ EMULATE(s10_fork1, 0 | RV_32RVAL2), /* 143 */ - NOSYS, /* 144 */ + EMULATE(s10_sigtimedwait, 3 | RV_DEFAULT), /* 144 */ NOSYS, /* 145 */ NOSYS, /* 146 */ EMULATE(s10_lwp_sema_wait, 1 | RV_DEFAULT), /* 147 */ @@ -2156,17 +2171,13 @@ s10_sysent_table_t s10_sysent_table[] = { NOSYS, /* 156 */ NOSYS, /* 157 */ NOSYS, /* 158 */ -#ifdef __x86 EMULATE(s10_lwp_create, 3 | RV_DEFAULT), /* 159 */ -#else /* !__x86 */ - NOSYS, /* 159 */ -#endif /* !__x86 */ NOSYS, /* 160 */ NOSYS, /* 161 */ NOSYS, /* 162 */ - NOSYS, /* 163 */ + EMULATE(s10_lwp_kill, 2 | RV_DEFAULT), /* 163 */ NOSYS, /* 164 */ - NOSYS, /* 165 */ + EMULATE(s10_lwp_sigmask, 3 | RV_32RVAL2), /* 165 */ #if defined(__x86) EMULATE(s10_lwp_private, 3 | RV_DEFAULT), /* 166 */ #else @@ -2210,7 +2221,7 @@ s10_sysent_table_t s10_sysent_table[] = { NOSYS, /* 202 */ NOSYS, /* 203 */ NOSYS, /* 204 */ - NOSYS, /* 205 */ + EMULATE(s10_signotify, 3 | RV_DEFAULT), /* 205 */ NOSYS, /* 206 */ NOSYS, /* 207 */ NOSYS, /* 208 */ diff --git a/usr/src/lib/brand/solaris10/s10_brand/common/s10_deleted.c b/usr/src/lib/brand/solaris10/s10_brand/common/s10_deleted.c index fd8f6e4543..fbd9a4de6d 100644 --- a/usr/src/lib/brand/solaris10/s10_brand/common/s10_deleted.c +++ b/usr/src/lib/brand/solaris10/s10_brand/common/s10_deleted.c @@ -32,10 +32,8 @@ #include <errno.h> #include <sys/types.h> #include <sys/stat.h> -#include <sys/siginfo.h> #include <sys/time.h> #include <sys/poll.h> -#include <sys/wait.h> #include <sys/file.h> #include <sys/syscall.h> @@ -477,53 +475,3 @@ s10_umount(sysret_t *rval, const char *path) { return (__systemcall(rval, SYS_umount2 + 1024, path, 0)); } - -/* - * Convert the siginfo_t code and status fields to an old style - * wait status for s10_wait(), below. - */ -static int -wstat(int code, int status) -{ - int stat = (status & 0377); - - switch (code) { - case CLD_EXITED: - stat <<= 8; - break; - case CLD_DUMPED: - stat |= WCOREFLG; - break; - case CLD_KILLED: - break; - case CLD_TRAPPED: - case CLD_STOPPED: - stat <<= 8; - stat |= WSTOPFLG; - break; - case CLD_CONTINUED: - stat = WCONTFLG; - break; - } - return (stat); -} - -/* - * Interposition upon SYS_wait - */ -int -s10_wait(sysret_t *rval) -{ - int err; - siginfo_t info; - - err = __systemcall(rval, SYS_waitid + 1024, - P_ALL, 0, &info, WEXITED | WTRAPPED); - if (err != 0) - return (err); - - rval->sys_rval1 = info.si_pid; - rval->sys_rval2 = wstat(info.si_code, info.si_status); - - return (0); -} diff --git a/usr/src/lib/brand/solaris10/s10_brand/common/s10_signal.c b/usr/src/lib/brand/solaris10/s10_brand/common/s10_signal.c new file mode 100644 index 0000000000..078bb34e29 --- /dev/null +++ b/usr/src/lib/brand/solaris10/s10_brand/common/s10_signal.c @@ -0,0 +1,813 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ + +/* + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#include <sys/types.h> +#include <sys/brand.h> +#include <sys/errno.h> +#include <sys/sysconfig.h> +#include <sys/ucontext.h> +#include <sys/wait.h> +#include <stdlib.h> +#include <strings.h> +#include <signal.h> + +#include <s10_brand.h> +#include <s10_misc.h> +#include <s10_signal.h> + +s10_sighandler_t s10_handlers[S10_NSIG - 1]; + +/* + * Theory of operation: + * + * As of now, Solaris 10 and solaris_nevada signal numbers match all the + * way through SIGJVM2 (1 - 40) and the first 8 realtime signals (41 - 48). + * However, solaris_nevada provides 32 realtime signals rather than 8 for S10. + * + * We do not assume that the current range of realtime signals is + * _SIGRTMIN - _SIGRTMAX. As a hedge against future changes, + * we obtain the realtime signal range via SIGRTMIN and SIGRTMAX. + * + * Therefore, we must interpose on the various signal calls to translate + * signal masks and signal handlers that deal with SIGRTMIN - SIGRTMAX to + * refer to a potentially different range and to intercenpt any "illegal" + * signals that might otherwise be sent to an S10 process. + * + * Simple translation is all that is required to handle most system calls, + * but signal handlers also must be interposed upon so that a user signal + * handler sees proper signal numbers in its arguments, any passed siginfo_t + * and in the signal mask reported in its ucontext_t. + * + * libc adds its own signal handler to handled signals such that the + * signal delivery mechanism looks like: + * + * signal -> libc sigacthandler() -> user signal handler + * + * With interposition, this will instead look like: + * + * signal -> + * s10_sigacthandler() -> + * libc sigacthandler() -> + * user signal handler() + */ + +/* + * A little exposition on SIGRTMIN and SIGRTMAX: + * + * For configurability reasons, in Solaris SIGRTMIN and SIGRTMAX are actually + * #defined to be routines: + * + * #define SIGRTMIN ((int)_sysconf(_SC_SIGRT_MIN)) + * #define SIGRTMAX ((int)_sysconf(_SC_SIGRT_MAX)) + * + * This means we need routines that will call the native sysconfig() system + * call to find out what the native values for SIGRTMIN and SIGRTMAX are, and + * those are native_sigrtmin() and native_sigrtmax(), respectively. + * + * To try and mitigate confusion this might cause, rather than use SIGRTMIN and + * SIGRTMAX directly, mnemonic convenience macros are #defined to clarify the + * matter: + * + * S10_SIGRTMIN + * S10_SIGRTMAX + * NATIVE_SIGRTMIN + * NATIVE_SIGRTMAX + */ + +static int +native_sigrtmin() +{ + static int sigrtmin; + sysret_t rval; + + if (sigrtmin) + return (sigrtmin); + sigrtmin = __systemcall(&rval, SYS_sysconfig + 1024, _CONFIG_SIGRT_MIN)? + _SIGRTMIN : (int)rval.sys_rval1; + return (sigrtmin); +} + +static int +native_sigrtmax() +{ + static int sigrtmax; + sysret_t rval; + + if (sigrtmax) + return (sigrtmax); + sigrtmax = __systemcall(&rval, SYS_sysconfig + 1024, _CONFIG_SIGRT_MAX)? + _SIGRTMAX : (int)rval.sys_rval1; + return (sigrtmax); +} + +#define NATIVE_SIGRTMIN (native_sigrtmin()) +#define NATIVE_SIGRTMAX (native_sigrtmax()) + +/* + * These #defines are setup to create the SIGADDSET and SIGISMEMBER macros, + * needed because the sigaddset(3C) and sigismember(3C) calls make function + * calls that end up being recursive in an interpositioned system call + * environment. + */ +#define MAXBITNO (NBPW*8) +#define SIGWORD(n) ((n-1)/MAXBITNO) +#define BITMASK(n) (1L<<((n-1)%MAXBITNO)) + +#define SIGADDSET(sigset, sig) \ + ((sigset)->__sigbits[SIGWORD(sig)] |= BITMASK(sig)) + +#define SIGISMEMBER(sigset, sig) \ + (((sigset)->__sigbits[SIGWORD(sig)] & BITMASK(sig)) != 0) + +/* + * Convert an S10 signal number to its native value. + */ +static int +s10sig_to_native(int sig) +{ + /* signals 1 .. SIGJVM2 are the same between S10 and native */ + if (sig <= SIGJVM2) + return (sig); + + /* + * If a signal is > SIGJVM2 but is < S10_SIGRTMIN, it's being used + * for some private purpose we likely wouldn't emulate properly. + */ + if (sig < S10_SIGRTMIN) /* can't happen */ + return (-1); + + /* + * Map S10 RT signals to their native counterparts to the degree + * possible. If the signal would be out of the native RT signal + * range, return an error to the caller. + */ + sig -= S10_SIGRTMIN; + + if (sig > (NATIVE_SIGRTMAX - NATIVE_SIGRTMIN)) + return (-1); + + return (NATIVE_SIGRTMIN + sig); +} + +/* + * Convert an S10 sigset_t to its native version. + */ +int +s10sigset_to_native(const sigset_t *s10_set, sigset_t *native_set) +{ + int sig; + int nativesig; + sigset_t srcset, newset; + + if (s10_uucopy(s10_set, &srcset, sizeof (sigset_t)) != 0) + return (EFAULT); + + (void) sigemptyset(&newset); + + /* + * Shortcut: we know the first 32 signals are the same in both + * s10 and native Solaris. Just assign the first word. + */ + newset.__sigbits[0] = srcset.__sigbits[0]; + + /* + * Copy the remainder of the initial set of common signals. + */ + for (sig = 33; sig <= SIGJVM2; sig++) + if (SIGISMEMBER(&srcset, sig)) + SIGADDSET(&newset, sig); + + /* convert any S10 RT signals to their native equivalents */ + for (sig = S10_SIGRTMIN; sig <= S10_SIGRTMAX; sig++) { + if (SIGISMEMBER(&srcset, sig) && + (nativesig = s10sig_to_native(sig)) > 0) + SIGADDSET(&newset, nativesig); + } + + if (s10_uucopy(&newset, native_set, sizeof (sigset_t)) != 0) + return (EFAULT); + + return (0); +} + +/* + * Convert a native signal number to its S10 value. + */ +int +nativesig_to_s10(int sig) +{ + /* signals 1 .. SIGJVM2 are the same between native and S10 */ + if (sig <= SIGJVM2) + return (sig); + + /* + * We have no way to emulate native signals between (SIGJVM2 + 1) and + * NATIVE_SIGRTMIN, so return an error to the caller. + */ + if (sig < NATIVE_SIGRTMIN) /* can't happen */ + return (-1); + + /* + * Map native RT signals to their S10 counterparts to the degree + * possible. If the signal would be out of range for S10, return + * an error to the caller. + */ + sig -= NATIVE_SIGRTMIN; + + if (sig > (S10_SIGRTMAX - S10_SIGRTMIN)) + return (-1); + + return (S10_SIGRTMIN + sig); +} + +/* + * Convert a native sigset_t to its S10 version. + */ +int +nativesigset_to_s10(const sigset_t *native_set, sigset_t *s10_set) +{ + int sig; + int s10sig; + sigset_t srcset, newset; + + if (s10_uucopy(native_set, &srcset, sizeof (sigset_t)) != 0) + return (EFAULT); + + (void) sigemptyset(&newset); + + /* + * Shortcut: we know the first 32 signals are the same in both + * s10 and native Solaris. Just assign the first word. + */ + newset.__sigbits[0] = srcset.__sigbits[0]; + + /* + * Copy the remainder of the initial set of common signals. + */ + for (sig = 33; sig <= SIGJVM2; sig++) + if (SIGISMEMBER(&srcset, sig)) + SIGADDSET(&newset, sig); + + /* convert any RT signals to their S10 values */ + for (sig = NATIVE_SIGRTMIN; sig <= NATIVE_SIGRTMAX; sig++) { + if (SIGISMEMBER(&srcset, sig) && + (s10sig = nativesig_to_s10(sig)) > 0) + SIGADDSET(&newset, s10sig); + } + + if (s10_uucopy(&newset, s10_set, sizeof (sigset_t)) != 0) + return (EFAULT); + + return (0); +} + +/* + * This is our interposed signal handler. + * Fix up the arguments received from the kernel and jump + * to the s10 signal handler, normally libc's sigacthandler(). + */ +static void +s10_sigacthandler(int sig, siginfo_t *sip, void *uvp) +{ + int s10_sig; + ucontext_t *ucp; + + s10_sig = nativesig_to_s10(sig); + if (s10_sig <= 0) /* can't happen? */ + s10_abort(sig, "Received an impossible signal"); + if (sip != NULL) { + /* + * All we really have to do is map the signal number, + * which changes only for the realtime signals, + * so all the rest of the siginfo structure is the + * same between s10 and native. + */ + if (sip->si_signo != sig) /* can't happen? */ + s10_abort(sig, "Received an impossible siginfo"); + sip->si_signo = s10_sig; + } + if ((ucp = uvp) != NULL && + (ucp->uc_flags & UC_SIGMASK)) + (void) nativesigset_to_s10(&ucp->uc_sigmask, &ucp->uc_sigmask); + + s10_handlers[s10_sig - 1](s10_sig, sip, uvp); +} + +/* + * Interposition upon SYS_lwp_sigmask + */ +int +s10_lwp_sigmask(sysret_t *rval, int how, uint_t bits0, uint_t bits1) +{ + sigset_t s10_blockset; + sigset_t native_blockset; + int err; + + s10_blockset.__sigbits[0] = bits0; + s10_blockset.__sigbits[1] = bits1; + s10_blockset.__sigbits[2] = 0; + s10_blockset.__sigbits[3] = 0; + + (void) s10sigset_to_native(&s10_blockset, &native_blockset); + + err = __systemcall(rval, SYS_lwp_sigmask + 1024, + how, + native_blockset.__sigbits[0], + native_blockset.__sigbits[1], + native_blockset.__sigbits[2], + native_blockset.__sigbits[3]); + + if (err != 0) + return (err); + + native_blockset.__sigbits[0] = (int)rval->sys_rval1; + native_blockset.__sigbits[1] = (int)rval->sys_rval2; + native_blockset.__sigbits[2] = 0; + native_blockset.__sigbits[3] = 0; + + (void) nativesigset_to_s10(&native_blockset, &s10_blockset); + + rval->sys_rval1 = s10_blockset.__sigbits[0]; + rval->sys_rval2 = s10_blockset.__sigbits[1]; + + return (0); +} + +/* + * Interposition upon SYS_sigprocmask + */ +int +s10_sigprocmask(sysret_t *rval, int how, const sigset_t *set, sigset_t *oset) +{ + sigset_t sigset_set, sigset_oset; + sigset_t *set_ptr, *oset_ptr; + int err; + + oset_ptr = (oset == NULL) ? NULL : &sigset_oset; + set_ptr = (set == NULL) ? NULL : &sigset_set; + + if (set_ptr != NULL && + (err = s10sigset_to_native(set, set_ptr)) != 0) + return (err); + + if ((err = __systemcall(rval, SYS_sigprocmask + 1024, + how, set_ptr, oset_ptr)) != 0) + return (err); + + if (oset_ptr != NULL && + (err = nativesigset_to_s10(oset_ptr, oset)) != 0) + return (err); + + return (0); +} + +/* + * Interposition upon SYS_sigsuspend + */ +int +s10_sigsuspend(sysret_t *rval, const sigset_t *set) +{ + sigset_t sigset_set; + int err; + + if ((err = s10sigset_to_native(set, &sigset_set)) != 0) { + (void) S10_TRUSS_POINT_1(rval, SYS_sigsuspend, err, set); + return (err); + } + + return (__systemcall(rval, SYS_sigsuspend + 1024, &sigset_set)); +} + +/* + * Interposition upon SYS_sigaction + * + * There is a fair amount of complexity here due to the need to interpose + * on any registered user signal handler. + * + * The idea is that if a user signal handler is installed, we must install + * our own signal handler between the system and the signal handler being + * registered. If the signal handler to be registered is SIG_DFL or SIG_IGN, + * we should remove our interpositioned handler as it's no longer needed. + * + * The way we do this is we set the signal handler to call s10_sigacthandler(), + * and then store the address of the passed signal handler in a global + * per-process array, s10_handlers[]. + * + * We rely on the fact that the s10 libc blocks all signals during + * its call to the sigaction() system call to guarantee atomicity. + */ +int +s10_sigaction(sysret_t *rval, + int sig, const struct sigaction *act, struct sigaction *oact) +{ + struct sigaction sigact, osigact; + struct sigaction *sigactp, *osigactp; + int err, nativesig; + void (*handler)(); + + if ((nativesig = s10sig_to_native(sig)) < 0) { + (void) S10_TRUSS_POINT_3(rval, SYS_sigaction, EINVAL, + sig, act, oact); + return (EINVAL); + } + + if (act == NULL) { + sigactp = NULL; + } else { + sigactp = &sigact; + + if (s10_uucopy(act, sigactp, sizeof (struct sigaction)) != 0) + return (EFAULT); + + if ((err = s10sigset_to_native(&sigactp->sa_mask, + &sigactp->sa_mask)) != 0) { + (void) S10_TRUSS_POINT_3(rval, SYS_sigaction, err, + sig, act, oact); + return (err); + } + } + + osigactp = ((oact == NULL) ? NULL : &osigact); + + if (sigactp != NULL) { + handler = sigactp->sa_handler; + if (handler != SIG_DFL && handler != SIG_IGN) + sigactp->sa_handler = s10_sigacthandler; + } + + if ((err = __systemcall(rval, SYS_sigaction + 1024, + nativesig, sigactp, osigactp)) != 0) + return (err); + + /* + * Translate the old signal mask if we are supposed to return the old + * struct sigaction. + * + * Note that we may have set the signal handler, but may return EFAULT + * here if the oact parameter is bad. + * + * That's OK, because the direct system call acts the same way. + */ + if (osigactp != NULL) { + err = nativesigset_to_s10(&osigactp->sa_mask, + &osigactp->sa_mask); + + if (osigactp->sa_handler == s10_sigacthandler) + osigactp->sa_handler = s10_handlers[sig - 1]; + + if (err == 0 && + s10_uucopy(osigactp, oact, sizeof (struct sigaction)) != 0) + err = EFAULT; + } + + /* + * Do not store SIG_DFL or SIG_IGN into the array of remembered + * signal handlers. Only store bona-fide function addresses. + * This is to avoid a race condition in which some thread + * sets the signal handler to SIG_DFL or SIG_IGN while some + * other thread is fielding the signal but has not yet reached + * s10_sigacthandler(). s10_sigacthandler() will unconditionally + * call the remembered signal handler and it it calls SIG_DFL or + * SIG_IGN, the process will incur a SIGSEGV or SIGBUS signal. + * This also allows a vfork() child to set signal handlers + * to SIG_DFL or SIG_IGN without corrupting the parent's + * address space. + */ + if (sigactp != NULL && + handler != SIG_DFL && handler != SIG_IGN) + s10_handlers[sig - 1] = handler; + + return (err); +} + +/* + * Interposition upon SYS_sigpending + */ +int +s10_sigpending(sysret_t *rval, int flag, sigset_t *set) +{ + sigset_t sigset_set; + int err; + + if ((err = __systemcall(rval, SYS_sigpending + 1024, + flag, &sigset_set)) != 0) + return (err); + + if ((err = nativesigset_to_s10(&sigset_set, set)) != 0) + return (err); + + return (0); +} + +/* + * Interposition upon SYS_context + */ +int +s10_context(sysret_t *rval, int flag, ucontext_t *ucp) +{ + ucontext_t uc; + int err; + + if (flag == SETCONTEXT) { + if (s10_uucopy(ucp, &uc, sizeof (ucontext_t)) != 0) + return (EFAULT); + if (uc.uc_flags & UC_SIGMASK) { + if ((err = s10sigset_to_native(&uc.uc_sigmask, + &uc.uc_sigmask)) != 0) { + (void) S10_TRUSS_POINT_2(rval, SYS_context, err, + flag, ucp); + return (err); + } + } + ucp = &uc; + } + + err = __systemcall(rval, SYS_context + 1024, flag, ucp); + if (err != 0) + return (err); + + if (flag == GETCONTEXT && (ucp->uc_flags & UC_SIGMASK)) + (void) nativesigset_to_s10(&ucp->uc_sigmask, &ucp->uc_sigmask); + + return (0); +} + +/* + * Interposition upon SYS_sigsendsys + */ +int +s10_sigsendsys(sysret_t *rval, procset_t *psp, int sig) +{ + int nativesig; + + if ((nativesig = s10sig_to_native(sig)) < 0) { + (void) S10_TRUSS_POINT_2(rval, SYS_sigsendsys, EINVAL, + psp, sig); + return (EINVAL); + } + + return (__systemcall(rval, SYS_sigsendsys + 1024, psp, nativesig)); +} + +/* + * Convert the siginfo_t code and status fields to an old style + * wait status for s10_wait(), below. + */ +static int +wstat(int code, int status) +{ + int stat = (status & 0377); + + switch (code) { + case CLD_EXITED: + stat <<= 8; + break; + case CLD_DUMPED: + stat |= WCOREFLG; + break; + case CLD_KILLED: + break; + case CLD_TRAPPED: + case CLD_STOPPED: + stat <<= 8; + stat |= WSTOPFLG; + break; + case CLD_CONTINUED: + stat = WCONTFLG; + break; + } + return (stat); +} + +/* + * Interposition upon SYS_wait + */ +int +s10_wait(sysret_t *rval) +{ + int err; + siginfo_t info; + + err = s10_waitid(rval, P_ALL, 0, &info, WEXITED | WTRAPPED); + if (err != 0) + return (err); + + rval->sys_rval1 = info.si_pid; + rval->sys_rval2 = wstat(info.si_code, info.si_status); + + return (0); +} + +/* + * Interposition upon SYS_waitid + */ +int +s10_waitid(sysret_t *rval, + idtype_t idtype, id_t id, siginfo_t *infop, int options) +{ + int err, sig; + + err = __systemcall(rval, SYS_waitid + 1024, idtype, id, infop, options); + if (err != 0) + return (err); + + /* + * If the process being waited for terminated or stopped due to a + * signal, translate the signal number from its native value to its + * S10 equivalent. + * + * If we can't legally translate the signal number, just sort of punt + * and leave it untranslated. + * + * We shouldn't return EINVAL as the syscall didn't technically fail. + */ + if (infop->si_signo == SIGCLD && infop->si_code != CLD_EXITED && + (sig = nativesig_to_s10(infop->si_status)) > 0) + infop->si_status = sig; + + return (0); +} + +/* + * Interposition upon SYS_sigtimedwait + */ +int +s10_sigtimedwait(sysret_t *rval, + const sigset_t *set, siginfo_t *info, const timespec_t *timeout) +{ + sigset_t sigset_set; + int err, sig; + + if ((err = s10sigset_to_native(set, &sigset_set)) != 0) { + (void) S10_TRUSS_POINT_3(rval, SYS_sigtimedwait, err, + set, info, timeout); + return (err); + } + + if ((err = __systemcall(rval, SYS_sigtimedwait + 1024, + &sigset_set, info, timeout)) != 0) + return (err); + + if (info != NULL) { + /* + * If we can't legally translate the signal number in the + * siginfo_t, just sort of punt and leave it untranslated. + * + * We shouldn't return EINVAL as the syscall didn't technically + * fail. + */ + if ((sig = nativesig_to_s10(info->si_signo)) > 0) + info->si_signo = sig; + } + + /* + * If we can't legally translate the signal number returned by the + * sigtimedwait syscall, just sort of punt and leave it untranslated. + * + * We shouldn't return EINVAL as the syscall didn't technically + * fail. + */ + if ((sig = nativesig_to_s10((int)rval->sys_rval1)) > 0) + rval->sys_rval1 = sig; + + return (0); +} + +/* + * Interposition upon SYS_sigqueue + */ +int +s10_sigqueue(sysret_t *rval, pid_t pid, int signo, void *value, int si_code) +{ + int nativesig; + + if ((nativesig = s10sig_to_native(signo)) < 0) { + (void) S10_TRUSS_POINT_4(rval, SYS_sigqueue, EINVAL, + pid, signo, value, si_code); + return (EINVAL); + } + + if (pid == 1) + pid = zone_init_pid; + + /* + * The native version of this syscall takes an extra argument. + * The new last arg "block" flag should be zero. The block flag + * is used by the Opensolaris AIO implementation, which is now + * part of libc. + */ + return (__systemcall(rval, SYS_sigqueue + 1024, + pid, nativesig, value, si_code, 0)); +} + +/* + * Interposition upon SYS_signotify + */ +int +s10_signotify(sysret_t *rval, + int cmd, siginfo_t *siginfo, signotify_id_t *sn_id) +{ + siginfo_t *infop, info; + + infop = siginfo; + + /* only check for a valid siginfo pointer in the case of SN_PROC */ + if (cmd == SN_PROC) { + int nativesig; + + if (s10_uucopy(infop, &info, sizeof (siginfo_t)) != 0) + return (EFAULT); + + if ((nativesig = s10sig_to_native(info.si_signo)) < 0) { + (void) S10_TRUSS_POINT_3(rval, SYS_signotify, EINVAL, + cmd, siginfo, sn_id); + return (EINVAL); + } + + info.si_signo = nativesig; + infop = &info; + } + + return (__systemcall(rval, SYS_signotify + 1024, cmd, infop, sn_id)); +} + +/* + * Interposition upon SYS_kill + */ +int +s10_kill(sysret_t *rval, pid_t pid, int sig) +{ + int nativesig; + + if ((nativesig = s10sig_to_native(sig)) < 0) { + (void) S10_TRUSS_POINT_2(rval, SYS_kill, EINVAL, pid, sig); + return (EINVAL); + } + + if (pid == 1) + pid = zone_init_pid; + + return (__systemcall(rval, SYS_kill + 1024, pid, nativesig)); +} + +/* + * Interposition upon SYS_lwp_create + * + * See also the s10_lwp_create_correct_fs() function in s10_brand.c + * for the special case of creating an lwp in a 64-bit x86 process. + */ +int +s10_lwp_create(sysret_t *rval, ucontext_t *ucp, int flags, id_t *new_lwp) +{ + ucontext_t s10_uc; + + if (s10_uucopy(ucp, &s10_uc, sizeof (ucontext_t)) != 0) + return (EFAULT); + + if (s10_uc.uc_flags & UC_SIGMASK) + (void) s10sigset_to_native(&s10_uc.uc_sigmask, + &s10_uc.uc_sigmask); + + return (__systemcall(rval, SYS_lwp_create + 1024, + &s10_uc, flags, new_lwp)); +} + +/* + * Interposition upon SYS_lwp_kill + */ +int +s10_lwp_kill(sysret_t *rval, id_t lwpid, int sig) +{ + int nativesig; + + if ((nativesig = s10sig_to_native(sig)) < 0) { + (void) S10_TRUSS_POINT_2(rval, SYS_lwp_kill, EINVAL, + lwpid, sig); + return (EINVAL); + } + + return (__systemcall(rval, SYS_lwp_kill + 1024, lwpid, nativesig)); +} diff --git a/usr/src/lib/brand/solaris10/s10_brand/sys/s10_misc.h b/usr/src/lib/brand/solaris10/s10_brand/sys/s10_misc.h index 35874b4c9d..4488058ac1 100644 --- a/usr/src/lib/brand/solaris10/s10_brand/sys/s10_misc.h +++ b/usr/src/lib/brand/solaris10/s10_brand/sys/s10_misc.h @@ -227,7 +227,27 @@ extern int s10_fxstat(); extern int s10_xmknod(); extern int s10_fsat(); extern int s10_umount(); + +/* + * From s10_signal.c + */ +extern int s10sigset_to_native(const sigset_t *, sigset_t *); + +extern int s10_context(); +extern int s10_kill(); +extern int s10_lwp_create(); +extern int s10_lwp_kill(); +extern int s10_lwp_sigmask(); +extern int s10_sigaction(); +extern int s10_signotify(); +extern int s10_sigpending(); +extern int s10_sigprocmask(); +extern int s10_sigqueue(); +extern int s10_sigsendsys(); +extern int s10_sigsuspend(); +extern int s10_sigtimedwait(); extern int s10_wait(); +extern int s10_waitid(); #endif /* !_ASM */ diff --git a/usr/src/lib/brand/solaris10/s10_brand/sys/s10_signal.h b/usr/src/lib/brand/solaris10/s10_brand/sys/s10_signal.h new file mode 100644 index 0000000000..b0b2f004b8 --- /dev/null +++ b/usr/src/lib/brand/solaris10/s10_brand/sys/s10_signal.h @@ -0,0 +1,58 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ + +/* + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _S10_SIGNAL_H +#define _S10_SIGNAL_H + +#ifdef __cplusplus +extern "C" { +#endif + +#if !defined(_ASM) + +#include <sys/types.h> +#include <sys/signal.h> + +extern pid_t zone_init_pid; + +typedef void (*s10_sighandler_t)(int, siginfo_t *, void *); + +#endif /* !_ASM */ + +#define S10_NSIG 49 + +/* + * Configurable in native Solaris, stick with the values assigned + * by default as _SIGRTMIN and _SIGRTMAX in S10. + */ +#define S10_SIGRTMIN 41 +#define S10_SIGRTMAX 48 + +#ifdef __cplusplus +} +#endif + +#endif /* _S10_SIGNAL_H */ diff --git a/usr/src/lib/libc/amd64/gen/siginfolst.c b/usr/src/lib/libc/amd64/gen/siginfolst.c index fb2868f22f..17cad14cf6 100644 --- a/usr/src/lib/libc/amd64/gen/siginfolst.c +++ b/usr/src/lib/libc/amd64/gen/siginfolst.c @@ -20,21 +20,19 @@ */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* Copyright (c) 1988 AT&T */ /* All Rights Reserved */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include "lint.h" #include <signal.h> #include <siginfo.h> -#undef _sys_siginfolist -#define OLDNSIG 34 +#undef _sys_siginfolist +#define OLDNSIG 34 const char *_sys_traplist[NSIGTRAP] = { "breakpoint trap", @@ -46,7 +44,7 @@ const char *_sys_traplist[NSIGTRAP] = { }; const char *_sys_illlist[NSIGILL] = { - "illegal opcode", + "illegal instruction", "illegal operand", "illegal addressing mode", "illegal trap", @@ -69,7 +67,7 @@ const char *_sys_fpelist[NSIGFPE] = { const char *_sys_segvlist[NSIGSEGV] = { "address not mapped to object", - "invalid permissions", + "invalid permissions" }; const char *_sys_buslist[NSIGBUS] = { @@ -177,6 +175,30 @@ static const struct siginfolist _sys_siginfolist_data[NSIG-1] = { 0, 0, /* SIGRTMIN+1 */ 0, 0, /* SIGRTMIN+2 */ 0, 0, /* SIGRTMIN+3 */ + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, /* SIGRTMIN+15 */ + 0, 0, /* SIGRTMAX-15 */ + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, 0, 0, /* SIGRTMAX-3 */ 0, 0, /* SIGRTMAX-2 */ 0, 0, /* SIGRTMAX-1 */ diff --git a/usr/src/lib/libc/amd64/genassym.c b/usr/src/lib/libc/amd64/genassym.c index c92d78281a..81ec565691 100644 --- a/usr/src/lib/libc/amd64/genassym.c +++ b/usr/src/lib/libc/amd64/genassym.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,13 +18,12 @@ * * CDDL HEADER END */ + /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <stdio.h> #include <stddef.h> #include <signal.h> @@ -54,6 +52,8 @@ main(void) (void) printf("#define\tSIG_SETMASK\t0x%x\n", SIG_SETMASK); (void) printf("#define\tMASKSET0\t0x%x\n", MASKSET0); (void) printf("#define\tMASKSET1\t0x%x\n", MASKSET1); + (void) printf("#define\tMASKSET2\t0x%x\n", MASKSET2); + (void) printf("#define\tMASKSET3\t0x%x\n", MASKSET3); (void) printf("#define\tSIGSEGV\t0x%x\n", SIGSEGV); (void) printf("#define\tRIP_OFF\t0x%x\n", REG_RIP * 8); diff --git a/usr/src/lib/libc/amd64/sys/vforkx.s b/usr/src/lib/libc/amd64/sys/vforkx.s index 5739410694..155e01a4e6 100644 --- a/usr/src/lib/libc/amd64/sys/vforkx.s +++ b/usr/src/lib/libc/amd64/sys/vforkx.s @@ -20,7 +20,7 @@ */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -62,26 +62,31 @@ xorq %r8, %r8 /* flags = 0 */ 0: popq %r9 /* save return %rip in %r9 */ - movl $MASKSET1, %edx /* block all signals */ + pushq %r8 /* save the flags on the stack */ + movl $MASKSET3, %r8d /* block all signals */ + movl $MASKSET2, %ecx + movl $MASKSET1, %edx movl $MASKSET0, %esi movl $SIG_SETMASK, %edi __SYSCALL(lwp_sigmask) - movq %r8, %rsi /* flags */ + popq %rsi /* fetch flags from the stack */ movl $2, %edi __SYSCALL(forksys) /* vforkx(flags) */ jae 1f /* reconstruct stack before jumping to __cerror */ pushq %r9 - movq %rax, %r8 /* save the vfork() error number */ + movq %rax, %r9 /* save the vfork() error number */ - movl %fs:UL_SIGMASK+4, %edx /* reinstate signals */ + movl %fs:UL_SIGMASK+12, %r8d /* reinstate signals */ + movl %fs:UL_SIGMASK+8, %ecx + movl %fs:UL_SIGMASK+4, %edx movl %fs:UL_SIGMASK, %esi movl $SIG_SETMASK, %edi __SYSCALL(lwp_sigmask) - movq %r8, %rax /* restore the vfork() error number */ + movq %r9, %rax /* restore the vfork() error number */ jmp __cerror 1: @@ -112,14 +117,16 @@ xorq %rdx, %rdx movq %rdx, %fs:UL_SCHEDCTL movq %rdx, %fs:UL_SCHEDCTL_CALLED - movq %rax, %r8 /* save the vfork() return value */ + pushq %rax /* save the vfork() return value */ - movl %fs:UL_SIGMASK+4, %edx /* reinstate signals */ + movl %fs:UL_SIGMASK+12, %r8d /* reinstate signals */ + movl %fs:UL_SIGMASK+8, %ecx + movl %fs:UL_SIGMASK+4, %edx movl %fs:UL_SIGMASK, %esi movl $SIG_SETMASK, %edi __SYSCALL(lwp_sigmask) - movq %r8, %rax /* restore the vfork() return value */ + popq %rax /* restore the vfork() return value */ jmp *%r9 /* jump back to the caller */ SET_SIZE(vfork) SET_SIZE(vforkx) diff --git a/usr/src/lib/libc/i386/gen/siginfolst.c b/usr/src/lib/libc/i386/gen/siginfolst.c index 1bdaa21747..17cad14cf6 100644 --- a/usr/src/lib/libc/i386/gen/siginfolst.c +++ b/usr/src/lib/libc/i386/gen/siginfolst.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,22 +18,21 @@ * * CDDL HEADER END */ + /* - * Copyright 1992-2003 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* Copyright (c) 1988 AT&T */ /* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" - +#include "lint.h" #include <signal.h> #include <siginfo.h> -#undef _sys_siginfolist -#define OLDNSIG 34 +#undef _sys_siginfolist +#define OLDNSIG 34 const char *_sys_traplist[NSIGTRAP] = { "breakpoint trap", @@ -46,7 +44,7 @@ const char *_sys_traplist[NSIGTRAP] = { }; const char *_sys_illlist[NSIGILL] = { - "illegal opcode", + "illegal instruction", "illegal operand", "illegal addressing mode", "illegal trap", @@ -69,7 +67,7 @@ const char *_sys_fpelist[NSIGFPE] = { const char *_sys_segvlist[NSIGSEGV] = { "address not mapped to object", - "invalid permissions", + "invalid permissions" }; const char *_sys_buslist[NSIGBUS] = { @@ -177,6 +175,30 @@ static const struct siginfolist _sys_siginfolist_data[NSIG-1] = { 0, 0, /* SIGRTMIN+1 */ 0, 0, /* SIGRTMIN+2 */ 0, 0, /* SIGRTMIN+3 */ + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, /* SIGRTMIN+15 */ + 0, 0, /* SIGRTMAX-15 */ + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, 0, 0, /* SIGRTMAX-3 */ 0, 0, /* SIGRTMAX-2 */ 0, 0, /* SIGRTMAX-1 */ diff --git a/usr/src/lib/libc/i386/genassym.c b/usr/src/lib/libc/i386/genassym.c index 9a826e4b6b..fc64651c1a 100644 --- a/usr/src/lib/libc/i386/genassym.c +++ b/usr/src/lib/libc/i386/genassym.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,13 +18,12 @@ * * CDDL HEADER END */ + /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <stdio.h> #include <stddef.h> #include <signal.h> @@ -54,6 +52,8 @@ main(void) (void) printf("#define\tSIG_SETMASK\t0x%x\n", SIG_SETMASK); (void) printf("#define\tMASKSET0\t0x%x\n", MASKSET0); (void) printf("#define\tMASKSET1\t0x%x\n", MASKSET1); + (void) printf("#define\tMASKSET2\t0x%x\n", MASKSET2); + (void) printf("#define\tMASKSET3\t0x%x\n", MASKSET3); (void) printf("#define\tSIGSEGV\t0x%x\n", SIGSEGV); (void) printf("#define\tEIP_OFF\t0x%x\n", EIP * 4); diff --git a/usr/src/lib/libc/i386/sys/vforkx.s b/usr/src/lib/libc/i386/sys/vforkx.s index 618c20bbc7..1b2afa47bf 100644 --- a/usr/src/lib/libc/i386/sys/vforkx.s +++ b/usr/src/lib/libc/i386/sys/vforkx.s @@ -20,7 +20,7 @@ */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -63,12 +63,14 @@ 0: popl %ecx /* save return %eip in %ecx */ pushl %eax /* flags */ - pushl $MASKSET1 /* block all signals */ + pushl $MASKSET3 /* block all signals */ + pushl $MASKSET2 + pushl $MASKSET1 pushl $MASKSET0 pushl $SIG_SETMASK pushl %ecx __SYSCALLINT(lwp_sigmask) - addl $16, %esp + addl $24, %esp pushl $2 pushl %ecx @@ -80,12 +82,14 @@ pushl %ecx pushl %eax /* save the vfork() error number */ - pushl %gs:UL_SIGMASK+4 /* reinstate signals */ + pushl %gs:UL_SIGMASK+12 /* reinstate signals */ + pushl %gs:UL_SIGMASK+8 + pushl %gs:UL_SIGMASK+4 pushl %gs:UL_SIGMASK pushl $SIG_SETMASK pushl %ecx __SYSCALLINT(lwp_sigmask) - addl $16, %esp + addl $24, %esp popl %eax /* restore the vfork() error number */ jmp __cerror @@ -121,12 +125,14 @@ movl %edx, %gs:UL_SCHEDCTL_CALLED pushl %eax /* save the vfork() return value */ - pushl %gs:UL_SIGMASK+4 /* reinstate signals */ + pushl %gs:UL_SIGMASK+12 /* reinstate signals */ + pushl %gs:UL_SIGMASK+8 + pushl %gs:UL_SIGMASK+4 pushl %gs:UL_SIGMASK pushl $SIG_SETMASK pushl %ecx __SYSCALLINT(lwp_sigmask) - addl $16, %esp + addl $24, %esp popl %eax /* restore the vfork() return value */ jmp *%ecx /* jump back to the caller */ diff --git a/usr/src/lib/libc/inc/thr_uberdata.h b/usr/src/lib/libc/inc/thr_uberdata.h index ac14038787..140bdcd251 100644 --- a/usr/src/lib/libc/inc/thr_uberdata.h +++ b/usr/src/lib/libc/inc/thr_uberdata.h @@ -673,18 +673,24 @@ typedef struct ulwp { #define SIGMASK(sig) ((uint32_t)1 << (((sig) - 1) & (32 - 1))) -#if (MAXSIG > 32 && MAXSIG <= 64) +#if (MAXSIG > (2 * 32) && MAXSIG <= (3 * 32)) #define FILLSET0 0xffffffffu -#define FILLSET1 ((1u << (MAXSIG - 32)) - 1) +#define FILLSET1 0xffffffffu +#define FILLSET2 ((1u << (MAXSIG - 64)) - 1) +#define FILLSET3 0 #else #error "fix me: MAXSIG out of bounds" #endif #define CANTMASK0 (SIGMASK(SIGKILL) | SIGMASK(SIGSTOP)) #define CANTMASK1 0 +#define CANTMASK2 0 +#define CANTMASK3 0 #define MASKSET0 (FILLSET0 & ~CANTMASK0) #define MASKSET1 (FILLSET1 & ~CANTMASK1) +#define MASKSET2 (FILLSET2 & ~CANTMASK2) +#define MASKSET3 (FILLSET3 & ~CANTMASK3) extern const sigset_t maskset; /* set of all maskable signals */ @@ -1057,8 +1063,8 @@ typedef struct ulwp32 { uint_t ul_pilocks; /* count of PI locks held */ /* the following members *must* be last in the structure */ /* they are discarded when ulwp is replaced on thr_exit() */ - sigset32_t ul_sigmask; /* thread's current signal mask */ - sigset32_t ul_tmpmask; /* signal mask for sigsuspend/pollsys */ + sigset_t ul_sigmask; /* thread's current signal mask */ + sigset_t ul_tmpmask; /* signal mask for sigsuspend/pollsys */ siginfo32_t ul_siginfo; /* deferred siginfo */ mutex_t ul_spinlock; /* used when suspending/continuing */ fpuenv32_t ul_fpuenv; /* floating point state */ @@ -1286,8 +1292,8 @@ extern void _sigon(void); #define delete_reserved_signals(s) \ (((s)->__sigbits[0] &= MASKSET0), \ ((s)->__sigbits[1] &= (MASKSET1 & ~SIGMASK(SIGCANCEL))),\ - ((s)->__sigbits[2] = 0), \ - ((s)->__sigbits[3] = 0)) + ((s)->__sigbits[2] &= MASKSET2), \ + ((s)->__sigbits[3] &= MASKSET3)) extern void block_all_signals(ulwp_t *self); @@ -1302,7 +1308,7 @@ extern void block_all_signals(ulwp_t *self); #define restore_signals(self) \ ((void) ((self)->ul_cursig? \ (ASSERT((self)->ul_critical + (self)->ul_sigdefer != 0), 0) : \ - __lwp_sigmask(SIG_SETMASK, &(self)->ul_sigmask, NULL))) + __lwp_sigmask(SIG_SETMASK, &(self)->ul_sigmask))) extern void set_cancel_pending_flag(ulwp_t *, int); extern void set_cancel_eintr_flag(ulwp_t *); @@ -1378,7 +1384,8 @@ extern void abstime_to_reltime(clockid_t, const timespec_t *, timespec_t *); extern void hrt2ts(hrtime_t, timespec_t *); extern int __sigaction(int, const struct sigaction *, struct sigaction *); -extern int __lwp_sigmask(int, const sigset_t *, sigset_t *); +extern int __sigprocmask(int, const sigset_t *, sigset_t *); +extern int __lwp_sigmask(int, const sigset_t *); extern void __sighndlr(int, siginfo_t *, ucontext_t *, void (*)()); extern caddr_t __sighndlrend; #pragma unknown_control_flow(__sighndlr) diff --git a/usr/src/lib/libc/port/gen/siglist.c b/usr/src/lib/libc/port/gen/siglist.c index b75381a145..1795632f44 100644 --- a/usr/src/lib/libc/port/gen/siglist.c +++ b/usr/src/lib/libc/port/gen/siglist.c @@ -20,7 +20,7 @@ */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -37,8 +37,6 @@ * contributors. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include "lint.h" #include <sys/types.h> #include <signal.h> @@ -106,21 +104,45 @@ static const char *_sys_siglist_data[NSIG] = { STR_SIGTSTP, STR_SIGCONT, STR_SIGTTIN, STR_SIGTTOU, STR_SIGVTALRM, STR_SIGPROF, STR_SIGXCPU, STR_SIGXFSZ, STR_SIGWAITING, STR_SIGLWP, - "Checkpoint Freeze", /* SIGFREEZE */ - "Checkpoint Thaw", /* SIGTHAW */ - "Thread Cancellation", /* SIGCANCEL */ - "Resource Lost", /* SIGLOST */ - "Resource Control Exceeded", /* SIGXRES */ - "Reserved for JVM 1", /* SIGJVM1 */ - "Reserved for JVM 2", /* SIGJVM2 */ - "First Realtime Signal", /* SIGRTMIN */ - "Second Realtime Signal", /* SIGRTMIN+1 */ - "Third Realtime Signal", /* SIGRTMIN+2 */ - "Fourth Realtime Signal", /* SIGRTMIN+3 */ - "Fourth Last Realtime Signal", /* SIGRTMAX-3 */ - "Third Last Realtime Signal", /* SIGRTMAX-2 */ - "Second Last Realtime Signal", /* SIGRTMAX-1 */ - "Last Realtime Signal" /* SIGRTMAX */ + "Checkpoint Freeze", /* SIGFREEZE */ + "Checkpoint Thaw", /* SIGTHAW */ + "Thread Cancellation", /* SIGCANCEL */ + "Resource Lost", /* SIGLOST */ + "Resource Control Exceeded", /* SIGXRES */ + "Reserved for JVM 1", /* SIGJVM1 */ + "Reserved for JVM 2", /* SIGJVM2 */ + "First Realtime Signal", /* SIGRTMIN */ + "Second Realtime Signal", /* SIGRTMIN+1 */ + "Third Realtime Signal", /* SIGRTMIN+2 */ + "Fourth Realtime Signal", /* SIGRTMIN+3 */ + "Fifth Realtime Signal", /* SIGRTMIN+4 */ + "Sixth Realtime Signal", /* SIGRTMIN+5 */ + "Seventh Realtime Signal", /* SIGRTMIN+6 */ + "Eighth Realtime Signal", /* SIGRTMIN+7 */ + "Ninth Realtime Signal", /* SIGRTMIN+8 */ + "Tenth Realtime Signal", /* SIGRTMIN+9 */ + "Eleventh Realtime Signal", /* SIGRTMIN+10 */ + "Twelfth Realtime Signal", /* SIGRTMIN+11 */ + "Thirteenth Realtime Signal", /* SIGRTMIN+12 */ + "Fourteenth Realtime Signal", /* SIGRTMIN+13 */ + "Fifteenth Realtime Signal", /* SIGRTMIN+14 */ + "Sixteenth Realtime Signal", /* SIGRTMIN+15 */ + "Sixteenth Last Realtime Signal", /* SIGRTMAX-15 */ + "Fifteenth Last Realtime Signal", /* SIGRTMAX-14 */ + "Fourteenth Last Realtime Signal", /* SIGRTMAX-13 */ + "Thirteenth Last Realtime Signal", /* SIGRTMAX-12 */ + "Twelfth Last Realtime Signal", /* SIGRTMAX-11 */ + "Eleventh Last Realtime Signal", /* SIGRTMAX-10 */ + "Tenth Last Realtime Signal", /* SIGRTMAX-9 */ + "Ninth Last Realtime Signal", /* SIGRTMAX-8 */ + "Eighth Last Realtime Signal", /* SIGRTMAX-7 */ + "Seventh Last Realtime Signal", /* SIGRTMAX-6 */ + "Sixth Last Realtime Signal", /* SIGRTMAX-5 */ + "Fifth Last Realtime Signal", /* SIGRTMAX-4 */ + "Fourth Last Realtime Signal", /* SIGRTMAX-3 */ + "Third Last Realtime Signal", /* SIGRTMAX-2 */ + "Second Last Realtime Signal", /* SIGRTMAX-1 */ + "Last Realtime Signal" /* SIGRTMAX */ }; const int _sys_siglistn = sizeof (_sys_siglist_data) / sizeof (char *); diff --git a/usr/src/lib/libc/port/gen/str2sig.c b/usr/src/lib/libc/port/gen/str2sig.c index f899f1395e..ac4bde9762 100644 --- a/usr/src/lib/libc/port/gen/str2sig.c +++ b/usr/src/lib/libc/port/gen/str2sig.c @@ -20,15 +20,13 @@ */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* Copyright (c) 1988 AT&T */ /* All Rights Reserved */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include "lint.h" #include <string.h> #include <stdlib.h> @@ -90,6 +88,30 @@ static signame_t signames[] = { { "RTMIN+1", _SIGRTMIN+1 }, { "RTMIN+2", _SIGRTMIN+2 }, { "RTMIN+3", _SIGRTMIN+3 }, + { "RTMIN+4", _SIGRTMIN+4 }, + { "RTMIN+5", _SIGRTMIN+5 }, + { "RTMIN+6", _SIGRTMIN+6 }, + { "RTMIN+7", _SIGRTMIN+7 }, + { "RTMIN+8", _SIGRTMIN+8 }, + { "RTMIN+9", _SIGRTMIN+9 }, + { "RTMIN+10", _SIGRTMIN+10 }, + { "RTMIN+11", _SIGRTMIN+11 }, + { "RTMIN+12", _SIGRTMIN+12 }, + { "RTMIN+13", _SIGRTMIN+13 }, + { "RTMIN+14", _SIGRTMIN+14 }, + { "RTMIN+15", _SIGRTMIN+15 }, + { "RTMAX-15", _SIGRTMAX-15 }, + { "RTMAX-14", _SIGRTMAX-14 }, + { "RTMAX-13", _SIGRTMAX-13 }, + { "RTMAX-12", _SIGRTMAX-12 }, + { "RTMAX-11", _SIGRTMAX-11 }, + { "RTMAX-10", _SIGRTMAX-10 }, + { "RTMAX-9", _SIGRTMAX-9 }, + { "RTMAX-8", _SIGRTMAX-8 }, + { "RTMAX-7", _SIGRTMAX-7 }, + { "RTMAX-6", _SIGRTMAX-6 }, + { "RTMAX-5", _SIGRTMAX-5 }, + { "RTMAX-4", _SIGRTMAX-4 }, { "RTMAX-3", _SIGRTMAX-3 }, { "RTMAX-2", _SIGRTMAX-2 }, { "RTMAX-1", _SIGRTMAX-1 }, diff --git a/usr/src/lib/libc/port/sys/lwp_sigmask.c b/usr/src/lib/libc/port/sys/lwp_sigmask.c index 708124cfd0..a8916131f4 100644 --- a/usr/src/lib/libc/port/sys/lwp_sigmask.c +++ b/usr/src/lib/libc/port/sys/lwp_sigmask.c @@ -20,39 +20,20 @@ */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include "lint.h" #include <signal.h> #include <sys/syscall.h> int -__lwp_sigmask(int how, const sigset_t *set, sigset_t *oset) +__lwp_sigmask(int how, const sigset_t *set) { - sysret_t rval; - uint_t mask0; - uint_t mask1; - - if (set) { - mask0 = set->__sigbits[0]; - mask1 = set->__sigbits[1]; - } else { - how = 0; - mask0 = mask1 = 0; - } - - (void) __systemcall(&rval, SYS_lwp_sigmask, how, mask0, mask1); - - if (oset) { - oset->__sigbits[0] = (uint_t)rval.sys_rval1; - oset->__sigbits[1] = (uint_t)rval.sys_rval2; - oset->__sigbits[2] = 0; - oset->__sigbits[3] = 0; - } - - return (0); + return (syscall(SYS_lwp_sigmask, how, + set->__sigbits[0], + set->__sigbits[1], + set->__sigbits[2], + set->__sigbits[3])); } diff --git a/usr/src/lib/libc/port/threads/assfail.c b/usr/src/lib/libc/port/threads/assfail.c index e37ce4f276..8a6440abc2 100644 --- a/usr/src/lib/libc/port/threads/assfail.c +++ b/usr/src/lib/libc/port/threads/assfail.c @@ -20,7 +20,7 @@ */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -78,7 +78,7 @@ Abort(const char *msg) /* delete SIGABRT from the signal mask */ (void) sigemptyset(&sigmask); (void) sigaddset(&sigmask, SIGABRT); - (void) __lwp_sigmask(SIG_UNBLOCK, &sigmask, NULL); + (void) __lwp_sigmask(SIG_UNBLOCK, &sigmask); (void) _lwp_kill(lwpid, SIGABRT); /* never returns */ (void) kill(getpid(), SIGABRT); /* if it does, try harder */ diff --git a/usr/src/lib/libc/port/threads/scalls.c b/usr/src/lib/libc/port/threads/scalls.c index 368b864d3f..afcdb4bcaa 100644 --- a/usr/src/lib/libc/port/threads/scalls.c +++ b/usr/src/lib/libc/port/threads/scalls.c @@ -413,8 +413,7 @@ forkall(void) if (!self->ul_vfork) { \ if (sigmask) { \ block_all_signals(self); \ - self->ul_tmpmask.__sigbits[0] = sigmask->__sigbits[0]; \ - self->ul_tmpmask.__sigbits[1] = sigmask->__sigbits[1]; \ + self->ul_tmpmask = *sigmask; \ delete_reserved_signals(&self->ul_tmpmask); \ self->ul_sigsuspend = 1; \ } \ diff --git a/usr/src/lib/libc/port/threads/sigaction.c b/usr/src/lib/libc/port/threads/sigaction.c index 4768daa7a6..8e9df7ab60 100644 --- a/usr/src/lib/libc/port/threads/sigaction.c +++ b/usr/src/lib/libc/port/threads/sigaction.c @@ -40,7 +40,8 @@ #include <siginfo.h> #include <sys/systm.h> -const sigset_t maskset = {MASKSET0, MASKSET1, 0, 0}; /* maskable signals */ +/* maskable signals */ +const sigset_t maskset = {MASKSET0, MASKSET1, MASKSET2, MASKSET3}; /* * Return true if the valid signal bits in both sets are the same. @@ -53,8 +54,14 @@ sigequalset(const sigset_t *s1, const sigset_t *s2) * (for speed). Algorithm: * if (s1 & fillset) == (s2 & fillset) then (s1 ^ s2) & fillset == 0 */ +/* see lib/libc/inc/thr_uberdata.h for why this must be true */ +#if (MAXSIG > (2 * 32) && MAXSIG <= (3 * 32)) return (!((s1->__sigbits[0] ^ s2->__sigbits[0]) | - ((s1->__sigbits[1] ^ s2->__sigbits[1]) & FILLSET1))); + (s1->__sigbits[1] ^ s2->__sigbits[1]) | + ((s1->__sigbits[2] ^ s2->__sigbits[2]) & FILLSET2))); +#else +#error "fix me: MAXSIG out of bounds" +#endif } /* @@ -150,7 +157,7 @@ call_user_handler(int sig, siginfo_t *sip, ucontext_t *ucp) (void) sigaddset(&uact.sa_mask, sig); self->ul_sigmask = uact.sa_mask; self->ul_siglink = ucp; - (void) __lwp_sigmask(SIG_SETMASK, &uact.sa_mask, NULL); + (void) __lwp_sigmask(SIG_SETMASK, &uact.sa_mask); /* * If this thread has been sent SIGCANCEL from the kernel @@ -487,7 +494,7 @@ block_all_signals(ulwp_t *self) (scp = setup_schedctl()) != NULL) scp->sc_sigblock = 1; else - (void) __lwp_sigmask(SIG_SETMASK, &maskset, NULL); + (void) __lwp_sigmask(SIG_SETMASK, &maskset); exit_critical(self); } @@ -615,14 +622,20 @@ thr_sigsetmask(int how, const sigset_t *set, sigset_t *oset) case SIG_BLOCK: self->ul_sigmask.__sigbits[0] |= set->__sigbits[0]; self->ul_sigmask.__sigbits[1] |= set->__sigbits[1]; + self->ul_sigmask.__sigbits[2] |= set->__sigbits[2]; + self->ul_sigmask.__sigbits[3] |= set->__sigbits[3]; break; case SIG_UNBLOCK: self->ul_sigmask.__sigbits[0] &= ~set->__sigbits[0]; self->ul_sigmask.__sigbits[1] &= ~set->__sigbits[1]; + self->ul_sigmask.__sigbits[2] &= ~set->__sigbits[2]; + self->ul_sigmask.__sigbits[3] &= ~set->__sigbits[3]; break; case SIG_SETMASK: self->ul_sigmask.__sigbits[0] = set->__sigbits[0]; self->ul_sigmask.__sigbits[1] = set->__sigbits[1]; + self->ul_sigmask.__sigbits[2] = set->__sigbits[2]; + self->ul_sigmask.__sigbits[3] = set->__sigbits[3]; break; } delete_reserved_signals(&self->ul_sigmask); @@ -651,7 +664,7 @@ sigprocmask(int how, const sigset_t *set, sigset_t *oset) * Guard against children of vfork(). */ if (curthread->ul_vfork) - return (__lwp_sigmask(how, set, oset)); + return (__sigprocmask(how, set, oset)); if ((error = thr_sigsetmask(how, set, oset)) != 0) { errno = error; diff --git a/usr/src/lib/libc/port/threads/spawn.c b/usr/src/lib/libc/port/threads/spawn.c index fd91cf44cd..95c93c49c9 100644 --- a/usr/src/lib/libc/port/threads/spawn.c +++ b/usr/src/lib/libc/port/threads/spawn.c @@ -68,9 +68,6 @@ typedef struct file_attr { int fa_newfiledes; /* new file descriptor for dup2() */ } file_attr_t; -extern int __lwp_sigmask(int, const sigset_t *, sigset_t *); -extern int __sigaction(int, const struct sigaction *, struct sigaction *); - #if defined(_LP64) #define __open64 __open #define getdents64 getdents @@ -145,7 +142,7 @@ perform_flag_actions(spawn_attr_t *sap) struct sigaction action; if (sap->sa_psflags & POSIX_SPAWN_SETSIGMASK) { - (void) __lwp_sigmask(SIG_SETMASK, &sap->sa_sigmask, NULL); + (void) __lwp_sigmask(SIG_SETMASK, &sap->sa_sigmask); } if (sap->sa_psflags & POSIX_SPAWN_SETSIGIGN_NP) { diff --git a/usr/src/lib/libc/port/threads/thr.c b/usr/src/lib/libc/port/threads/thr.c index 31c28233f2..6b5803524e 100644 --- a/usr/src/lib/libc/port/threads/thr.c +++ b/usr/src/lib/libc/port/threads/thr.c @@ -20,7 +20,7 @@ */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -1289,7 +1289,9 @@ libc_init(void) */ setmask = ((self->ul_sigmask.__sigbits[0] ^ uc.uc_sigmask.__sigbits[0]) | - (self->ul_sigmask.__sigbits[1] ^ uc.uc_sigmask.__sigbits[1])); + (self->ul_sigmask.__sigbits[1] ^ uc.uc_sigmask.__sigbits[1]) | + (self->ul_sigmask.__sigbits[2] ^ uc.uc_sigmask.__sigbits[2]) | + (self->ul_sigmask.__sigbits[3] ^ uc.uc_sigmask.__sigbits[3])); #ifdef __sparc /* diff --git a/usr/src/lib/libc/sparc/gen/siginfolst.c b/usr/src/lib/libc/sparc/gen/siginfolst.c index 712e70c582..17cad14cf6 100644 --- a/usr/src/lib/libc/sparc/gen/siginfolst.c +++ b/usr/src/lib/libc/sparc/gen/siginfolst.c @@ -20,15 +20,13 @@ */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* Copyright (c) 1988 AT&T */ /* All Rights Reserved */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include "lint.h" #include <signal.h> #include <siginfo.h> @@ -46,11 +44,11 @@ const char *_sys_traplist[NSIGTRAP] = { }; const char *_sys_illlist[NSIGILL] = { - "illegal opcode", + "illegal instruction", "illegal operand", "illegal addressing mode", "illegal trap", - "privileged opcode", + "privileged instruction", "privileged register", "co-processor", "bad stack" @@ -177,6 +175,30 @@ static const struct siginfolist _sys_siginfolist_data[NSIG-1] = { 0, 0, /* SIGRTMIN+1 */ 0, 0, /* SIGRTMIN+2 */ 0, 0, /* SIGRTMIN+3 */ + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, /* SIGRTMIN+15 */ + 0, 0, /* SIGRTMAX-15 */ + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, 0, 0, /* SIGRTMAX-3 */ 0, 0, /* SIGRTMAX-2 */ 0, 0, /* SIGRTMAX-1 */ diff --git a/usr/src/lib/libc/sparc/genassym.c b/usr/src/lib/libc/sparc/genassym.c index e85b97c676..5b3abf21f4 100644 --- a/usr/src/lib/libc/sparc/genassym.c +++ b/usr/src/lib/libc/sparc/genassym.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,13 +18,12 @@ * * CDDL HEADER END */ + /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <stdio.h> #include <stddef.h> #include <signal.h> @@ -51,6 +49,8 @@ main(void) (void) printf("#define\tSIG_SETMASK\t0x%lx\n", SIG_SETMASK); (void) printf("#define\tMASKSET0\t0x%lx\n", MASKSET0); (void) printf("#define\tMASKSET1\t0x%lx\n", MASKSET1); + (void) printf("#define\tMASKSET2\t0x%lx\n", MASKSET2); + (void) printf("#define\tMASKSET3\t0x%lx\n", MASKSET3); (void) printf("#define\tSIGSEGV\t0x%lx\n", SIGSEGV); return (0); diff --git a/usr/src/lib/libc/sparc/sys/vforkx.s b/usr/src/lib/libc/sparc/sys/vforkx.s index d67e23f071..979a49ce7c 100644 --- a/usr/src/lib/libc/sparc/sys/vforkx.s +++ b/usr/src/lib/libc/sparc/sys/vforkx.s @@ -20,7 +20,7 @@ */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -59,30 +59,34 @@ ENTRY_NP(vforkx) ba 0f - mov %o0, %o3 /* flags */ + mov %o0, %o5 /* flags */ ENTRY_NP(vfork) - clr %o3 /* flags = 0 */ + clr %o5 /* flags = 0 */ 0: mov SIG_SETMASK, %o0 /* block all signals */ set MASKSET0, %o1 set MASKSET1, %o2 - SYSTRAP_2RVALS(lwp_sigmask) + set MASKSET2, %o3 + set MASKSET3, %o4 + SYSTRAP_RVAL1(lwp_sigmask) - mov %o3, %o1 /* flags */ + mov %o5, %o1 /* flags */ mov 2, %o0 SYSTRAP_2RVALS(forksys) /* vforkx(flags) */ bcc,a,pt %icc, 1f tst %o1 - mov %o0, %o3 /* save the vfork() error number */ + mov %o0, %o5 /* save the vfork() error number */ mov SIG_SETMASK, %o0 /* reinstate signals */ ld [%g7 + UL_SIGMASK], %o1 ld [%g7 + UL_SIGMASK + 4], %o2 - SYSTRAP_2RVALS(lwp_sigmask) + ld [%g7 + UL_SIGMASK + 8], %o3 + ld [%g7 + UL_SIGMASK + 12], %o4 + SYSTRAP_RVAL1(lwp_sigmask) ba __cerror - mov %o3, %o0 /* restore the vfork() error number */ + mov %o5, %o0 /* restore the vfork() error number */ 1: /* @@ -108,14 +112,16 @@ */ stn %g0, [%g7 + UL_SCHEDCTL] stn %g0, [%g7 + UL_SCHEDCTL_CALLED] - mov %o0, %o3 /* save the vfork() return value */ + mov %o0, %o5 /* save the vfork() return value */ mov SIG_SETMASK, %o0 /* reinstate signals */ ld [%g7 + UL_SIGMASK], %o1 ld [%g7 + UL_SIGMASK + 4], %o2 - SYSTRAP_2RVALS(lwp_sigmask) + ld [%g7 + UL_SIGMASK + 8], %o3 + ld [%g7 + UL_SIGMASK + 12], %o4 + SYSTRAP_RVAL1(lwp_sigmask) retl - mov %o3, %o0 /* restore the vfork() return value */ + mov %o5, %o0 /* restore the vfork() return value */ SET_SIZE(vfork) SET_SIZE(vforkx) diff --git a/usr/src/lib/libc/sparcv9/gen/siginfolst.c b/usr/src/lib/libc/sparcv9/gen/siginfolst.c index 712e70c582..17cad14cf6 100644 --- a/usr/src/lib/libc/sparcv9/gen/siginfolst.c +++ b/usr/src/lib/libc/sparcv9/gen/siginfolst.c @@ -20,15 +20,13 @@ */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* Copyright (c) 1988 AT&T */ /* All Rights Reserved */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include "lint.h" #include <signal.h> #include <siginfo.h> @@ -46,11 +44,11 @@ const char *_sys_traplist[NSIGTRAP] = { }; const char *_sys_illlist[NSIGILL] = { - "illegal opcode", + "illegal instruction", "illegal operand", "illegal addressing mode", "illegal trap", - "privileged opcode", + "privileged instruction", "privileged register", "co-processor", "bad stack" @@ -177,6 +175,30 @@ static const struct siginfolist _sys_siginfolist_data[NSIG-1] = { 0, 0, /* SIGRTMIN+1 */ 0, 0, /* SIGRTMIN+2 */ 0, 0, /* SIGRTMIN+3 */ + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, /* SIGRTMIN+15 */ + 0, 0, /* SIGRTMAX-15 */ + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, 0, 0, /* SIGRTMAX-3 */ 0, 0, /* SIGRTMAX-2 */ 0, 0, /* SIGRTMAX-1 */ diff --git a/usr/src/ucbhead/sys/signal.h b/usr/src/ucbhead/sys/signal.h index 71a4e74d8c..1a360605a1 100644 --- a/usr/src/ucbhead/sys/signal.h +++ b/usr/src/ucbhead/sys/signal.h @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,8 +18,9 @@ * * CDDL HEADER END */ + /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -40,8 +40,6 @@ #ifndef _UCB_SYS_SIGNAL_H #define _UCB_SYS_SIGNAL_H -#pragma ident "%Z%%M% %I% %E% SMI" - /* * 4.3BSD signal compatibility header * @@ -160,10 +158,6 @@ typedef struct { /* signal set type */ } sigset_t; #endif /* _SIGSET_T */ -typedef struct { - unsigned int __sigbits[2]; -} k_sigset_t; - struct sigaction { int sa_flags; #if defined(__cplusplus) diff --git a/usr/src/uts/common/brand/lx/procfs/lx_prvnops.c b/usr/src/uts/common/brand/lx/procfs/lx_prvnops.c index 37e66ba807..44ebe7ee69 100644 --- a/usr/src/uts/common/brand/lx/procfs/lx_prvnops.c +++ b/usr/src/uts/common/brand/lx/procfs/lx_prvnops.c @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -938,17 +938,17 @@ lxpr_read_pid_status(lxpr_node_t *lxpnp, lxpr_uiobuf_t *uiobuf) lxpr_uiobuf_printf(uiobuf, "\n" - "SigPnd:\t%08x%08x\n" - "SigBlk:\t%08x%08x\n" - "SigIgn:\t%08x%08x\n" - "SigCgt:\t%08x%08x\n" + "SigPnd:\t%08x%08x%08x\n" + "SigBlk:\t%08x%08x%08x\n" + "SigIgn:\t%08x%08x%08x\n" + "SigCgt:\t%08x%08x%08x\n" "CapInh:\t%016x\n" "CapPrm:\t%016x\n" "CapEff:\t%016x\n", - current.__sigbits[1], current.__sigbits[0], - 0, 0, /* signals blocked on per thread basis */ - ignore.__sigbits[1], ignore.__sigbits[0], - handle.__sigbits[1], handle.__sigbits[0], + current.__sigbits[2], current.__sigbits[1], current.__sigbits[0], + 0, 0, 0, /* signals blocked on per thread basis */ + ignore.__sigbits[2], ignore.__sigbits[1], ignore.__sigbits[0], + handle.__sigbits[2], handle.__sigbits[1], handle.__sigbits[0], /* Can't do anything with linux capabilities */ 0, 0, diff --git a/usr/src/uts/common/brand/solaris10/s10_brand.c b/usr/src/uts/common/brand/solaris10/s10_brand.c index ce25f37c03..0c5dc3eb10 100644 --- a/usr/src/uts/common/brand/solaris10/s10_brand.c +++ b/usr/src/uts/common/brand/solaris10/s10_brand.c @@ -961,6 +961,7 @@ _init(void) s10_emulation_table[S10_SYS_fstat] = 1; /* 28 */ s10_emulation_table[S10_SYS_utime] = 1; /* 30 */ s10_emulation_table[S10_SYS_access] = 1; /* 33 */ + s10_emulation_table[SYS_kill] = 1; /* 37 */ s10_emulation_table[S10_SYS_dup] = 1; /* 41 */ s10_emulation_table[SYS_ioctl] = 1; /* 54 */ s10_emulation_table[SYS_execve] = 1; /* 59 */ @@ -972,6 +973,13 @@ _init(void) s10_emulation_table[S10_SYS_poll] = 1; /* 87 */ s10_emulation_table[S10_SYS_lstat] = 1; /* 88 */ s10_emulation_table[S10_SYS_fchown] = 1; /* 94 */ + s10_emulation_table[SYS_sigprocmask] = 1; /* 95 */ + s10_emulation_table[SYS_sigsuspend] = 1; /* 96 */ + s10_emulation_table[SYS_sigaction] = 1; /* 98 */ + s10_emulation_table[SYS_sigpending] = 1; /* 99 */ + s10_emulation_table[SYS_context] = 1; /* 100 */ + s10_emulation_table[SYS_waitid] = 1; /* 107 */ + s10_emulation_table[SYS_sigsendsys] = 1; /* 108 */ #if defined(__x86) s10_emulation_table[S10_SYS_xstat] = 1; /* 123 */ s10_emulation_table[S10_SYS_lxstat] = 1; /* 124 */ @@ -981,18 +989,23 @@ _init(void) s10_emulation_table[S10_SYS_lchown] = 1; /* 130 */ s10_emulation_table[S10_SYS_rename] = 1; /* 134 */ s10_emulation_table[SYS_uname] = 1; /* 135 */ + s10_emulation_table[SYS_sysconfig] = 1; /* 137 */ s10_emulation_table[SYS_systeminfo] = 1; /* 139 */ s10_emulation_table[S10_SYS_fork1] = 1; /* 143 */ + s10_emulation_table[SYS_sigtimedwait] = 1; /* 144 */ s10_emulation_table[S10_SYS_lwp_sema_wait] = 1; /* 147 */ s10_emulation_table[S10_SYS_utimes] = 1; /* 154 */ -#if defined(__amd64) s10_emulation_table[SYS_lwp_create] = 1; /* 159 */ + s10_emulation_table[SYS_lwp_kill] = 1; /* 163 */ + s10_emulation_table[SYS_lwp_sigmask] = 1; /* 165 */ +#if defined(__amd64) s10_emulation_table[SYS_lwp_private] = 1; /* 166 */ #endif /* __amd64 */ s10_emulation_table[S10_SYS_lwp_mutex_lock] = 1; /* 169 */ s10_emulation_table[SYS_pwrite] = 1; /* 174 */ s10_emulation_table[SYS_auditsys] = 1; /* 186 */ s10_emulation_table[SYS_sigqueue] = 1; /* 190 */ + s10_emulation_table[SYS_signotify] = 1; /* 205 */ s10_emulation_table[SYS_lwp_mutex_timedlock] = 1; /* 210 */ s10_emulation_table[SYS_getdents64] = 1; /* 213 */ s10_emulation_table[S10_SYS_stat64] = 1; /* 215 */ diff --git a/usr/src/uts/common/io/vcons.c b/usr/src/uts/common/io/vcons.c index 93d347de00..bc547a80b1 100644 --- a/usr/src/uts/common/io/vcons.c +++ b/usr/src/uts/common/io/vcons.c @@ -20,7 +20,7 @@ */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -627,7 +627,7 @@ vt_proc_exists(pid_t pid) return (0); } -#define SIG_VALID(x) (((x) > 0) && ((x) < _SIGRTMAX) && \ +#define SIG_VALID(x) (((x) > 0) && ((x) <= MAXSIG) && \ ((x) != SIGKILL) && ((x) != SIGSTOP)) static int diff --git a/usr/src/uts/common/os/main.c b/usr/src/uts/common/os/main.c index 775824df3b..cd12794921 100644 --- a/usr/src/uts/common/os/main.c +++ b/usr/src/uts/common/os/main.c @@ -134,7 +134,6 @@ cluster_wrapper(void) char initname[INITNAME_SZ] = "/sbin/init"; /* also referenced by zone0 */ char initargs[BOOTARGS_MAX] = ""; /* also referenced by zone0 */ -extern int64_t lwp_sigmask(int, uint_t, uint_t); /* * Construct a stack for init containing the arguments to it, then @@ -264,7 +263,7 @@ exec_init(const char *initpath, const char *args) * parent process's signal mask. Clear it now so that we behave in * the same way as when started from the global zone. */ - (void) lwp_sigmask(SIG_UNBLOCK, 0xffffffff, 0xffffffff); + sigemptyset(&curthread->t_hold); brand_action = ZONE_IS_BRANDED(p->p_zone) ? EBA_BRAND : EBA_NONE; again: diff --git a/usr/src/uts/common/os/schedctl.c b/usr/src/uts/common/os/schedctl.c index ed6e74c558..5721083751 100644 --- a/usr/src/uts/common/os/schedctl.c +++ b/usr/src/uts/common/os/schedctl.c @@ -20,7 +20,7 @@ */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -344,6 +344,7 @@ schedctl_finish_sigblock(kthread_t *t) if (tdp != NULL && tdp->sc_sigblock) { t->t_hold.__sigbits[0] = FILLSET0 & ~CANTMASK0; t->t_hold.__sigbits[1] = FILLSET1 & ~CANTMASK1; + t->t_hold.__sigbits[2] = FILLSET2 & ~CANTMASK2; tdp->sc_sigblock = 0; } } diff --git a/usr/src/uts/common/os/sig.c b/usr/src/uts/common/os/sig.c index f22f10063e..4bad31d2cb 100644 --- a/usr/src/uts/common/os/sig.c +++ b/usr/src/uts/common/os/sig.c @@ -60,31 +60,35 @@ #include <sys/dtrace.h> #include <sys/sdt.h> - /* MUST be contiguous */ -k_sigset_t nullsmask = {0, 0}; +const k_sigset_t nullsmask = {0, 0, 0}; -k_sigset_t fillset = {FILLSET0, FILLSET1}; +const k_sigset_t fillset = /* MUST be contiguous */ + {FILLSET0, FILLSET1, FILLSET2}; -k_sigset_t cantmask = {CANTMASK0, CANTMASK1}; +const k_sigset_t cantmask = + {CANTMASK0, CANTMASK1, CANTMASK2}; -k_sigset_t cantreset = {(sigmask(SIGILL)|sigmask(SIGTRAP)|sigmask(SIGPWR)), 0}; +const k_sigset_t cantreset = + {(sigmask(SIGILL)|sigmask(SIGTRAP)|sigmask(SIGPWR)), 0, 0}; -k_sigset_t ignoredefault = {(sigmask(SIGCONT)|sigmask(SIGCLD)|sigmask(SIGPWR) - |sigmask(SIGWINCH)|sigmask(SIGURG)|sigmask(SIGWAITING)), - (sigmask(SIGLWP)|sigmask(SIGCANCEL)|sigmask(SIGFREEZE) - |sigmask(SIGTHAW)|sigmask(SIGXRES)|sigmask(SIGJVM1) - |sigmask(SIGJVM2))}; +const k_sigset_t ignoredefault = + {(sigmask(SIGCONT)|sigmask(SIGCLD)|sigmask(SIGPWR) + |sigmask(SIGWINCH)|sigmask(SIGURG)|sigmask(SIGWAITING)), + (sigmask(SIGLWP)|sigmask(SIGCANCEL)|sigmask(SIGFREEZE) + |sigmask(SIGTHAW)|sigmask(SIGXRES)|sigmask(SIGJVM1) + |sigmask(SIGJVM2)), 0}; -k_sigset_t stopdefault = {(sigmask(SIGSTOP)|sigmask(SIGTSTP) - |sigmask(SIGTTOU)|sigmask(SIGTTIN)), 0}; +const k_sigset_t stopdefault = + {(sigmask(SIGSTOP)|sigmask(SIGTSTP)|sigmask(SIGTTOU)|sigmask(SIGTTIN)), + 0, 0}; -k_sigset_t coredefault = {(sigmask(SIGQUIT)|sigmask(SIGILL)|sigmask(SIGTRAP) - |sigmask(SIGIOT)|sigmask(SIGEMT)|sigmask(SIGFPE) - |sigmask(SIGBUS)|sigmask(SIGSEGV)|sigmask(SIGSYS) - |sigmask(SIGXCPU)|sigmask(SIGXFSZ)), 0}; +const k_sigset_t coredefault = + {(sigmask(SIGQUIT)|sigmask(SIGILL)|sigmask(SIGTRAP)|sigmask(SIGIOT) + |sigmask(SIGEMT)|sigmask(SIGFPE)|sigmask(SIGBUS)|sigmask(SIGSEGV) + |sigmask(SIGSYS)|sigmask(SIGXCPU)|sigmask(SIGXFSZ)), 0, 0}; -k_sigset_t holdvfork = {(sigmask(SIGTTOU)|sigmask(SIGTTIN)|sigmask(SIGTSTP)), - 0}; +const k_sigset_t holdvfork = + {(sigmask(SIGTTOU)|sigmask(SIGTTIN)|sigmask(SIGTSTP)), 0, 0}; static int isjobstop(int); static void post_sigcld(proc_t *, sigqueue_t *); @@ -1403,7 +1407,7 @@ psig(void) if (!sigismember(&PTOU(curproc)->u_signodefer, sig)) sigaddset(&t->t_hold, sig); if (sigismember(&PTOU(curproc)->u_sigresethand, sig)) - setsigact(sig, SIG_DFL, nullsmask, 0); + setsigact(sig, SIG_DFL, &nullsmask, 0); DTRACE_PROC3(signal__handle, int, sig, k_siginfo_t *, sip, void (*)(void), func); @@ -1539,7 +1543,7 @@ fsig(k_sigset_t *ssp, kthread_t *t) } void -setsigact(int sig, void (*disp)(), k_sigset_t mask, int flags) +setsigact(int sig, void (*disp)(), const k_sigset_t *mask, int flags) { proc_t *p = ttoproc(curthread); kthread_t *t; @@ -1562,7 +1566,7 @@ setsigact(int sig, void (*disp)(), k_sigset_t mask, int flags) if (disp != SIG_DFL && disp != SIG_IGN) { sigdelset(&p->p_ignore, sig); - PTOU(curproc)->u_sigmask[sig - 1] = mask; + PTOU(curproc)->u_sigmask[sig - 1] = *mask; if (!sigismember(&cantreset, sig)) { if (flags & SA_RESETHAND) sigaddset(&PTOU(curproc)->u_sigresethand, sig); @@ -2162,24 +2166,27 @@ stop_on_fault(uint_t fault, k_siginfo_t *sip) } void -sigorset(k_sigset_t *s1, k_sigset_t *s2) +sigorset(k_sigset_t *s1, const k_sigset_t *s2) { s1->__sigbits[0] |= s2->__sigbits[0]; s1->__sigbits[1] |= s2->__sigbits[1]; + s1->__sigbits[2] |= s2->__sigbits[2]; } void -sigandset(k_sigset_t *s1, k_sigset_t *s2) +sigandset(k_sigset_t *s1, const k_sigset_t *s2) { s1->__sigbits[0] &= s2->__sigbits[0]; s1->__sigbits[1] &= s2->__sigbits[1]; + s1->__sigbits[2] &= s2->__sigbits[2]; } void -sigdiffset(k_sigset_t *s1, k_sigset_t *s2) +sigdiffset(k_sigset_t *s1, const k_sigset_t *s2) { s1->__sigbits[0] &= ~(s2->__sigbits[0]); s1->__sigbits[1] &= ~(s2->__sigbits[1]); + s1->__sigbits[2] &= ~(s2->__sigbits[2]); } /* @@ -2196,15 +2203,28 @@ sigcheck(proc_t *p, kthread_t *t) /* * If signals are blocked via the schedctl interface * then we only check for the unmaskable signals. + * The unmaskable signal numbers should all be contained + * in __sigbits[0] and we assume this for speed. */ +#if (CANTMASK1 == 0 && CANTMASK2 == 0) if (tdp != NULL && tdp->sc_sigblock) return ((p->p_sig.__sigbits[0] | t->t_sig.__sigbits[0]) & CANTMASK0); +#else +#error "fix me: CANTMASK1 and CANTMASK2 are not zero" +#endif +/* see uts/common/sys/signal.h for why this must be true */ +#if ((MAXSIG > (2 * 32)) && (MAXSIG <= (3 * 32))) return (((p->p_sig.__sigbits[0] | t->t_sig.__sigbits[0]) & ~t->t_hold.__sigbits[0]) | - (((p->p_sig.__sigbits[1] | t->t_sig.__sigbits[1]) & - ~t->t_hold.__sigbits[1]) & FILLSET1)); + ((p->p_sig.__sigbits[1] | t->t_sig.__sigbits[1]) & + ~t->t_hold.__sigbits[1]) | + (((p->p_sig.__sigbits[2] | t->t_sig.__sigbits[2]) & + ~t->t_hold.__sigbits[2]) & FILLSET2)); +#else +#error "fix me: MAXSIG out of bounds" +#endif } /* ONC_PLUS EXTRACT START */ diff --git a/usr/src/uts/common/os/sysent.c b/usr/src/uts/common/os/sysent.c index 44dd747a0b..70160e318d 100644 --- a/usr/src/uts/common/os/sysent.c +++ b/usr/src/uts/common/os/sysent.c @@ -590,7 +590,7 @@ struct sysent sysent[NSYSCALL] = /* 144 */ SYSENT_CI("sigtimedwait", sigtimedwait, 3), /* 145 */ SYSENT_CI("lwp_info", lwp_info, 1), /* 146 */ SYSENT_CI("yield", yield, 0), - /* 147 */ SYSENT_LOADABLE(), /* (was lwp_sema_wait) */ + /* 147 */ SYSENT_LOADABLE(), /* (was lwp_sema_wait) */ /* 148 */ SYSENT_CI("lwp_sema_post", lwp_sema_post, 1), /* 149 */ SYSENT_CI("lwp_sema_trywait", lwp_sema_trywait, 1), /* 150 */ SYSENT_CI("lwp_detach", lwp_detach, 1), @@ -608,7 +608,7 @@ struct sysent sysent[NSYSCALL] = /* 162 */ SYSENT_CI("lwp_continue", syslwp_continue, 1), /* 163 */ SYSENT_CI("lwp_kill", lwp_kill, 2), /* 164 */ SYSENT_CI("lwp_self", lwp_self, 0), - /* 165 */ SYSENT_2CI("lwp_sigmask", lwp_sigmask, 3), + /* 165 */ SYSENT_2CI("lwp_sigmask", lwp_sigmask, 5), /* 166 */ IF_x86( SYSENT_CI("lwp_private", syslwp_private, 3), SYSENT_NOSYS()), @@ -952,7 +952,7 @@ struct sysent sysent32[NSYSCALL] = /* 144 */ SYSENT_CI("sigtimedwait", sigtimedwait, 3), /* 145 */ SYSENT_CI("lwp_info", lwp_info, 1), /* 146 */ SYSENT_CI("yield", yield, 0), - /* 147 */ SYSENT_LOADABLE32(), /* (was lwp_sema_wait) */ + /* 147 */ SYSENT_LOADABLE32(), /* (was lwp_sema_wait) */ /* 148 */ SYSENT_CI("lwp_sema_post", lwp_sema_post, 1), /* 149 */ SYSENT_CI("lwp_sema_trywait", lwp_sema_trywait, 1), /* 150 */ SYSENT_CI("lwp_detach", lwp_detach, 1), @@ -970,13 +970,13 @@ struct sysent sysent32[NSYSCALL] = /* 162 */ SYSENT_CI("lwp_continue", syslwp_continue, 1), /* 163 */ SYSENT_CI("lwp_kill", lwp_kill, 2), /* 164 */ SYSENT_CI("lwp_self", lwp_self, 0), - /* 165 */ SYSENT_2CI("lwp_sigmask", lwp_sigmask, 3), + /* 165 */ SYSENT_2CI("lwp_sigmask", lwp_sigmask, 5), /* 166 */ IF_x86( SYSENT_CI("lwp_private", syslwp_private, 3), SYSENT_NOSYS()), /* 167 */ SYSENT_CI("lwp_wait", lwp_wait, 2), /* 168 */ SYSENT_CI("lwp_mutex_wakeup", lwp_mutex_wakeup, 2), - /* 169 */ SYSENT_LOADABLE32(), /* (was lwp_mutex_lock) */ + /* 169 */ SYSENT_LOADABLE32(), /* (was lwp_mutex_lock) */ /* 170 */ SYSENT_CI("lwp_cond_wait", lwp_cond_wait, 4), /* 171 */ SYSENT_CI("lwp_cond_signal", lwp_cond_signal, 1), /* 172 */ SYSENT_CI("lwp_cond_broadcast", lwp_cond_broadcast, 1), diff --git a/usr/src/uts/common/sys/iso/signal_iso.h b/usr/src/uts/common/sys/iso/signal_iso.h index 1222e85ea0..0d23dceec3 100644 --- a/usr/src/uts/common/sys/iso/signal_iso.h +++ b/usr/src/uts/common/sys/iso/signal_iso.h @@ -20,7 +20,7 @@ */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -94,7 +94,7 @@ extern "C" { /* insert new signals here, and move _SIGRTM* appropriately */ #define _SIGRTMIN 41 /* first (highest-priority) realtime signal */ -#define _SIGRTMAX 48 /* last (lowest-priority) realtime signal */ +#define _SIGRTMAX 72 /* last (lowest-priority) realtime signal */ extern long _sysconf(int); /* System Private interface to sysconf() */ #define SIGRTMIN ((int)_sysconf(_SC_SIGRT_MIN)) /* first realtime signal */ #define SIGRTMAX ((int)_sysconf(_SC_SIGRT_MAX)) /* last realtime signal */ diff --git a/usr/src/uts/common/sys/proc.h b/usr/src/uts/common/sys/proc.h index b419f8235f..9edf599552 100644 --- a/usr/src/uts/common/sys/proc.h +++ b/usr/src/uts/common/sys/proc.h @@ -272,11 +272,6 @@ typedef struct proc { struct prof p_prof; /* profile arguments */ /* - * The user structure - */ - struct user p_user; /* (see sys/user.h) */ - - /* * Doors. */ door_pool_t p_server_threads; /* common thread pool */ @@ -361,6 +356,11 @@ typedef struct proc { rctl_qty_t p_crypto_mem; /* /dev/crypto memory charged to proc */ /* protected by p_lock */ clock_t p_ttime; /* buffered task time */ + + /* + * The user structure + */ + struct user p_user; /* (see sys/user.h) */ } proc_t; #define PROC_T /* headers relying on proc_t are OK */ diff --git a/usr/src/uts/common/sys/select.h b/usr/src/uts/common/sys/select.h index 720430be8c..5a8c266761 100644 --- a/usr/src/uts/common/sys/select.h +++ b/usr/src/uts/common/sys/select.h @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,8 +18,9 @@ * * CDDL HEADER END */ + /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -40,8 +40,6 @@ #ifndef _SYS_SELECT_H #define _SYS_SELECT_H -#pragma ident "%Z%%M% %I% %E% SMI" - #include <sys/feature_tests.h> #ifndef _KERNEL @@ -72,16 +70,6 @@ extern "C" { typedef struct { /* signal set type */ unsigned int __sigbits[4]; } sigset_t; - -#if defined(_SYSCALL32) - -/* Kernel view of the ILP32 user sigset_t structure */ - -typedef struct { - uint32_t __sigbits[4]; -} sigset32_t; - -#endif /* _SYSCALL32 */ #endif /* _SIGSET_T */ #endif /* #if !defined(__XOPEN_OR_POSIX) || defined(_XPG6) ... */ diff --git a/usr/src/uts/common/sys/signal.h b/usr/src/uts/common/sys/signal.h index ad9c1b93fc..68788152d0 100644 --- a/usr/src/uts/common/sys/signal.h +++ b/usr/src/uts/common/sys/signal.h @@ -20,7 +20,7 @@ */ /* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -40,8 +40,6 @@ #ifndef _SYS_SIGNAL_H #define _SYS_SIGNAL_H -#pragma ident "%Z%%M% %I% %E% SMI" - #include <sys/feature_tests.h> #include <sys/iso/signal_iso.h> @@ -67,21 +65,10 @@ extern "C" { typedef struct { /* signal set type */ unsigned int __sigbits[4]; } sigset_t; - -#if defined(_SYSCALL32) - -/* Kernel view of the ILP32 user sigset_t structure */ - -typedef struct { - uint32_t __sigbits[4]; -} sigset32_t; - -#endif /* _SYSCALL32 */ - #endif /* _SIGSET_T */ typedef struct { - unsigned int __sigbits[2]; + unsigned int __sigbits[3]; } k_sigset_t; /* @@ -130,7 +117,7 @@ struct sigaction32 { caddr32_t _handler; caddr32_t _sigaction; } _funcptr; - sigset32_t sa_mask; + sigset_t sa_mask; int32_t sa_resv[2]; }; @@ -171,8 +158,8 @@ struct sigaction32 { * use of these symbols by applications is injurious * to binary compatibility */ -#define NSIG 49 /* valid signals range from 1 to NSIG-1 */ -#define MAXSIG 48 /* size of u_signal[], NSIG-1 <= MAXSIG */ +#define NSIG 73 /* valid signals range from 1 to NSIG-1 */ +#define MAXSIG 72 /* size of u_signal[], NSIG-1 <= MAXSIG */ #endif /* defined(__EXTENSIONS__) || !defined(_XPG4_2) */ #define MINSIGSTKSZ 2048 @@ -261,42 +248,45 @@ struct sigstack { #ifdef _KERNEL #include <sys/t_lock.h> -extern k_sigset_t - nullsmask, /* a null signal mask */ - fillset, /* valid signals, guaranteed contiguous */ - holdvfork, /* held while doing vfork */ - cantmask, /* cannot be caught or ignored */ - cantreset, /* cannot be reset after catching */ - ignoredefault, /* ignored by default */ - stopdefault, /* stop by default */ - coredefault; /* dumps core by default */ +extern const k_sigset_t nullsmask; /* a null signal mask */ +extern const k_sigset_t fillset; /* all signals, guaranteed contiguous */ +extern const k_sigset_t cantmask; /* cannot be caught or ignored */ +extern const k_sigset_t cantreset; /* cannot be reset after catching */ +extern const k_sigset_t ignoredefault; /* ignored by default */ +extern const k_sigset_t stopdefault; /* stop by default */ +extern const k_sigset_t coredefault; /* dumps core by default */ +extern const k_sigset_t holdvfork; /* held while doing vfork */ #define sigmask(n) ((unsigned int)1 << (((n) - 1) & (32 - 1))) #define sigword(n) (((unsigned int)((n) - 1))>>5) -#if ((MAXSIG > 32) && (MAXSIG <= 64)) +#if ((MAXSIG > (2 * 32)) && (MAXSIG <= (3 * 32))) #define FILLSET0 0xffffffffu -#define FILLSET1 ((1u << (MAXSIG - 32)) - 1) +#define FILLSET1 0xffffffffu +#define FILLSET2 ((1u << (MAXSIG - 64)) - 1) #else #error "fix me: MAXSIG out of bounds" #endif #define CANTMASK0 (sigmask(SIGKILL)|sigmask(SIGSTOP)) #define CANTMASK1 0 +#define CANTMASK2 0 #define sigemptyset(s) (*(s) = nullsmask) #define sigfillset(s) (*(s) = fillset) #define sigaddset(s, n) ((s)->__sigbits[sigword(n)] |= sigmask(n)) #define sigdelset(s, n) ((s)->__sigbits[sigword(n)] &= ~sigmask(n)) #define sigismember(s, n) (sigmask(n) & (s)->__sigbits[sigword(n)]) -#define sigisempty(s) (!(((s)->__sigbits[0]) | ((s)->__sigbits[1]))) +#define sigisempty(s) (!((s)->__sigbits[0] | (s)->__sigbits[1] | \ + (s)->__sigbits[2])) #define sigutok(us, ks) \ ((ks)->__sigbits[0] = (us)->__sigbits[0] & (FILLSET0 & ~CANTMASK0), \ - (ks)->__sigbits[1] = (us)->__sigbits[1] & (FILLSET1 & ~CANTMASK1)) + (ks)->__sigbits[1] = (us)->__sigbits[1] & (FILLSET1 & ~CANTMASK1), \ + (ks)->__sigbits[2] = (us)->__sigbits[2] & (FILLSET2 & ~CANTMASK2)) #define sigktou(ks, us) ((us)->__sigbits[0] = (ks)->__sigbits[0], \ - (us)->__sigbits[1] = (ks)->__sigbits[1], \ - (us)->__sigbits[2] = 0, \ - (us)->__sigbits[3] = 0) + (us)->__sigbits[1] = (ks)->__sigbits[1], \ + (us)->__sigbits[2] = (ks)->__sigbits[2], \ + (us)->__sigbits[3] = 0) typedef struct { int sig; /* signal no. */ int perm; /* flag for EPERM */ @@ -325,10 +315,10 @@ typedef struct sigqhdr { /* sigqueue pool header */ #define _SIGQUEUE_MAX 32 #define _SIGNOTIFY_MAX 32 -extern void setsigact(int, void (*)(int), k_sigset_t, int); -extern void sigorset(k_sigset_t *, k_sigset_t *); -extern void sigandset(k_sigset_t *, k_sigset_t *); -extern void sigdiffset(k_sigset_t *, k_sigset_t *); +extern void setsigact(int, void (*)(int), const k_sigset_t *, int); +extern void sigorset(k_sigset_t *, const k_sigset_t *); +extern void sigandset(k_sigset_t *, const k_sigset_t *); +extern void sigdiffset(k_sigset_t *, const k_sigset_t *); extern void sigintr(k_sigset_t *, int); extern void sigunintr(k_sigset_t *); extern void sigreplace(k_sigset_t *, k_sigset_t *); diff --git a/usr/src/uts/common/syscall/sigaction.c b/usr/src/uts/common/syscall/sigaction.c index 9823892489..5bbc984928 100644 --- a/usr/src/uts/common/syscall/sigaction.c +++ b/usr/src/uts/common/syscall/sigaction.c @@ -20,7 +20,7 @@ */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -115,7 +115,7 @@ sigaction(int sig, struct sigaction *actp, struct sigaction *oactp) if (sig == SIGCLD) sigcld_look = 1; sigutok(&act.sa_mask, &set); - setsigact(sig, act.sa_handler, set, act.sa_flags); + setsigact(sig, act.sa_handler, &set, act.sa_flags); } mutex_exit(&p->p_lock); @@ -208,7 +208,7 @@ sigaction32(int sig, struct sigaction32 *actp, struct sigaction32 *oactp) if (sig == SIGCLD) sigcld_look = 1; sigutok(&act32.sa_mask, &set); - setsigact(sig, (void (*)())(uintptr_t)act32.sa_handler, set, + setsigact(sig, (void (*)())(uintptr_t)act32.sa_handler, &set, act32.sa_flags); } diff --git a/usr/src/uts/common/syscall/sigprocmask.c b/usr/src/uts/common/syscall/sigprocmask.c index 51afc4e643..c98580655b 100644 --- a/usr/src/uts/common/syscall/sigprocmask.c +++ b/usr/src/uts/common/syscall/sigprocmask.c @@ -20,7 +20,7 @@ */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -37,8 +37,9 @@ #include <sys/schedctl.h> #include <sys/debug.h> +/* ARGSUSED4 */ int64_t -lwp_sigmask(int how, uint_t bits0, uint_t bits1) +lwp_sigmask(int how, uint_t bits0, uint_t bits1, uint_t bits2, uint_t bits3) { kthread_t *t = curthread; proc_t *p = ttoproc(t); @@ -53,7 +54,13 @@ lwp_sigmask(int how, uint_t bits0, uint_t bits1) bits0 &= (FILLSET0 & ~CANTMASK0); bits1 &= (FILLSET1 & ~CANTMASK1); + bits2 &= (FILLSET2 & ~CANTMASK2); + /* + * As a sop to the s10 brand, we continue to return + * the first two words of the signal mask, regardless + * of the value of 'how', even though libc doesn't use them. + */ rv.r_val1 = t->t_hold.__sigbits[0]; rv.r_val2 = t->t_hold.__sigbits[1]; @@ -61,16 +68,19 @@ lwp_sigmask(int how, uint_t bits0, uint_t bits1) case SIG_BLOCK: t->t_hold.__sigbits[0] |= bits0; t->t_hold.__sigbits[1] |= bits1; + t->t_hold.__sigbits[2] |= bits2; break; case SIG_UNBLOCK: t->t_hold.__sigbits[0] &= ~bits0; t->t_hold.__sigbits[1] &= ~bits1; + t->t_hold.__sigbits[2] &= ~bits2; if (sigcheck(p, t)) t->t_sig_check = 1; break; case SIG_SETMASK: t->t_hold.__sigbits[0] = bits0; t->t_hold.__sigbits[1] = bits1; + t->t_hold.__sigbits[2] = bits2; if (sigcheck(p, t)) t->t_sig_check = 1; break; @@ -79,21 +89,16 @@ lwp_sigmask(int how, uint_t bits0, uint_t bits1) return (rv.r_vals); } -/* - * This system call is no longer called from libc. - * It exists solely for the benefit of statically-linked - * binaries from the past. It should be eliminated. - */ int sigprocmask(int how, sigset_t *setp, sigset_t *osetp) { sigset_t set; + sigset_t oset; k_sigset_t kset; - rval_t rv; /* - * User's oset and set might be the same address, so copyin first and - * save before copying out. + * User's osetp and setp might be the same address, + * so copyin first and save before copying out. */ if (setp) { switch (how) { @@ -107,21 +112,21 @@ sigprocmask(int how, sigset_t *setp, sigset_t *osetp) if (copyin((caddr_t)setp, (caddr_t)&set, sizeof (sigset_t))) return (set_errno(EFAULT)); sigutok(&set, &kset); - } else { - /* none of SIG_BLOCK, SIG_UNBLOCK, SIG_SETMASK equals 0 */ - how = 0; - sigemptyset(&kset); } - rv.r_vals = lwp_sigmask(how, kset.__sigbits[0], kset.__sigbits[1]); - if (osetp) { - kset.__sigbits[0] = rv.r_val1; - kset.__sigbits[1] = rv.r_val2; - sigktou(&kset, &set); - if (copyout((caddr_t)&set, (caddr_t)osetp, sizeof (sigset_t))) + sigktou(&curthread->t_hold, &oset); + if (copyout((caddr_t)&oset, (caddr_t)osetp, sizeof (sigset_t))) return (set_errno(EFAULT)); } + if (setp) { + (void) lwp_sigmask(how, + kset.__sigbits[0], + kset.__sigbits[1], + kset.__sigbits[2], + 0); + } + return (0); } diff --git a/usr/src/uts/intel/ia32/os/sendsig.c b/usr/src/uts/intel/ia32/os/sendsig.c index 0742566ade..979c9e3294 100644 --- a/usr/src/uts/intel/ia32/os/sendsig.c +++ b/usr/src/uts/intel/ia32/os/sendsig.c @@ -20,7 +20,7 @@ */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -288,7 +288,7 @@ sendsig(int sig, k_siginfo_t *sip, void (*hdlr)()) */ uc = (ucontext_t *)(sp + sizeof (struct sigframe)); tuc = kmem_alloc(sizeof (*tuc), KM_SLEEP); - savecontext(tuc, lwp->lwp_sigoldmask); + savecontext(tuc, &lwp->lwp_sigoldmask); copyout_noerr(tuc, uc, sizeof (*tuc)); kmem_free(tuc, sizeof (*tuc)); tuc = NULL; @@ -506,7 +506,7 @@ sendsig32(int sig, k_siginfo_t *sip, void (*hdlr)()) fp -= SA32(sizeof (*tuc)); uc = (ucontext32_t *)fp; tuc = kmem_alloc(sizeof (*tuc), KM_SLEEP); - savecontext32(tuc, lwp->lwp_sigoldmask); + savecontext32(tuc, &lwp->lwp_sigoldmask); copyout_noerr(tuc, uc, sizeof (*tuc)); kmem_free(tuc, sizeof (*tuc)); tuc = NULL; @@ -726,7 +726,7 @@ sendsig(int sig, k_siginfo_t *sip, void (*hdlr)()) fp -= SA(sizeof (*tuc)); uc = (ucontext_t *)fp; tuc = kmem_alloc(sizeof (*tuc), KM_SLEEP); - savecontext(tuc, lwp->lwp_sigoldmask); + savecontext(tuc, &lwp->lwp_sigoldmask); copyout_noerr(tuc, uc, sizeof (*tuc)); kmem_free(tuc, sizeof (*tuc)); tuc = NULL; diff --git a/usr/src/uts/intel/ia32/syscall/getcontext.c b/usr/src/uts/intel/ia32/syscall/getcontext.c index 972a90fdf5..ad0794f683 100644 --- a/usr/src/uts/intel/ia32/syscall/getcontext.c +++ b/usr/src/uts/intel/ia32/syscall/getcontext.c @@ -20,7 +20,7 @@ */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -50,7 +50,7 @@ * Save user context. */ void -savecontext(ucontext_t *ucp, k_sigset_t mask) +savecontext(ucontext_t *ucp, const k_sigset_t *mask) { proc_t *p = ttoproc(curthread); klwp_t *lwp = ttolwp(curthread); @@ -124,7 +124,7 @@ savecontext(ucontext_t *ucp, k_sigset_t mask) else ucp->uc_flags &= ~UC_FPU; - sigktou(&mask, &ucp->uc_sigmask); + sigktou(mask, &ucp->uc_sigmask); } /* @@ -198,7 +198,7 @@ getsetcontext(int flag, void *arg) case GETCONTEXT: schedctl_finish_sigblock(curthread); - savecontext(&uc, curthread->t_hold); + savecontext(&uc, &curthread->t_hold); if (copyout(&uc, arg, sizeof (uc))) return (set_errno(EFAULT)); return (0); @@ -249,7 +249,7 @@ getsetcontext(int flag, void *arg) * Save user context for 32-bit processes. */ void -savecontext32(ucontext32_t *ucp, k_sigset_t mask) +savecontext32(ucontext32_t *ucp, const k_sigset_t *mask) { proc_t *p = ttoproc(curthread); klwp_t *lwp = ttolwp(curthread); @@ -306,7 +306,7 @@ savecontext32(ucontext32_t *ucp, k_sigset_t mask) else ucp->uc_flags &= ~UC_FPU; - sigktou(&mask, &ucp->uc_sigmask); + sigktou(mask, &ucp->uc_sigmask); } int @@ -325,7 +325,7 @@ getsetcontext32(int flag, void *arg) case GETCONTEXT: schedctl_finish_sigblock(curthread); - savecontext32(&uc, curthread->t_hold); + savecontext32(&uc, &curthread->t_hold); if (copyout(&uc, arg, sizeof (uc))) return (set_errno(EFAULT)); return (0); diff --git a/usr/src/uts/intel/sys/ucontext.h b/usr/src/uts/intel/sys/ucontext.h index ae6fae16de..acd6ddc99e 100644 --- a/usr/src/uts/intel/sys/ucontext.h +++ b/usr/src/uts/intel/sys/ucontext.h @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,20 +18,18 @@ * * CDDL HEADER END */ -/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ -/* All Rights Reserved */ - /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + #ifndef _SYS_UCONTEXT_H #define _SYS_UCONTEXT_H -#pragma ident "%Z%%M% %I% %E% SMI" - #include <sys/feature_tests.h> #include <sys/types.h> @@ -95,7 +92,7 @@ struct __ucontext { typedef struct ucontext32 { uint32_t uc_flags; caddr32_t uc_link; - sigset32_t uc_sigmask; + sigset_t uc_sigmask; stack32_t uc_stack; mcontext32_t uc_mcontext; int32_t uc_filler[5]; @@ -137,11 +134,11 @@ extern void ucontext_32ton(const ucontext32_t *src, ucontext_t *dest); #endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */ #ifdef _KERNEL -void savecontext(ucontext_t *, k_sigset_t); +void savecontext(ucontext_t *, const k_sigset_t *); void restorecontext(ucontext_t *); #ifdef _SYSCALL32 -extern void savecontext32(ucontext32_t *ucp, k_sigset_t mask); +extern void savecontext32(ucontext32_t *, const k_sigset_t *); #endif #endif diff --git a/usr/src/uts/sparc/sys/ucontext.h b/usr/src/uts/sparc/sys/ucontext.h index ded11fdb95..e0cfea55bd 100644 --- a/usr/src/uts/sparc/sys/ucontext.h +++ b/usr/src/uts/sparc/sys/ucontext.h @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,20 +18,18 @@ * * CDDL HEADER END */ -/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ -/* All Rights Reserved */ - /* - * Copyright 2003 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + #ifndef _SYS_UCONTEXT_H #define _SYS_UCONTEXT_H -#pragma ident "%Z%%M% %I% %E% SMI" /* from SVr4.0 1.10 */ - #include <sys/feature_tests.h> #include <sys/types.h> @@ -100,7 +97,7 @@ struct __ucontext { typedef struct ucontext32 { uint32_t uc_flags; caddr32_t uc_link; - sigset32_t uc_sigmask; + sigset_t uc_sigmask; stack32_t uc_stack; mcontext32_t uc_mcontext; int32_t uc_filler[23]; @@ -145,11 +142,11 @@ extern void fpuregset_nto32(const fpregset_t *, fpregset32_t *, struct fq32 *); #endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */ #ifdef _KERNEL -extern void savecontext(ucontext_t *, k_sigset_t); +extern void savecontext(ucontext_t *, const k_sigset_t *); extern void restorecontext(ucontext_t *); #ifdef _SYSCALL32 -extern void savecontext32(ucontext32_t *, k_sigset_t, struct fq32 *); +extern void savecontext32(ucontext32_t *, const k_sigset_t *, struct fq32 *); #endif #endif diff --git a/usr/src/uts/sparc/syscall/getcontext.c b/usr/src/uts/sparc/syscall/getcontext.c index 144971af01..433c29fa9c 100644 --- a/usr/src/uts/sparc/syscall/getcontext.c +++ b/usr/src/uts/sparc/syscall/getcontext.c @@ -20,7 +20,7 @@ */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -53,7 +53,7 @@ * Save user context. */ void -savecontext(ucontext_t *ucp, k_sigset_t mask) +savecontext(ucontext_t *ucp, const k_sigset_t *mask) { proc_t *p = ttoproc(curthread); klwp_t *lwp = ttolwp(curthread); @@ -112,7 +112,7 @@ savecontext(ucontext_t *ucp, k_sigset_t mask) /* * Save signal mask. */ - sigktou(&mask, &ucp->uc_sigmask); + sigktou(mask, &ucp->uc_sigmask); } @@ -199,7 +199,7 @@ getsetcontext(int flag, void *arg) case GETCONTEXT: schedctl_finish_sigblock(curthread); - savecontext(&uc, curthread->t_hold); + savecontext(&uc, &curthread->t_hold); /* * When using floating point it should not be possible to * get here with a fpu_qcnt other than zero since we go @@ -346,7 +346,7 @@ getsetcontext(int flag, void *arg) * Save user context for 32-bit processes. */ void -savecontext32(ucontext32_t *ucp, k_sigset_t mask, struct fq32 *dfq) +savecontext32(ucontext32_t *ucp, const k_sigset_t *mask, struct fq32 *dfq) { proc_t *p = ttoproc(curthread); klwp_t *lwp = ttolwp(curthread); @@ -411,7 +411,7 @@ savecontext32(ucontext32_t *ucp, k_sigset_t mask, struct fq32 *dfq) * Save signal mask (the 32- and 64-bit sigset_t structures are * identical). */ - sigktou(&mask, (sigset_t *)&ucp->uc_sigmask); + sigktou(mask, (sigset_t *)&ucp->uc_sigmask); } int @@ -445,7 +445,7 @@ getsetcontext32(int flag, void *arg) case GETCONTEXT: schedctl_finish_sigblock(curthread); - savecontext32(&uc, curthread->t_hold, NULL); + savecontext32(&uc, &curthread->t_hold, NULL); /* * When using floating point it should not be possible to * get here with a fpu_qcnt other than zero since we go diff --git a/usr/src/uts/sparc/v9/os/v9dep.c b/usr/src/uts/sparc/v9/os/v9dep.c index 6ee76d4c8a..751837788e 100644 --- a/usr/src/uts/sparc/v9/os/v9dep.c +++ b/usr/src/uts/sparc/v9/os/v9dep.c @@ -1021,7 +1021,7 @@ sendsig(int sig, k_siginfo_t *sip, void (*hdlr)()) goto badstack; tuc = kmem_alloc(sizeof (ucontext_t), KM_SLEEP); - savecontext(tuc, lwp->lwp_sigoldmask); + savecontext(tuc, &lwp->lwp_sigoldmask); /* * save extra register state if it exists @@ -1351,7 +1351,7 @@ sendsig32(int sig, k_siginfo_t *sip, void (*hdlr)()) goto badstack; tuc = kmem_alloc(sizeof (ucontext32_t), KM_SLEEP); - savecontext32(tuc, lwp->lwp_sigoldmask, dfq); + savecontext32(tuc, &lwp->lwp_sigoldmask, dfq); /* * save extra register state if it exists |
