svn commit: r335453 - stable/11/sys/amd64/amd64

Konstantin Belousov kib at FreeBSD.org
Wed Jun 20 17:37:56 UTC 2018


Author: kib
Date: Wed Jun 20 17:37:55 2018
New Revision: 335453
URL: https://svnweb.freebsd.org/changeset/base/335453

Log:
  MFC r332994 (by tychon):
  Handle potential alignment adjustment of the exception frame by hardware.

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

Modified: stable/11/sys/amd64/amd64/exception.S
==============================================================================
--- stable/11/sys/amd64/amd64/exception.S	Wed Jun 20 17:20:39 2018	(r335452)
+++ stable/11/sys/amd64/amd64/exception.S	Wed Jun 20 17:37:55 2018	(r335453)
@@ -341,6 +341,9 @@ page_cr2:
 	 * On the stack, we have the hardware interrupt frame to return
 	 * to usermode (faulted) and another frame with error code, for
 	 * fault.  For PTI, copy both frames to the main thread stack.
+	 * Handle the potential 16-byte alignment adjustment incurred
+	 * during the second fault by copying both frames independently
+	 * while unwinding the stack in between.
 	 */
 	.macro PROTF_ENTRY name,trapno
 \name\()_pti_doreti:
@@ -351,7 +354,11 @@ page_cr2:
 	movq	%rax,%cr3
 	movq	PCPU(RSP0),%rax
 	subq	$2*PTI_SIZE-3*8,%rax /* no err, %rax, %rdx in faulted frame */
-	MOVE_STACKS	(PTI_SIZE / 4 - 3)
+	MOVE_STACKS	(PTI_SIZE / 8)
+	addq	$PTI_SIZE,%rax
+	movq	PTI_RSP(%rsp),%rsp
+	MOVE_STACKS	(PTI_SIZE / 8 - 3)
+	subq	$PTI_SIZE,%rax
 	movq	%rax,%rsp
 	popq	%rdx
 	popq	%rax


More information about the svn-src-stable-11 mailing list