lkml.org 
[lkml]   [2011]   [Apr]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] x86, xsave: fix non-lazy allocation of the xsave area
Date
A single static xsave area just for init is not enough, since there are
more user processes that are directly executed by kernel threads. Use
fpu_alloc(), and SIGKILL the process if that fails.

Signed-off-by: Hans Rosenfeld <hans.rosenfeld@amd.com>
---
arch/x86/include/asm/i387.h | 9 +++------
1 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/arch/x86/include/asm/i387.h b/arch/x86/include/asm/i387.h
index 989c0ac..833b6f1 100644
--- a/arch/x86/include/asm/i387.h
+++ b/arch/x86/include/asm/i387.h
@@ -329,15 +329,12 @@ static inline void fpu_copy(struct fpu *dst, struct fpu *src)
}

extern void fpu_finit(struct fpu *fpu);
-static union thread_xstate __init_xstate, *init_xstate = &__init_xstate;

static inline void fpu_clear(struct fpu *fpu)
{
- if (!fpu_allocated(fpu)) {
- BUG_ON(init_xstate == NULL);
- fpu->state = init_xstate;
- init_xstate = NULL;
- }
+ if (!fpu_allocated(fpu) && fpu_alloc(fpu))
+ do_group_exit(SIGKILL);
+
memset(fpu->state, 0, xstate_size);
fpu_finit(fpu);
set_used_math();
--
1.5.6.5



\
 
 \ /
  Last update: 2011-04-13 13:01    [W:0.162 / U:2.864 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site