freebsd-nq/sys/amd64
Konstantin Belousov 90e35b0a98 amd64: prevents speculations over swapgs reload of %gs base.
Such speculations could use user-controlled %gs base, esp. since
FreeBSD supports WRGSBASE instructions.

Place LFENCEs on entry for each basic block after the test for
previous kernel/user mode on the kernel entry, which prevents the
speculation.  Code accesses %gs-based PCPU before any serialization
instructions are executed, like %cr3 reload for KPTI.

With pti disabled, on haswell i7-4770S machine, "syscall_timings getppid"
shows when no lfence is added to syscall path:
test	loop	time	iterations	periteration
getppid	0	1.040918865	4643611	0.000000224
getppid	1	1.004985962	4481816	0.000000224
getppid	2	1.005196483	4482363	0.000000224
with lfence:
getppid	0	1.043701091	4554779	0.000000229
getppid	1	1.016930328	4438094	0.000000229
getppid	2	1.023223117	4466640	0.000000229
and ministat reports 'No difference proven at 95.0% confidence.'

Security:	CVE-2019-1125
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2019-08-06 16:53:25 +00:00
..
acpica Merge ACPICA 20190329. 2019-03-29 20:21:28 +00:00
amd64 amd64: prevents speculations over swapgs reload of %gs base. 2019-08-06 16:53:25 +00:00
cloudabi32 Remove sv_pagesize, originally introduced with r100384. 2019-03-01 16:16:38 +00:00
cloudabi64 Remove sv_pagesize, originally introduced with r100384. 2019-03-01 16:16:38 +00:00
conf Remove gzip'ed a.out support. 2019-07-30 05:13:16 +00:00
ia32 Don't pass error from syscallenter() to syscallret(). 2019-07-15 21:25:16 +00:00
include amd64: prevents speculations over swapgs reload of %gs base. 2019-08-06 16:53:25 +00:00
linux linuxulator: rename linux_locore.s to .asm 2019-07-30 17:18:31 +00:00
linux32 linuxulator: rename linux_locore.s to .asm 2019-07-30 17:18:31 +00:00
pci pci_cfgreg.c: Use io port config access for early boot time. 2019-04-09 18:07:17 +00:00
sgx Add a return value to vm_page_remove(). 2019-06-26 17:37:51 +00:00
vmm bhyve: Ignore MSI/MSI-X interrupts sent to non-active vCPUs in 2019-08-03 16:57:14 +00:00
Makefile Bring the tags and links entries for amd64 up to date. 2015-10-27 22:59:24 +00:00