diff options
author | Andy Fiddaman <illumos@fiddaman.net> | 2022-11-24 13:59:08 +0000 |
---|---|---|
committer | Andy Fiddaman <illumos@fiddaman.net> | 2022-12-07 10:06:14 +0000 |
commit | 3f3c90a958c5abf8ec0ed5d1fad2e40bd9905a50 (patch) | |
tree | 8c1cbe5bd3a1fa5eb83b439327432994f0c86955 /usr/src/lib | |
parent | 7f5d80fd842f21a48514cca6718c3bbdaf592316 (diff) | |
download | illumos-joyent-3f3c90a958c5abf8ec0ed5d1fad2e40bd9905a50.tar.gz |
15206 setcontext(2) should not restore %fsbase
Reviewed by: Robert Mustacchi <rm+illumos@fingolfin.org>
Reviewed by: Toomas Soome <tsoome@me.com>
Approved by: Patrick Mooney <pmooney@pfmooney.com>
Diffstat (limited to 'usr/src/lib')
-rw-r--r-- | usr/src/lib/libc/port/threads/sigaction.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/usr/src/lib/libc/port/threads/sigaction.c b/usr/src/lib/libc/port/threads/sigaction.c index 571e211f97..1417c1e18a 100644 --- a/usr/src/lib/libc/port/threads/sigaction.c +++ b/usr/src/lib/libc/port/threads/sigaction.c @@ -24,6 +24,10 @@ * Use is subject to license terms. */ +/* + * Copyright 2022 OmniOS Community Edition (OmniOSce) Association. + */ + #include "lint.h" #include <sys/feature_tests.h> /* @@ -563,7 +567,13 @@ setcontext(const ucontext_t *ucp) #if defined(__sparc) uc.uc_mcontext.gregs[REG_G7] = (greg_t)self; #elif defined(__amd64) - uc.uc_mcontext.gregs[REG_FS] = (greg_t)0; /* null for fsbase */ + /* + * 64-bit processes must have a selector value of zero for %fs + * in order to use the 64-bit fs_base (the full 64-bit address + * range cannot be expressed in a long mode descriptor). + */ + uc.uc_mcontext.gregs[REG_FS] = (greg_t)0; + uc.uc_mcontext.gregs[REG_FSBASE] = (greg_t)self; #elif defined(__i386) uc.uc_mcontext.gregs[GS] = (greg_t)LWPGS_SEL; #else |