From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752783AbbC2Vqd (ORCPT ); Sun, 29 Mar 2015 17:46:33 -0400 Received: from mail-qg0-f44.google.com ([209.85.192.44]:36855 "EHLO mail-qg0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752487AbbC2Vqc (ORCPT ); Sun, 29 Mar 2015 17:46:32 -0400 MIME-Version: 1.0 In-Reply-To: References: <1427373731-13056-1-git-send-email-dvlasenk@redhat.com> <20150327081141.GA9526@gmail.com> <551534B1.6090908@redhat.com> <20150327111738.GA8749@gmail.com> <20150327113430.GC14778@gmail.com> <551549AF.50808@redhat.com> <20150327121645.GC15631@gmail.com> <55154DB3.9000008@redhat.com> <20150328091106.GA5361@gmail.com> From: Denys Vlasenko Date: Sun, 29 Mar 2015 23:46:11 +0200 Message-ID: Subject: Re: [PATCH] x86/asm/entry/64: better check for canonical address To: Andy Lutomirski Cc: Ingo Molnar , Denys Vlasenko , Brian Gerst , Borislav Petkov , "the arch/x86 maintainers" , Linux Kernel Mailing List , Linus Torvalds Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Mar 29, 2015 at 11:12 PM, Andy Lutomirski wrote: > On Sun, Mar 29, 2015 at 12:36 PM, Denys Vlasenko > wrote: >> The instruction would need a differentiator whether returned-to code >> is 64-bit or 32-bit. >> Then it probably can use the same approach SYSRET{O,L} uses: >> with REX.W, return is to 64-bit; without it, return is to 32-bit. >> >> Interrupt return then can check pt_regs->cs and use >> IRETL_FAST if it is USER32_CS; use IRETQ_FAST if it is USER_CS >> or KERNEL_CS; otherwise, fall back to slow but "universal" IRETQ. Hmm. In fact since we'd need such checks, then instructions can be even simpler: they don't even need to check CPL, it can be hardcoded too. We'd need four instructions then: return to 64 and to 32 bits, to CPL0 and to CPL3. >> Do we have contacts at Intel to petition for this? :D > > Some of us do and have petitioned :) And what did Intel say? If there's any interest in doing this, Intel better *do* talk to us before they commit to implementing it. Their track record in implementing "fast syscalls" is nothing to write home about. SYSENTER is a design disaster; SYSRET is buggy.