Be sure to reset p->p_md.md_fpstate to NULL after freeing it in cpu_exit().
authormiod <miod@openbsd.org>
Fri, 29 Mar 2024 21:12:58 +0000 (21:12 +0000)
committermiod <miod@openbsd.org>
Fri, 29 Mar 2024 21:12:58 +0000 (21:12 +0000)
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

index c5016ae..ea8c23b 100644 (file)
@@ -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);