Module Name: src
Committed By: maxv
Date: Tue Jun 19 07:23:45 UTC 2018
Modified Files:
src/sys/arch/x86/x86: vm_machdep.c
Log Message:
Explicitly clear l2's pcb_fpcpu when forking.
A context switch (preemption) could occur between
fpusave_lwp(l1, true);
and
memcpy(pcb2, pcb1, sizeof(struct pcb));
In this case, l1's FPU state is re-installed on the current CPU, and
pcb1->pcb_fpcpu becomes non NULL. While it's fine to have l1's state
installed, we don't want to indicate l2's state is installed too.
With lazy fpu this was not a problem, because the context-switch would
not re-install the state, so pcb1->pcb_fpcpu was NULL.
Should fix PR/53383.
To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/x86/x86/vm_machdep.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/x86/x86/vm_machdep.c
diff -u src/sys/arch/x86/x86/vm_machdep.c:1.33 src/sys/arch/x86/x86/vm_machdep.c:1.34
--- src/sys/arch/x86/x86/vm_machdep.c:1.33 Fri Mar 16 12:19:35 2018
+++ src/sys/arch/x86/x86/vm_machdep.c Tue Jun 19 07:23:44 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: vm_machdep.c,v 1.33 2018/03/16 12:19:35 maxv Exp $ */
+/* $NetBSD: vm_machdep.c,v 1.34 2018/06/19 07:23:44 maxv Exp $ */
/*-
* Copyright (c) 1982, 1986 The Regents of the University of California.
@@ -80,7 +80,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.33 2018/03/16 12:19:35 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.34 2018/06/19 07:23:44 maxv Exp $");
#include "opt_mtrr.h"
@@ -157,6 +157,10 @@ cpu_lwp_fork(struct lwp *l1, struct lwp
/* Copy the PCB from parent. */
memcpy(pcb2, pcb1, sizeof(struct pcb));
+
+ /* FPU state not installed. */
+ pcb2->pcb_fpcpu = NULL;
+
/* Copy any additional fpu state */
fpu_save_area_fork(pcb2, pcb1);