From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Message-ID: <1431699933.6315.115.camel@decadent.org.uk> Subject: Re: [ 05/48] x86_64, switch_to(): Load TLS descriptors before switching DS and ES From: Ben Hutchings To: Willy Tarreau Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org, Andy Lutomirski , Andi Kleen , Linus Torvalds , Ingo Molnar Date: Fri, 15 May 2015 15:25:33 +0100 In-Reply-To: <20150515133820.GA30744@1wt.eu> References: <20150515080530.510828652@1wt.eu> <1431693140.6315.109.camel@decadent.org.uk> <20150515133820.GA30744@1wt.eu> Content-Type: multipart/signed; micalg="pgp-sha512"; protocol="application/pgp-signature"; boundary="=-xoDPDAKbLtRWEJk8182g" Mime-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: --=-xoDPDAKbLtRWEJk8182g Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, 2015-05-15 at 15:38 +0200, Willy Tarreau wrote: > Hi Ben, >=20 > On Fri, May 15, 2015 at 01:32:20PM +0100, Ben Hutchings wrote: > > On Fri, 2015-05-15 at 10:05 +0200, Willy Tarreau wrote: > > > 2.6.32-longterm review patch. If anyone has any objections, please l= et me know. > > >=20 > > > ------------------ > > >=20 > > > From: Andy Lutomirski > > >=20 > > > commit f647d7c155f069c1a068030255c300663516420e upstream. > > >=20 > > > Otherwise, if buggy user code points DS or ES into the TLS > > > array, they would be corrupted after a context switch. > > >=20 > > > This also significantly improves the comments and documents some > > > gotchas in the code. > > >=20 > > > Before this patch, the both tests below failed. With this > > > patch, the es test passes, although the gsbase test still fails. > > [...] > >=20 > > This depends on the changes to FPU/MMX/SSE state management that you > > didn't apply to 2.6.32. Note this comment: > >=20 > > /* Must be after DS reload */ > > unlazy_fpu(prev_p); >=20 > Are you sure you're not confusing with another one ? When running > estest without this patch, I get "FAIL: ES corrupted 1000/1000 times" > while I get "OK: ES was preserved" once applied, so it does seem to > do what it's intended for. > > Also I'm not seeing any reference to the comment above in the patch > nor around it, which leaves me confused :-/ v2.6.32.65:arch/x86/kernel/process_64.c:425: /* Must be after DS reload = */ If this comment is correct then the patch will cause a regression for FPU state management. The comment was introduced by: commit 0a5ace2ab08d45cd78d7ef0067cdcd5c812ac54f Author: Andi Kleen Date: Thu Oct 5 18:47:22 2006 +0200 [PATCH] x86-64: Fix FPU corruption Ben. --=20 Ben Hutchings It is impossible to make anything foolproof because fools are so ingenious. --=-xoDPDAKbLtRWEJk8182g Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIVAwUAVVYB4ue/yOyVhhEJAQqtiBAA1jOs9jUpIQuRpSr/TDZvYPrc4NqF81le imfKPQmusImog/OdjiNvI1XInJ0Q9pdbL0lzVlReyA/x3vBXu5+vWrkJuwArpkuo I+no2+8o2MPNQy0ulSmnkbOJlewlW+ZFmYjyv4MKgjlyWm1hVTpg6JW2dTqg0Usu i7Ewx2TF0icW47rhsRZjDVd2AypFRHaVQ4XM3PTybCbRg9v8BloebDglqA92DrX8 R2ipBIeMQvY1l+BuVXRQ2H4cpns3chSdhBwyZsKo/JmXAQLcW3WKV118LFM6YrH4 sOSqHPo3YRWjySB/iztbs64kuzLFn/4Gf6ARXc0+KzbcfgxEh/doNw2/fHe4bAFm vB+HyKN3Sn0Mo1T8E0Hl28C9fhGWLOs1UO3ze2Ld3wrSi1fM1PrzTRKRP4a23ML0 Kr9wTbLLf5oCkXnUnHmbcr2qXrwr1nPEkhlAbJMfXkjszwLLJIZoUgkaHi3zt2IQ sBodgD8K8yshB5ta2KQlYtpgI9x38kj6+Vm8p/X8D4yyaOQwh/87R52VFpteofTe Zx2GHTqk22VX6MGQFmN2+NNNFgrx9JMD3quBltBcTZDH4nmWWVZ37iplKpjSfpox YY5vsvCKAbVtZbqiSzM18SUpCLsXurv+iQYcjb+rT3F+61aF5ZrdiDWmLGMmMxei 4r5mdxnB1CQ= =dRpl -----END PGP SIGNATURE----- --=-xoDPDAKbLtRWEJk8182g--