diff options
author | nn35248 <none@none> | 2006-09-11 22:51:59 -0700 |
---|---|---|
committer | nn35248 <none@none> | 2006-09-11 22:51:59 -0700 |
commit | 9acbbeaf2a1ffe5c14b244867d427714fab43c5c (patch) | |
tree | d1ecd54896325c19a463220e9cbc50864874fc82 /usr/src/lib/libc/port/threads/sigaction.c | |
parent | da51466dc253d7c98dda4956059042bd0c476328 (diff) | |
download | illumos-joyent-9acbbeaf2a1ffe5c14b244867d427714fab43c5c.tar.gz |
PSARC/2005/471 BrandZ: Support for non-native zones
6374606 ::nm -D without an object may not work on processes in zones
6409350 BrandZ project integration into Solaris
6455289 pthread_setschedparam() should return EPERM rather than panic libc
6455591 setpriority(3C) gets errno wrong for deficient privileges failure
6458178 fifofs doesn't support lofs mounts of fifos
6460380 Attempted open() of a symlink with the O_NOFOLLOW flag set returns EINVAL, not ELOOP
6463857 renice(1) errors erroneously
--HG--
rename : usr/src/lib/libzonecfg/zones/SUNWblank.xml => usr/src/lib/brand/native/zone/SUNWblank.xml
rename : usr/src/lib/libzonecfg/zones/SUNWdefault.xml => usr/src/lib/brand/native/zone/SUNWdefault.xml
Diffstat (limited to 'usr/src/lib/libc/port/threads/sigaction.c')
-rw-r--r-- | usr/src/lib/libc/port/threads/sigaction.c | 49 |
1 files changed, 44 insertions, 5 deletions
diff --git a/usr/src/lib/libc/port/threads/sigaction.c b/usr/src/lib/libc/port/threads/sigaction.c index 101b730af3..5f65435999 100644 --- a/usr/src/lib/libc/port/threads/sigaction.c +++ b/usr/src/lib/libc/port/threads/sigaction.c @@ -306,9 +306,10 @@ sigacthandler(int sig, siginfo_t *sip, void *uvp) thr_panic("sigacthandler(): __setcontext() returned"); } -#pragma weak sigaction = _sigaction +#pragma weak sigaction = _libc_sigaction +#pragma weak _sigaction = _libc_sigaction int -_sigaction(int sig, const struct sigaction *nact, struct sigaction *oact) +_libc_sigaction(int sig, const struct sigaction *nact, struct sigaction *oact) { ulwp_t *self = curthread; uberdata_t *udp = self->ul_uberdata; @@ -404,6 +405,19 @@ _sigaction(int sig, const struct sigaction *nact, struct sigaction *oact) return (rv); } +void +setsigacthandler(void (*nsigacthandler)(int, siginfo_t *, void *), + void (**osigacthandler)(int, siginfo_t *, void *)) +{ + ulwp_t *self = curthread; + uberdata_t *udp = self->ul_uberdata; + + if (osigacthandler != NULL) + *osigacthandler = udp->sigacthandler; + + udp->sigacthandler = nsigacthandler; +} + /* * Calling set_parking_flag(curthread, 1) informs the kernel that we are * calling __lwp_park or ___lwp_cond_wait(). If we take a signal in @@ -451,6 +465,25 @@ block_all_signals(ulwp_t *self) exit_critical(self); } +/* + * _private_setcontext has code that forcibly restores the curthread + * pointer in a context passed to the setcontext(2) syscall. + * + * Certain processes may need to disable this feature, so these routines + * provide the mechanism to do so. + * + * (As an example, branded 32-bit x86 processes may use %gs for their own + * purposes, so they need to be able to specify a %gs value to be restored + * on return from a signal handler via the passed ucontext_t.) + */ +static int setcontext_enforcement = 1; + +void +set_setcontext_enforcement(int on) +{ + setcontext_enforcement = on; +} + #pragma weak setcontext = _private_setcontext #pragma weak _setcontext = _private_setcontext int @@ -490,16 +523,22 @@ _private_setcontext(const ucontext_t *ucp) /* * We don't know where this context structure has been. * Preserve the curthread pointer, at least. + * + * Allow this feature to be disabled if a particular process + * requests it. */ + if (setcontext_enforcement) { #if defined(__sparc) - uc.uc_mcontext.gregs[REG_G7] = (greg_t)self; + uc.uc_mcontext.gregs[REG_G7] = (greg_t)self; #elif defined(__amd64) - uc.uc_mcontext.gregs[REG_FS] = (greg_t)self->ul_gs; + uc.uc_mcontext.gregs[REG_FS] = (greg_t)self->ul_gs; #elif defined(__i386) - uc.uc_mcontext.gregs[GS] = (greg_t)self->ul_gs; + uc.uc_mcontext.gregs[GS] = (greg_t)self->ul_gs; #else #error "none of __sparc, __amd64, __i386 defined" #endif + } + /* * Make sure that if we return to a call to __lwp_park() * or ___lwp_cond_wait() that it returns right away |