Date: Sat, 8 Jul 2017 11:07:39 +0000 (UTC) From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320804 - head/sys/i386/i386 Message-ID: <201707081107.v68B7dCj055028@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kib Date: Sat Jul 8 11:07:39 2017 New Revision: 320804 URL: https://svnweb.freebsd.org/changeset/base/320804 Log: Fix handling of one more possible exception on return to usermode. If %ss is loaded with a segment pointing to a non-present descriptor by the IRETD instruction, a kernel-mode #SS exception is generated. Resulting T_STKFLT trap must be checked against doreti_iret_fault location and handled, otherwise userspace may panic the kernel. Note that this is i386 variant of FreeBSD-SA-15:21.amd64, but unlike amd64, there is no swapgs on i386 and the issue is arguably not exploitable. Reported by: Maxime Villard <max@m00nbsd.net> Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/i386/i386/trap.c Modified: head/sys/i386/i386/trap.c ============================================================================== --- head/sys/i386/i386/trap.c Sat Jul 8 11:06:27 2017 (r320803) +++ head/sys/i386/i386/trap.c Sat Jul 8 11:07:39 2017 (r320804) @@ -550,11 +550,7 @@ user_trctrap_out: vm86_trap((struct vm86frame *)frame); goto out; } - if (type == T_STKFLT) - break; - /* FALL THROUGH */ - case T_SEGNPFLT: /* segment not present fault */ if (curpcb->pcb_flags & PCB_VM86CALL) break; @@ -595,6 +591,9 @@ user_trctrap_out: frame->tf_eip = (int)doreti_iret_fault; goto out; } + if (type == T_STKFLT) + break; + if (frame->tf_eip == (int)doreti_popl_ds) { frame->tf_eip = (int)doreti_popl_ds_fault; goto out;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201707081107.v68B7dCj055028>