NetBSD/sys/compat
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
..
aoutm68k regen 2017-05-10 06:19:47 +00:00
common typos 2017-08-04 09:33:03 +00:00
freebsd Remove vm86. Simplifies a number of critical places. 2017-08-12 07:07:53 +00:00
ibcs2 Remove __i386__. 2017-08-09 18:52:00 +00:00
linux Remove the filesystem tracing feature 2017-08-28 00:46:06 +00:00
linux32 Fix a subtle ring0 escalation vulnerability in amd64, and implement a 2017-09-02 12:57:03 +00:00
m68k4k
ndis Switch NdisOpenFile() to mountlist iterator. 2017-04-13 09:44:48 +00:00
net Add ifam_pid and ifam_addrflags to ifa_msghdr. 2016-09-21 10:50:22 +00:00
netbsd32 Remove references to COMPAT_OLDSOCK (itself removed years ago). 2017-07-31 15:38:01 +00:00
netinet6 More on PR 41200: headers that declare ioctls should include sys/ioccom.h. 2015-09-06 06:00:59 +00:00
osf1 Fail, don't panic, on bad dirents from file system. 2017-07-28 15:34:06 +00:00
ossaudio Update compat/ossaudio with GETISPACE/GETOSPACE corrections from 2017-03-24 14:32:29 +00:00
sunos Fail, don't panic, on bad dirents from file system. 2017-07-28 15:34:06 +00:00
sunos32 Fail, don't panic, on bad dirents from file system. 2017-07-28 15:34:06 +00:00
svr4 Remove __i386__. 2017-08-09 18:52:00 +00:00
svr4_32 make it compile again. 2017-07-30 12:31:46 +00:00
sys Only compat_43 needs compat_osock. Note that the use of vec_compat_ifioctl 2017-07-29 06:12:50 +00:00
ultrix regen 2017-05-10 06:19:47 +00:00
vax1k
Makefile
Makefile.syscall Add a Makefile to rebuild the syscall files for all emulations 2017-01-16 17:42:52 +00:00