Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752584AbbDBGSz (ORCPT ); Thu, 2 Apr 2015 02:18:55 -0400 Received: from cantor2.suse.de ([195.135.220.15]:40029 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752484AbbDBGSy (ORCPT ); Thu, 2 Apr 2015 02:18:54 -0400 Date: Thu, 2 Apr 2015 08:16:53 +0200 From: Borislav Petkov To: Denys Vlasenko Cc: Andy Lutomirski , Ingo Molnar , x86@kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH urgent] x86, asm: Disable opportunistic SYSRET if regs->flags has TF set Message-ID: <20150402061653.GA4579@pd.tnic> References: <2805a341e0dddb37b018486b0ab4162e2f2fb118.1427916036.git.luto@kernel.org> <551C6098.9030705@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <551C6098.9030705@redhat.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1729 Lines: 51 On Wed, Apr 01, 2015 at 11:18:16PM +0200, Denys Vlasenko wrote: > On 04/01/2015 09:25 PM, Andy Lutomirski wrote: > > Fix it by using IRET to restore TF. Since it's late, I'm keeping > > this minimal and keeping "testq" instead of switching to "testl". > > Changing to "testl" here wins nothing. Except less data (a dword) being shuffled and tracked for dependencies in the machine instead of qword. > Since r11 is used, REX prefix will be encoded anyway. As a future cleanup, one could use one of the "old", i.e. not-extended registers to save 2 bytes per insn (REX pfx and ModRM) but one has to remember to do mov %rax, %r11 in the end. And yep, it should preferrably be %rax as we have opcode 0xa9 which tests an immediate and RAX and saves us the ModRM as we don't need to specify a register. orig: a42: 49 f7 c3 00 00 01 00 test $0x10000,%r11 a49: 75 41 jne a8c Andy: a42: 49 f7 c3 00 01 01 00 test $0x10100,%r11 a49: 75 41 jne a8c testl: a42: 41 f7 c3 00 01 01 00 test $0x10100,%r11d a49: 75 41 jne a8c %rax: a42: a9 00 01 01 00 test $0x10100,%eax a47: 75 41 jne a8a -- Regards/Gruss, Boris. ECO tip #101: Trim your mails when you reply. -- -- 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/