summaryrefslogtreecommitdiffstats
path: root/sys/i386/isa
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2009-03-25 22:08:30 +0000
committerjhb <jhb@FreeBSD.org>2009-03-25 22:08:30 +0000
commitafc2ecb61b9348611fdae9f1b66b88494c3891d5 (patch)
tree856f56f219282bb7da4e7a2456d17f41f65cbfaf /sys/i386/isa
parent9c09aaf3a38f2d4fba3349ede23e3c51d6a523ea (diff)
downloadFreeBSD-src-afc2ecb61b9348611fdae9f1b66b88494c3891d5.zip
FreeBSD-src-afc2ecb61b9348611fdae9f1b66b88494c3891d5.tar.gz
Fix a few nits in the earlier changes to prevent local information leakage
in AMD FPUs: - Do not clear the affected state in the case that the FPU registers for the thread that already owns the FPU are changed via fpu_setregs(). The only local information the thread would see is its own state in that case. - Fix a type mismatch for the dummy variable used in a "fld". It accepts a float, not a double. Reviewed by: bde Approved by: so (cperciva) MFC after: 1 month
Diffstat (limited to 'sys/i386/isa')
-rw-r--r--sys/i386/isa/npx.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/sys/i386/isa/npx.c b/sys/i386/isa/npx.c
index e57d9d4..6da4b4c 100644
--- a/sys/i386/isa/npx.c
+++ b/sys/i386/isa/npx.c
@@ -794,6 +794,11 @@ npxdna(void)
PCPU_SET(fpcurthread, curthread);
pcb = PCPU_GET(curpcb);
+#ifdef CPU_ENABLE_SSE
+ if (cpu_fxsr)
+ fpu_clean_state();
+#endif
+
if ((pcb->pcb_flags & PCB_NPXINITDONE) == 0) {
/*
* This is the first time this thread has used the FPU or
@@ -976,10 +981,10 @@ fpusave(addr)
* In order to avoid leaking this information across processes, we clean
* these values by performing a dummy load before executing fxrstor().
*/
-static double dummy_variable = 0.0;
static void
fpu_clean_state(void)
{
+ static float dummy_variable = 0.0;
u_short status;
/*
@@ -1005,10 +1010,9 @@ fpurstor(addr)
{
#ifdef CPU_ENABLE_SSE
- if (cpu_fxsr) {
- fpu_clean_state();
+ if (cpu_fxsr)
fxrstor(addr);
- } else
+ else
#endif
frstor(addr);
}
OpenPOWER on IntegriCloud