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:	Fri, 28 Aug 2015 09:02:51 -0700
From:	Dave Hansen <dave@...1.net>
To:	Ingo Molnar <mingo@...nel.org>
CC:	dave.hansen@...ux.intel.com, mingo@...hat.com, x86@...nel.org,
	bp@...en8.de, fenghua.yu@...el.com, tim.c.chen@...ux.intel.com,
	linux-kernel@...r.kernel.org,
	Linus Torvalds <torvalds@...ux-foundation.org>
Subject: Re: [PATCH 11/11] x86, fpu: check CPU-provided sizes against struct
 declarations

On 08/27/2015 10:25 PM, Ingo Molnar wrote:
> * Dave Hansen <dave@...1.net> wrote:
>> @@ -447,6 +492,14 @@ static void do_extra_xstate_size_checks(
>>  		paranoid_xstate_size += xfeature_size(i);
>>  	}
>>  	XSTATE_WARN_ON(paranoid_xstate_size != xstate_size);
>> +	/*
>> +	 * Basically, make sure that XSTATE_RESERVE has forced
>> +	 * xregs_state to be large enough.  This is not fatal
>> +	 * because we reserve a *lot* of extra room in the init
>> +	 * task struct, but we should at least know we got it
>> +	 * wrong.
>> +	 */
>> +	XSTATE_WARN_ON(xstate_size > sizeof(struct xregs_state));
> 
> So do we need to warn about this? arch_task_struct_size is already dynamic today.

I'm unsure what _actually_ blew up, but I missed adding protection keys
and AVX-512 to XSTATE_RESERVE and the kernel crashed the first time I
did a non-init-state-PKRU XSAVE.

> The only problem would be the init task, which is allocated statically - can we 
> fix that?

We could theoretically make it dynamic, but I'm really not sure it's
worth the trouble.  I just removed the init_task=INIT_TASK()
initialization to see what would happen and something blew up early
(last I saw on the console was the "early console in setup code").

The current size of the non-XSAVE data in task_struct is ~2k.  The xsave
data is 800-something bytes, so say ~1k.  Our init_task ends up being
~6k, 3k of which is wasted.  On an AVX-512 CPU, that means 1k of waste.

>From how early things died, I'm going to go out on a limb and say that
we'll need to bootmem alloc our new dynamic init_task and probably can't
practically wait for the slab to show up.  Bootmem can only do full
pages, so our 6k can be trimmed to 4k.  On an AVX-512 CPU, the 6k goes
*up* to 8k.

It doesn't look like a fun exercise for 2k of memory savings.


--
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