From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754004AbbCIRn0 (ORCPT ); Mon, 9 Mar 2015 13:43:26 -0400 Received: from terminus.zytor.com ([198.137.202.10]:40076 "EHLO mail.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752582AbbCIRnW (ORCPT ); Mon, 9 Mar 2015 13:43:22 -0400 Message-ID: <54FDDB90.9010706@zytor.com> Date: Mon, 09 Mar 2015 10:42:40 -0700 From: "H. Peter Anvin" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: Linus Torvalds , Denys Vlasenko CC: Andy Lutomirski , Steven Rostedt , Ingo Molnar , Borislav Petkov , Oleg Nesterov , Frederic Weisbecker , Alexei Starovoitov , Will Drewry , Kees Cook , the arch/x86 maintainers , Linux Kernel Mailing List Subject: Re: [PATCH] x86: entry_32.S: change ESPFIX test to not touch PT_OLDSS(%esp) References: <1425909943-14687-1-git-send-email-dvlasenk@redhat.com> In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 03/09/2015 09:08 AM, Linus Torvalds wrote: > > Sure, the btl is easier to explain in the source code, but instead of this: > >> + btl $X86_EFLAGS_VM_BIT,PT_EFLAGS(%esp) > > you'd have to add a comment, like > > testb $2, PT_EFLAGS+2(%esp) # X86_EFLAGS_VM_BIT > > or something. > Maybe: testb $(X86_EFLAGS_VM-16), PT_EFLAGS+2(%esp) > Or just at least *partially* do what we used to do, and make it all be > > movb PT_EFLAGS+2(%esp),%al > andb $2,%al > orb PT_CS(%esp),%al > testb $3,%al > je restore_nocheck > testb $SEGMENT_TI_MASK,PT_OLDSS(%esp) > jne ldt_ss > > which still avoids looking at SS unless needed, and is smaller and > faster than the btl, afaik. The question is if avoiding looking at a field on the stack matters at all. -hpa