summaryrefslogtreecommitdiff
path: root/sys/arch/i386
diff options
context:
space:
mode:
authorMichael Shalayeff <mickey@cvs.openbsd.org>2006-04-19 15:48:18 +0000
committerMichael Shalayeff <mickey@cvs.openbsd.org>2006-04-19 15:48:18 +0000
commit57428c6ffce5e2656cdc37b2e38b866366ba58f7 (patch)
tree8ac69e6d73f1c39f875953f947d3d1d1310ee7d1 /sys/arch/i386
parent70954f7a04ffcc7edbfd1debe400a57be7adbb92 (diff)
from todays freebsd advisory: fxrstor on amd cpu does not restore fip,fdp,fop thus leaking other proc's execution history; deraadt@ ok
Diffstat (limited to 'sys/arch/i386')
-rw-r--r--sys/arch/i386/isa/npx.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/sys/arch/i386/isa/npx.c b/sys/arch/i386/isa/npx.c
index 3fd0102dcbf..27279230a84 100644
--- a/sys/arch/i386/isa/npx.c
+++ b/sys/arch/i386/isa/npx.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: npx.c,v 1.38 2006/03/13 18:42:16 mickey Exp $ */
+/* $OpenBSD: npx.c,v 1.39 2006/04/19 15:48:17 mickey Exp $ */
/* $NetBSD: npx.c,v 1.57 1996/05/12 23:12:24 mycroft Exp $ */
#if 0
@@ -637,6 +637,14 @@ npxdna_xmm(struct cpu_info *ci)
fldcw(&p->p_addr->u_pcb.pcb_savefpu.sv_xmm.sv_env.en_cw);
p->p_md.md_flags |= MDP_USEDFPU;
} else {
+ static double zero = 0.0;
+
+ /*
+ * amd fpu does not restore fip, fdp, fop on fxrstor
+ * thus leaking other process's execution history.
+ */
+ fnclex();
+ __asm __volatile("ffree %%st(7)\n\tfld %0" : : "m" (zero));
fxrstor(&p->p_addr->u_pcb.pcb_savefpu.sv_xmm);
}