From 76ad31e1c8bf3b6adcb1fb69cc925e586f8f89ff Mon Sep 17 00:00:00 2001 From: miod Date: Fri, 29 Mar 2024 21:12:58 +0000 Subject: [PATCH] Be sure to reset p->p_md.md_fpstate to NULL after freeing it in cpu_exit(). There should hopefully be no further faults on this proc causing an fpu state to be handled, but better play safe than sorry. ok claudio@ kettenis@ --- sys/arch/sparc64/sparc64/vm_machdep.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sys/arch/sparc64/sparc64/vm_machdep.c b/sys/arch/sparc64/sparc64/vm_machdep.c index c5016aed0fd..ea8c23b71ef 100644 --- a/sys/arch/sparc64/sparc64/vm_machdep.c +++ b/sys/arch/sparc64/sparc64/vm_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vm_machdep.c,v 1.43 2024/02/19 09:59:29 claudio Exp $ */ +/* $OpenBSD: vm_machdep.c,v 1.44 2024/03/29 21:12:58 miod Exp $ */ /* $NetBSD: vm_machdep.c,v 1.38 2001/06/30 00:02:20 eeh Exp $ */ /* @@ -252,7 +252,7 @@ fpusave_proc(struct proc *p, int save) continue; sparc64_send_ipi(ci->ci_itid, save ? ipi_save_fpstate : ipi_drop_fpstate, (vaddr_t)p, 0); - while(ci->ci_fpproc == p) + while (ci->ci_fpproc == p) membar_sync(); break; } @@ -275,6 +275,7 @@ cpu_exit(struct proc *p) if (p->p_md.md_fpstate != NULL) { fpusave_proc(p, 0); free(p->p_md.md_fpstate, M_SUBPROC, sizeof(struct fpstate)); + p->p_md.md_fpstate = NULL; } pmap_deactivate(p); -- 2.20.1