Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935338AbeAKSoo (ORCPT + 1 other); Thu, 11 Jan 2018 13:44:44 -0500 Received: from one.firstfloor.org ([193.170.194.197]:42332 "EHLO one.firstfloor.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934939AbeAKSon (ORCPT ); Thu, 11 Jan 2018 13:44:43 -0500 Date: Thu, 11 Jan 2018 10:44:40 -0800 From: Andi Kleen To: Andi Kleen Cc: Andy Lutomirski , Brian Gerst , Thomas Gleixner , the arch/x86 maintainers , Linux Kernel Mailing List , Linus Torvalds , David Woodhouse , Paul Turner , Andy Lutomirski , Peter Zijlstra , Tom Lendacky , Tim Chen , Greg Kroah-Hartman , Dave Hansen , Jiri Kosina , Andi Kleen Subject: Re: [PATCH v1 1/8] x86/entry/clearregs: Remove partial stack frame in fast system call Message-ID: <20180111184440.w3rmykkswnthvo2f@two.firstfloor.org> References: <20180110010328.22163-1-andi@firstfloor.org> <20180110010328.22163-2-andi@firstfloor.org> <20180111001626.m5cgtngkmoskuhyh@two.firstfloor.org> <550472D4-8A2E-4219-B1ED-71EA5597E3A2@amacapital.net> <4E2A660B-720F-43B2-A08F-F48CC8D91E05@amacapital.net> <20180111014747.d5k4bpggmqxmczu5@two.firstfloor.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180111014747.d5k4bpggmqxmczu5@two.firstfloor.org> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: > Well it's kernel hardening to guard against possible future speculation > attacks. Linus discussed it here for example: > > https://www.mail-archive.com/linux-kernel@vger.kernel.org/msg1580667.html > > For the on/off switch I can add a CONFIG to enable it, even though > it seems somewhat silly. I did some micro benchmarking now, sampling different real system calls. For the entry code (entry to call) I get on average 62 cycles for the old code, vs 78 cycles with clear regs and full stack frame saving on Skylake. So it's roughly ~20 cycles difference, if we include the restore. I would conclude 20 cycles are not significant for a syscall, so there's not a lot of motivation to add a switch for less security. -Andi