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]
Message-ID: <54C3A08D.3070301@redhat.com>
Date:	Sat, 24 Jan 2015 08:39:25 -0500
From:	Rik van Riel <riel@...hat.com>
To:	"H. Peter Anvin" <hpa@...or.com>,
	Suresh Siddha <suresh.b.siddha@...el.com>
CC:	Andy Lutomirski <luto@...capital.net>,
	Thomas Gleixner <tglx@...utronix.de>,
	Ingo Molnar <mingo@...hat.com>,
	Fenghua Yu <fenghua.yu@...el.com>,
	the arch/x86 maintainers <x86@...nel.org>,
	Oleg Nesterov <oleg@...hat.com>,
	linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: question about save_xstate_sig() - WHY DOES THIS WORK?

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 01/23/2015 04:07 PM, H. Peter Anvin wrote:
> On 01/23/2015 11:34 AM, Rik van Riel wrote:
>> While working on a patch series to defer FPU state loading until 
>> kernel -> user space transition, and be more lazy with FPU state 
>> while in the kernel, I came across this code in
>> save_xstate_sig().
>> 
>> Not only is this broken with my new code, but it looks like it
>> may be broken with the current code, too...
>> 
>> Specifically, save_user_xstate() may page fault and sleep. After 
>> returning from the page fault, there is no guarantee that the FPU
>> state will be restored into the CPU, when the system is not 
>> running with eager fpu mode.
>> 
>> In that case, what prevents us from saving random FPU register
>> state to the user's stack frame?  Potentially state containing
>> data from other programs...
>> 
> 
> If the FPU state is not current, we'll have CR0.TS = 1 and the
> XSAVE will cause an #NM exception, which will cause the FPU state
> to be swapped in.

OK, so the code works as it is right now, but I still need
to have the patch in my "defer FPU state loading and CR0.TS
switching to kernel -> user space transition" patch series.

Thanks for explaining why the current code is safe, Peter.

- -- 
All rights reversed
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQEcBAEBAgAGBQJUw6CNAAoJEM553pKExN6DIkIH/jYpLRfVSbx+JBuFtOibA6jk
wwWnwNdPRUiWf0v0lSNX4phk9f7VCy8WKbrFtC0IYdGLL0zCY94dN7us4hNYo9fE
btdb/qsvqq8w2esPuUczAgaxwipYVliDUDOHSXTRbPS2upBuLHl/CVIVb1A+HVC7
gB6GF4ZLa2P1ygcjuWDNDNtx04QWTi7K80eWtWAQ7U4OK9Y4fSgR3hOIJS79M/aJ
P9YGaTyo0zDQcKx1rFXTjl9A0slCFZ+QkAeCwLZRkXc1K9n50GANuYeg53/ATYey
7x0FjZEBD2ipX60FqZ+mYAiA7rqw4RYKgAttszy9b9bgKY/fzHy87z2YS8Umplg=
=55wt
-----END PGP SIGNATURE-----
--
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