Received: by 10.223.185.116 with SMTP id b49csp3061019wrg; Mon, 5 Mar 2018 13:23:40 -0800 (PST) X-Google-Smtp-Source: AG47ELtCEz26duhCk2+06DkJ+i4Q3+Px+R68WtBeTS6vAIYPac+q+HE1OpQoD0L8ILcEflKtV+DC X-Received: by 2002:a17:902:2de4:: with SMTP id p91-v6mr14539957plb.405.1520285020710; Mon, 05 Mar 2018 13:23:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520285020; cv=none; d=google.com; s=arc-20160816; b=Po+zlEYaCw1W5CkI28DgvQKJONCZFOXMLMZTXur9HbFY2Vkp1Iff4vZQGIxH+SQyvh LyZ1lRVsBh3EdpKWbzGIThKgiNWKO5YYBoMz3UFwuNsoan/H0d7reyECUhkM8VYGcho8 HumFy4c3WUpfiEOALm2rBgYtS8fHEui5mPpP2ATNqnFFE/KxCC2a9/Sjue3aD84wiLkw h+cFhj9V7xWJAbX8PpnULcoOutJhi1ZF09tWrZR11a0YhI0P9+zP6nmhmvdnWE3RXXhc yEPETu5gI0lu9X3aT8+FM+qzIiIX0DlL3TQI56GWAqmc/WWjCdSg5OglnZdEqT7k8WZZ TkEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:reply-to :arc-authentication-results; bh=ovbioeu3FJulazaiyFUtq1qmtUqL9+m9g4iE+OKG3IE=; b=Aj8/K2bxtDFLnix7OWd1j2c6tRpe2pDYfH8xLlPiRPViaPDNfANuI7kdngC35TRfAw Ugnu47nwjMEO5LlWW6+jVvHsZBolVahHoIw8NDtVcRiyENLRvzqoaeRDjBmPlPtnUzUw a0G7d9vRmjhS59wslDgHRr5Rwr52A6ScM/O9bnovdYA9tmhCkchhqlywO7pvbBqR4UhT haUJIWHyjC49P6eN1/K73i881BLfVxBhkju6R7HtgiTnthJ5FNSn7/t4QuJMbLctux1C bVKAsyvB5e61djV8u4ZuU04BRWoTOaFSbQ87gxI5uppgxAH4ST0mWIJm9O86Gx7QS6HY ELPQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b9si8774329pgn.443.2018.03.05.13.23.26; Mon, 05 Mar 2018 13:23:40 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753164AbeCEVVI (ORCPT + 99 others); Mon, 5 Mar 2018 16:21:08 -0500 Received: from mail-lf0-f66.google.com ([209.85.215.66]:33507 "EHLO mail-lf0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752630AbeCEVVH (ORCPT ); Mon, 5 Mar 2018 16:21:07 -0500 Received: by mail-lf0-f66.google.com with SMTP id o145so25307455lff.0 for ; Mon, 05 Mar 2018 13:21:06 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:reply-to:subject:to:cc:references:from :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=ovbioeu3FJulazaiyFUtq1qmtUqL9+m9g4iE+OKG3IE=; b=FczYSFbU7fr1ew5XGSmcXFCH+ng97FvmSQo1tIwQwnZ9+egI07+CjW8ixbkqpVPtKQ V61HZbl8XiRCnNDmFUZCYSjP2NweB2OCNXAL2hcLfb35C8IrDCVOu86bCfU/ufJOxQOB FlTDeoQPNl1fUSAQxqkeYjyH/WGj3TmNczqAD/uAfy8hFq5flkOjevEmp2p0D98ylSF5 c9wMHEEcuGgaiKc+2eQ5H3aW2jgwsJCGB2/DmgTsGikPDhhD6qQneAoM+IbWZYtqQV5+ l3ZWVVj07BK203vzI7KVCtiRATCNMkSNvCTI/NTPHDikjLJJ23r0/9y4o3sXo8DDM774 En3g== X-Gm-Message-State: APf1xPC5DUAbpNpciMX0l7i3EzMyBxgTSowtlFTIPNIumAxPDNBE4heR MZ41SzhI2hQPUak1WM40JdjmzA0mmsI= X-Received: by 10.46.86.201 with SMTP id k70mr10739688lje.16.1520284865811; Mon, 05 Mar 2018 13:21:05 -0800 (PST) Received: from [192.168.1.147] ([176.15.214.2]) by smtp.gmail.com with ESMTPSA id e123sm2211281lfg.47.2018.03.05.13.21.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Mar 2018 13:21:04 -0800 (PST) Reply-To: alex.popov@linux.com Subject: Re: [PATCH RFC v9 2/7] x86/entry: Add STACKLEAK erasing the kernel stack at the end of syscalls To: Peter Zijlstra , Laura Abbott Cc: Dave Hansen , kernel-hardening@lists.openwall.com, Kees Cook , PaX Team , Brad Spengler , Ingo Molnar , Andy Lutomirski , Tycho Andersen , Mark Rutland , Ard Biesheuvel , Borislav Petkov , Richard Sandiford , Thomas Gleixner , "H . Peter Anvin" , "Dmitry V . Levin" , Emese Revfy , Jonathan Corbet , Andrey Ryabinin , "Kirill A . Shutemov" , Thomas Garnier , Andrew Morton , Alexei Starovoitov , Josef Bacik , Masami Hiramatsu , Nicholas Piggin , Al Viro , "David S . Miller" , Ding Tianhong , David Woodhouse , Josh Poimboeuf , Steven Rostedt , Dominik Brodowski , Juergen Gross , Greg Kroah-Hartman , Dan Williams , Mathias Krause , Vikas Shivappa , Kyle Huey , Dmitry Safonov , Will Deacon , Arnd Bergmann , x86@kernel.org, linux-kernel@vger.kernel.org References: <1520107232-14111-1-git-send-email-alex.popov@linux.com> <1520107232-14111-3-git-send-email-alex.popov@linux.com> <94f268b2-31a4-620a-86ed-325d5bb33c57@redhat.com> <20180305202535.GX25201@hirez.programming.kicks-ass.net> From: Alexander Popov Message-ID: Date: Tue, 6 Mar 2018 00:21:02 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <20180305202535.GX25201@hirez.programming.kicks-ass.net> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 05.03.2018 23:25, Peter Zijlstra wrote: > On Mon, Mar 05, 2018 at 11:43:19AM -0800, Laura Abbott wrote: >> On 03/05/2018 08:41 AM, Dave Hansen wrote: >>> On 03/03/2018 12:00 PM, Alexander Popov wrote: >>>> Documentation/x86/x86_64/mm.txt | 2 + >>>> arch/Kconfig | 27 ++++++++++ >>>> arch/x86/Kconfig | 1 + >>>> arch/x86/entry/entry_32.S | 88 +++++++++++++++++++++++++++++++ >>>> arch/x86/entry/entry_64.S | 108 +++++++++++++++++++++++++++++++++++++++ >>>> arch/x86/entry/entry_64_compat.S | 11 ++++ >>> >>> This is a *lot* of assembly. I wonder if you tried at all to get more >>> of this into C or whether you just inherited the assembly from the >>> original code? >>> >> >> This came up previously http://www.openwall.com/lists/kernel-hardening/2017/10/23/5 >> there were concerns about trusting C to do the right thing as well as >> speed. > > And therefore the answer to this obvious question should've been part of > the Changelog :-) > > Dave is last in a long line of people asking this same question. Yes, actually the changelog in the cover letter contains that: After some experiments, kept the asm implementation of erase_kstack(), because it gives a full control over the stack for clearing it neatly and doesn't offend KASAN. Moreover, later erase_kstack() on x86_64 became different from one on x86_32. Best regards, Alexander