opnsense-src/sys
Konstantin Belousov 3e902b3d76 Make WRFSBASE and WRGSBASE instructions functional.
Right now, we enable the CR4.FSGSBASE bit on CPUs which support the
facility (Ivy and later), to allow usermode to read fs and gs bases
without syscalls. This bit also controls the write access to bases
from userspace, but WRFSBASE and WRGSBASE instructions currently
cannot be used, because return path from both exceptions or interrupts
overrides bases with the values from pcb.

Supporting the instructions is useful because this means that usermode
can implement green-threads completely in userspace without issuing
syscalls to change all of the machine context.

Support is implemented by saving the fs base and user gs base when
PCB_FULL_IRET flag is set. The flag is set on the context switch,
which potentially causes clobber of the bases due to activation of
another context, and when explicit modification of the user context by
a syscall or exception handler is performed. In particular, the patch
moves setting of the flag before syscalls change context.

The changes to doreti_exit and PUSH_FRAME to clear PCB_FULL_IRET on
entry from userspace can be considered a bug fixes on its own.

Reviewed by:	jhb (previous version)
Tested by:	pho (previous version)
Sponsored by:	The FreeBSD Foundation
MFC after:	3 weeks
Differential revision:	https://reviews.freebsd.org/D12023
2017-08-21 17:38:02 +00:00
..
amd64 Make WRFSBASE and WRGSBASE instructions functional. 2017-08-21 17:38:02 +00:00
arm Use better hard-coded defaults for the cursor shape, and remove nearby 2017-08-19 19:33:16 +00:00
arm64 Rename mkdumpheader() and group EKCD functions in kern_shutdown.c. 2017-08-18 04:04:09 +00:00
boot RPI DTS: Add value previously set by VideoCore and DTB links 2017-08-19 14:27:11 +00:00
bsm Commit the 64-bit inode project. 2017-05-23 09:29:05 +00:00
cam cam iosched: fix typos in comments 2017-08-18 16:38:33 +00:00
cddl Mark ZFS ABD inline functions static. 2017-08-16 23:40:32 +00:00
compat Fix for deadlock situation in the LinuxKPI's RCU synchronize API. 2017-08-21 11:51:40 +00:00
conf Use armv8-a in -march, it is accepted by both clang and gcc. 2017-08-19 17:15:40 +00:00
contrib Fix matchcing of NATed ICMP queries (resolving NATed MTU discovery). 2017-08-05 00:28:42 +00:00
crypto aesni: quiet -Wcast-qual 2017-08-16 22:54:35 +00:00
ddb Rename mkdumpheader() and group EKCD functions in kern_shutdown.c. 2017-08-18 04:04:09 +00:00
dev Fix setting of defaults for the text cursor. 2017-08-19 23:13:33 +00:00
fs Do not drop NFS vnode lock when performing consistency checks. 2017-08-20 10:08:45 +00:00
gdb
geom When read requests are sent from a filesystem running above g_journal, 2017-08-13 18:09:22 +00:00
gnu Update DTS files from Linux 4.12 2017-07-09 13:53:32 +00:00
i386 Use the known valid segment when accessing memory in #UD handler. 2017-08-19 21:00:02 +00:00
isa Use better hard-coded defaults for the cursor shape, and remove nearby 2017-08-19 19:33:16 +00:00
kern Allow vinvalbuf() to operate with the shared vnode lock. 2017-08-20 10:07:45 +00:00
kgssapi kgssapi: insignificant spelling fix. 2016-05-03 22:05:03 +00:00
libkern x86/crc32_sse42.c: quiet unused function warning 2017-08-11 17:05:31 +00:00
mips Use better hard-coded defaults for the cursor shape, and remove nearby 2017-08-19 19:33:16 +00:00
modules Use armv8-a in -march, it is accepted by both clang and gcc. 2017-08-19 17:15:40 +00:00
net bpf: Fix incorrect cleanup 2017-08-16 19:40:07 +00:00
net80211 sys/net8021: Add missing braces in setcurchan(). 2017-08-01 03:13:43 +00:00
netgraph Check return value from soaccept(). 2017-06-14 16:13:20 +00:00
netinet Ensure inp_vflag is consistently set for TCP endpoints. 2017-08-18 07:27:15 +00:00
netinet6 After inpcb route caching was put back in place there is no need for 2017-07-27 13:03:36 +00:00
netipsec Remove stale comments. 2017-08-21 13:54:29 +00:00
netpfil pf_get_sport(): Prevent possible endless loop when searching for an unused nat port 2017-08-08 21:09:26 +00:00
netsmb sys/net*: minor spelling fixes. 2016-05-03 18:05:43 +00:00
nfs Improve FHA locality control for NFS read/write requests. 2017-07-31 15:23:19 +00:00
nfsclient Add an NFSv4.1 mount option for "use one openowner". 2017-04-13 21:54:19 +00:00
nfsserver Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
nlm Commit the 64-bit inode project. 2017-05-23 09:29:05 +00:00
ofed Change reject message type when destroying cm_id in ibore. 2017-08-03 09:31:10 +00:00
opencrypto Use const with some read-only buffers in opencrypto APIs. 2017-05-09 18:28:42 +00:00
powerpc Use better hard-coded defaults for the cursor shape, and remove nearby 2017-08-19 19:33:16 +00:00
riscv Support for v1.10 (latest) of RISC-V privilege specification. 2017-08-10 14:18:09 +00:00
rpc Listening sockets improvements. 2017-06-08 21:30:34 +00:00
security Correct bitwise test in mac_bsdextended ugidfw_rule_valid() 2017-06-13 01:17:58 +00:00
sparc64 Rename mkdumpheader() and group EKCD functions in kern_shutdown.c. 2017-08-18 04:04:09 +00:00
sys Make WRFSBASE and WRGSBASE instructions functional. 2017-08-21 17:38:02 +00:00
teken Fix syscons escape sequence for setting the local cursor type. This sequence 2017-08-18 15:40:40 +00:00
tests style(9): sort headers 2017-05-09 05:08:47 +00:00
tools make.conf: Add the possibility to use another DTC 2017-06-17 23:34:53 +00:00
ufs Avoid dereferencing potentially freed workitem in 2017-08-21 16:23:44 +00:00
vm Add OBJ_PG_DTOR flag to VM object. 2017-08-16 08:49:11 +00:00
x86 hwpstate: Add support for family 17h pstate info from MSRs 2017-08-20 00:41:49 +00:00
xdr * limit size of buffers to RPC_MAXDATASIZE 2017-06-01 06:12:25 +00:00
xen xenstore: fix suspension when using the xenstore device 2017-03-07 09:17:48 +00:00
Makefile Remove glimpse make target added in r181432 2017-05-22 15:53:30 +00:00