diff options
author | kib <kib@FreeBSD.org> | 2014-06-30 09:48:44 +0000 |
---|---|---|
committer | kib <kib@FreeBSD.org> | 2014-06-30 09:48:44 +0000 |
commit | d02ef38799408e3a6c8914dd8899d6e33a18b99e (patch) | |
tree | 1cdbf0e90185182bff0bf7d098f7d52a156ffe79 /sys/i386/isa | |
parent | ff62446f9059b50fbd507dbd0d14404a62eb1691 (diff) | |
download | FreeBSD-src-d02ef38799408e3a6c8914dd8899d6e33a18b99e.zip FreeBSD-src-d02ef38799408e3a6c8914dd8899d6e33a18b99e.tar.gz |
MFC r267767:
Add FPU_KERN_KTHR flag to fpu_kern_enter(9).
Apply the flag to padlock(4) and aesni(4).
In aesni_cipher_process(), do not leak FPU context state on error.
Diffstat (limited to 'sys/i386/isa')
-rw-r--r-- | sys/i386/isa/npx.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/sys/i386/isa/npx.c b/sys/i386/isa/npx.c index 622e5b7..dec7366 100644 --- a/sys/i386/isa/npx.c +++ b/sys/i386/isa/npx.c @@ -1008,6 +1008,7 @@ static MALLOC_DEFINE(M_FPUKERN_CTX, "fpukern_ctx", #define XSAVE_AREA_ALIGN 64 #define FPU_KERN_CTX_NPXINITDONE 0x01 +#define FPU_KERN_CTX_DUMMY 0x02 struct fpu_kern_ctx { union savefpu *prev; @@ -1051,6 +1052,10 @@ fpu_kern_enter(struct thread *td, struct fpu_kern_ctx *ctx, u_int flags) { struct pcb *pcb; + if ((flags & FPU_KERN_KTHR) != 0 && is_fpu_kern_thread(0)) { + ctx->flags = FPU_KERN_CTX_DUMMY; + return (0); + } pcb = td->td_pcb; KASSERT(!PCB_USER_FPU(pcb) || pcb->pcb_save == &pcb->pcb_user_save, ("mangled pcb_save")); @@ -1070,6 +1075,8 @@ fpu_kern_leave(struct thread *td, struct fpu_kern_ctx *ctx) { struct pcb *pcb; + if (is_fpu_kern_thread(0) && (ctx->flags & FPU_KERN_CTX_DUMMY) != 0) + return (0); pcb = td->td_pcb; critical_enter(); if (curthread == PCPU_GET(fpcurthread)) |