svn commit: r343781 - stable/12/sys/amd64/amd64

Konstantin Belousov kib at FreeBSD.org
Tue Feb 5 17:52:08 UTC 2019


Author: kib
Date: Tue Feb  5 17:52:06 2019
New Revision: 343781
URL: https://svnweb.freebsd.org/changeset/base/343781

Log:
  MFC r343780:
  amd64: clear callee-preserved registers on syscall exit.
  
  Approved by:	so
  Security:	CVE-2019-5595

Modified:
  stable/12/sys/amd64/amd64/exception.S
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/amd64/amd64/exception.S
==============================================================================
--- stable/12/sys/amd64/amd64/exception.S	Tue Feb  5 17:49:27 2019	(r343780)
+++ stable/12/sys/amd64/amd64/exception.S	Tue Feb  5 17:52:06 2019	(r343781)
@@ -521,12 +521,14 @@ fast_syscall_common:
 	movq	TF_RFLAGS(%rsp),%r11	/* original %rflags */
 	movq	TF_RIP(%rsp),%rcx	/* original %rip */
 	movq	TF_RSP(%rsp),%rsp	/* user stack pointer */
+	xorl	%r8d,%r8d		/* zero the rest of GPRs */
+	xorl	%r10d,%r10d
 	cmpq	$~0,PCPU(UCR3)
 	je	2f
 	movq	PCPU(UCR3),%r9
 	movq	%r9,%cr3
-	xorl	%r9d,%r9d
-2:	swapgs
+2:	xorl	%r9d,%r9d
+	swapgs
 	sysretq
 
 3:	/* AST scheduled. */


More information about the svn-src-all mailing list