Go to file
maxv 5eea203ec8 Fix a subtle ring0 escalation vulnerability in amd64, and implement a
mitigation against similar bugs.

The operations on segment registers can generate a page fault if there is
an issue when touching the in-memory gdt. Theoretically, it is never
supposed to happen, since the gdt is mapped correctly. However, in the
kernel we allow the gdt to be resized, and to do that, we allocate the
maximum amount of va needed by it, but only kenter a few pages until we
need more. Moreover, to avoid reloading the gdt each time we grow it, the
'size' field of gdtr is set to the maximum value. All of this means that
if a mov or iretq is done with a segment register whose index hits a page
that has not been kentered, a page fault is sent.

Such a page fault, if received in kernel mode, does not trigger a swapgs
on amd64; in other words, the kernel would be re-entered with the userland
tls.

And there just happens to be a place in compat_linux32 where the index of
%cs is controlled by userland, making it easy to trigger the page fault
and get kernel privileges.

The mitigation simply consists in abandoning the gdt_grow mechanism and
allocating/kentering the maximum size right away, in such a way that no
page fault can be triggered because of segment registers.
2017-09-02 12:57:03 +00:00
bin Fix a bug noticed by Soren Jacobsen running the netbsd-6-0 build.sh which 2017-08-31 05:09:38 +00:00
common * aarch64/memset.S didn't work! fixed some bugs. 2017-08-29 15:00:23 +00:00
compat Don't mix abis in any CRUNCHEDPROG 2017-01-05 21:28:42 +00:00
crypto PR/51682: Antoine Beaupré: Simplify and comment previous patch. 2017-07-23 05:40:27 +00:00
dist/pf PR 50709 David Binderman: memory leak 2016-05-30 17:21:07 +00:00
distrib add vfp 2017-08-31 22:19:51 +00:00
doc Move sbmips -> evbmips entry to CHANGES.prev 2017-08-30 15:20:09 +00:00
etc update for xkeyboard-config 2.21. 2017-08-29 07:53:54 +00:00
external more no-error-ssp 2017-09-01 14:38:23 +00:00
extsrc
games typo 2017-07-02 07:02:47 +00:00
include Add missing strfmon_l. Noticed by Bruno Haible. Add test case. 2017-08-16 13:53:19 +00:00
lib Remove trailing whitespace; convert Xr readline to Nm readline, since 2017-09-02 06:48:10 +00:00
libexec explain AARCH64 PLT design 2017-08-28 06:59:25 +00:00
regress Don't test call gates, they are not supported anymore. 2017-08-30 15:46:19 +00:00
rescue Remove MKCRYPTO option. 2017-05-21 15:28:36 +00:00
sbin Bump date for previous. 2017-08-28 05:58:08 +00:00
share Revert probably unintentional case changes from previous. 2017-08-31 08:36:32 +00:00
sys Fix a subtle ring0 escalation vulnerability in amd64, and implement a 2017-09-02 12:57:03 +00:00
tests Allow the test to build on systems where sys/mman.h does not provide 2017-09-01 16:51:58 +00:00
tools move the GMP_MACHINE_ARCH definition into external/lgpl3/gmp/Makefile.arch. 2017-08-22 09:17:50 +00:00
usr.bin Sync usage with man page. 2017-08-27 20:40:22 +00:00
usr.sbin Decode the following entries: 2017-09-01 18:35:50 +00:00
build.sh - Allow all other targets (like kernel=) to obey mkrepro (-P) 2017-04-08 18:22:35 +00:00
BUILDING regen 2017-05-21 15:30:20 +00:00
Makefile don't descend into gnu 2017-04-11 14:04:15 +00:00
Makefile.inc
UPDATING note GMP 6.1.2 release and the build issues that may occur. 2017-08-22 10:04:44 +00:00