From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from wtarreau.pck.nerim.net ([62.212.114.60]:37555 "EHLO 1wt.eu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754123AbbEOOhq (ORCPT ); Fri, 15 May 2015 10:37:46 -0400 Date: Fri, 15 May 2015 16:37:24 +0200 From: Willy Tarreau To: Ben Hutchings Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org, Andy Lutomirski , Andi Kleen , Linus Torvalds , Ingo Molnar Subject: Re: [ 05/48] x86_64, switch_to(): Load TLS descriptors before switching DS and ES Message-ID: <20150515143724.GA31155@1wt.eu> References: <20150515080530.510828652@1wt.eu> <1431693140.6315.109.camel@decadent.org.uk> <20150515133820.GA30744@1wt.eu> <1431699933.6315.115.camel@decadent.org.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1431699933.6315.115.camel@decadent.org.uk> Sender: stable-owner@vger.kernel.org List-ID: On Fri, May 15, 2015 at 03:25:33PM +0100, Ben Hutchings wrote: > On Fri, 2015-05-15 at 15:38 +0200, Willy Tarreau wrote: > > Hi Ben, > > > > 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 let me know. > > > > > > > > ------------------ > > > > > > > > From: Andy Lutomirski > > > > > > > > commit f647d7c155f069c1a068030255c300663516420e upstream. > > > > > > > > Otherwise, if buggy user code points DS or ES into the TLS > > > > array, they would be corrupted after a context switch. > > > > > > > > This also significantly improves the comments and documents some > > > > gotchas in the code. > > > > > > > > Before this patch, the both tests below failed. With this > > > > patch, the es test passes, although the gsbase test still fails. > > > [...] > > > > > > This depends on the changes to FPU/MMX/SSE state management that you > > > didn't apply to 2.6.32. Note this comment: > > > > > > /* Must be after DS reload */ > > > unlazy_fpu(prev_p); > > > > 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 */ Ah OK I missed it, thanks. > 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 Indeed! Andy, is there any practical case covered by your patch that should motivate a safe way to backport it, or can we simply drop it for 2.6.32 ? I don't intend to backport the FPU state management series that late in the cycle just for this! Thanks! Willy