Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966418AbbDWPwj (ORCPT ); Thu, 23 Apr 2015 11:52:39 -0400 Received: from mail-la0-f45.google.com ([209.85.215.45]:36032 "EHLO mail-la0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965475AbbDWPwi (ORCPT ); Thu, 23 Apr 2015 11:52:38 -0400 MIME-Version: 1.0 In-Reply-To: <20150423154926.GM28327@pd.tnic> References: <1429633649-20169-1-git-send-email-dvlasenk@redhat.com> <20150423151047.GJ28327@pd.tnic> <20150423154926.GM28327@pd.tnic> From: Andy Lutomirski Date: Thu, 23 Apr 2015 08:52:16 -0700 Message-ID: Subject: Re: [PATCH] x86/asm/entry/64: better check for canonical address To: Borislav Petkov Cc: Denys Vlasenko , Ingo Molnar , Linus Torvalds , Steven Rostedt , "H. Peter Anvin" , Oleg Nesterov , Frederic Weisbecker , Alexei Starovoitov , Will Drewry , Kees Cook , X86 ML , "linux-kernel@vger.kernel.org" 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: 1832 Lines: 53 On Thu, Apr 23, 2015 at 8:49 AM, Borislav Petkov wrote: > On Thu, Apr 23, 2015 at 08:41:15AM -0700, Andy Lutomirski wrote: >> I was rather vague there. Let me try again: >> >> If anyone in the AMD camp really cared, we could add a new bug flag >> X86_BUG_SYSRET_NEEDS_CANONICAL_RCX and set it on Intel chips only, so >> we could use alternatives to patch out the check when running on >> sensible AMD hardware. This would speed the slow path up by a couple >> of cycles on AMD chips. >> >> Does that make more sense? We could call it >> X86_BUG_SYSRET_NEEDS_CANONICAL_RIP if that makes more sense. > > Actually "...NEEDS_CANONICAL_RCX" makes more sense as this is what we're > going to patch out eventually, if it makes sense - the RIP canonicalness > test is being done as part of SYSRET, just RCX is not being tested. > > Tell you what - how about I perf stat this first by commenting out that > couple of instructions on AMD to see whether it brings anything. > > Got an idea for a workload other than a kernel build? :-) > > Although a kernel build should do a lot of syscalls too... Kernel build should be fine. Or "timing_test_64 10 sys_enosys 1" or "perf_self_monitor" (warning: WIP). Make sure you either have context tracking forced on or something else (audit?) that forces the slow path, though, or you won't see it at all. https://git.kernel.org/cgit/linux/kernel/git/luto/misc-tests.git/ --Andy > > Thanks. > > -- > Regards/Gruss, > Boris. > > ECO tip #101: Trim your mails when you reply. > -- -- Andy Lutomirski AMA Capital Management, LLC -- 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/