Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1031430AbbDXUxl (ORCPT ); Fri, 24 Apr 2015 16:53:41 -0400 Received: from mail-ig0-f178.google.com ([209.85.213.178]:35544 "EHLO mail-ig0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1031359AbbDXUxi (ORCPT ); Fri, 24 Apr 2015 16:53:38 -0400 MIME-Version: 1.0 In-Reply-To: References: <5d120f358612d73fc909f5bfa47e7bd082db0af0.1429841474.git.luto@kernel.org> Date: Fri, 24 Apr 2015 13:53:37 -0700 X-Google-Sender-Auth: WZdZXAQD2WfgVOMr0mFsIzSkFTs Message-ID: Subject: Re: [PATCH] x86_64, asm: Work around AMD SYSRET SS descriptor attribute issue From: Linus Torvalds To: Andy Lutomirski Cc: Andy Lutomirski , X86 ML , "H. Peter Anvin" , Borislav Petkov , Denys Vlasenko , Brian Gerst , Denys Vlasenko , Ingo Molnar , Steven Rostedt , Oleg Nesterov , Frederic Weisbecker , Alexei Starovoitov , Will Drewry , Kees Cook , Linux Kernel Mailing List Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1331 Lines: 34 On Fri, Apr 24, 2015 at 1:21 PM, Andy Lutomirski wrote: > > 2. SYSRETQ. The only way that I know of to see the problem is SYSRETQ > followed by a far jump or return. This is presumably *extremely* > rare. > > What if we fixed #2 up in do_stack_segment. We should double-check > the docs, but I think that this will only ever manifest as #SS(0) with > regs->ss == __USER_DS and !user_mode_64bit(regs). Hmm. It smells a bit "too clever" for me, and in particular, I think you need a good test-case for this. But yeah, I guess that gets things out of any possibly critical paths. That said, I wouldn't even be sure about the SS(0). The rules about when you get SS and when you get GP are odd. Also, you need to check what happens when somebody does something like movl $-1,%eax ss ; movl (%eax),%eax because I think that gets a #DB(0) too with the situation you expect to be "unique", because the address wraps.. I dunno. So care and testing needed. I think the scheduler approach is a *lot* more obvious, quite frankly. Linus -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/