lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 27 Feb 2014 15:44:22 -0800
From:	"H. Peter Anvin" <hpa@...or.com>
To:	sbsiddha@...il.com, Linus Torvalds <torvalds@...ux-foundation.org>
CC:	Nate Eldredge <nate@...tsmathematics.com>,
	Thomas Gleixner <tglx@...utronix.de>,
	Ingo Molnar <mingo@...nel.org>,
	the arch/x86 maintainers <x86@...nel.org>,
	stable <stable@...r.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
	Maarten Baert <maarten-baert@...mail.com>,
	Jan Kara <jack@...e.cz>, George Spelvin <linux@...izon.com>,
	Pekka Riikonen <priikone@....fi>
Subject: Re: [PATCH] Make math_state_restore() save and restore the interrupt
 flag

So, picking up this thread which got dropped on the floor...

On 02/01/2014 11:19 PM, Suresh Siddha wrote:
> 
> diff --git a/arch/x86/kernel/i387.c b/arch/x86/kernel/i387.c
> index e8368c6..4e5f770 100644
> --- a/arch/x86/kernel/i387.c
> +++ b/arch/x86/kernel/i387.c
> @@ -5,6 +5,7 @@
>   *  General FPU state handling cleanups
>   *	Gareth Hughes <gareth@...inux.com>, May 2000
>   */
> +#include <linux/bootmem.h>
>  #include <linux/module.h>
>  #include <linux/regset.h>
>  #include <linux/sched.h>
> @@ -186,6 +187,10 @@ void fpu_init(void)
>  	if (xstate_size == 0)
>  		init_thread_xstate();
>  
> +	if (!current->thread.fpu.state)
> +		current->thread.fpu.state =
> +			alloc_bootmem_align(xstate_size, __alignof__(struct xsave_struct));
> +
>  	mxcsr_feature_mask_init();
>  	xsave_init();
>  	eager_fpu_init();

So this bit is giving me a bit of a headache, specifically
alloc_bootmem_align() is an __init function and fpu_init() obviously isn't.

I am doubly confused because init_thread_xstate() only sets the xstate
without any XSAVE features, so the memory allocation we get there will
be insufficient later -- in fact, only a few lines further down the
function, when xsave_init() is called.

I'm wondering if we could put this somewhere inside
xstate_enable_boot_cpu() instead, maybe?

I'm assuming the reason you didn't want to in eager_fpu_init_bp()
anymore is because you want the allocation to happen regardless of if
eagerfpu is enabled, correct?

	-hpa


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ