• D
    x86/fpu: Remove XSTATE_RESERVE · 4109ca06
    Dave Hansen 提交于
    The original purpose of XSTATE_RESERVE was to carve out space
    to store all of the possible extended state components that
    get saved with the XSAVE instruction(s).
    
    However, we are now almost entirely dynamically allocating
    the buffers we use for XSAVE by placing them at the end of
    the task_struct and them sizing them at boot.  The one
    exception for that is the init_task.
    
    The maximum extended state component size that we have today
    is on systems with space for AVX-512 and Memory Protection
    Keys: 2696 bytes.  We have reserved a PAGE_SIZE buffer in
    the init_task via fpregs_state->__padding.
    
    This check ensures that even if the component sizes or
    layout were changed (which we do not expect), that we will
    still not overflow the init_task's buffer.
    
    In the case that we detect we might overflow the buffer,
    we completely disable XSAVE support in the kernel and try
    to boot as if we had 'legacy x87 FPU' support in place.
    This is a crippled state without any of the XSAVE-enabled
    features (MPX, AVX, etc...).  But, it at least let us
    boot safely.
    Signed-off-by: NDave Hansen <dave.hansen@linux.intel.com>
    Cc: Andy Lutomirski <luto@amacapital.net>
    Cc: Borislav Petkov <bp@alien8.de>
    Cc: Brian Gerst <brgerst@gmail.com>
    Cc: Denys Vlasenko <dvlasenk@redhat.com>
    Cc: Fenghua Yu <fenghua.yu@intel.com>
    Cc: H. Peter Anvin <hpa@zytor.com>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: Tim Chen <tim.c.chen@linux.intel.com>
    Cc: dave@sr71.net
    Cc: linux-kernel@vger.kernel.org
    Link: http://lkml.kernel.org/r/20150902233125.D948D475@viggo.jf.intel.comSigned-off-by: NIngo Molnar <mingo@kernel.org>
    4109ca06
xstate.c 13.5 KB