Received: by 10.213.65.68 with SMTP id h4csp1351312imn; Wed, 21 Mar 2018 08:36:25 -0700 (PDT) X-Google-Smtp-Source: AG47ELvR5LnHMSiZinOMOYxc2yxpYhMAxQorpp1v0P/IR0EQxtKbFOVUSXC8w8jofiAXNfqlbDwB X-Received: by 2002:a17:902:8d92:: with SMTP id v18-v6mr21143476plo.21.1521646585334; Wed, 21 Mar 2018 08:36:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521646585; cv=none; d=google.com; s=arc-20160816; b=j1gNNK+sLVBqfukc0UreAMCL/Mzh0emK50NfusfI2HQIMhKIUVLy8ulXpPelS384Et z89rrWmPqnXEbafW9IZI1nWOgg1loSiQuXOdaRRLd+4aislWM58EW59ljqUWQ3y6f+aB lnaRnzuXs/Ruf1aAqe8lOt0VdqS/4fjzAsefFqNo37LsU35HiZKo9C32l7OoHxPIaH32 h4A3c4rnROcfqxjZDvPBv2zCwakS1PjVwBjdOSSxXvPoQBCcMAHUlgfse5nua4UB32tF exam+WKUglXak4MZEk+lb4RxiOHD/OKksEhDZPhUkMDpwFC6BLHzbm2Lq6NQlWFoV3m1 WNJA== 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:cc:references:to:subject:arc-authentication-results; bh=03fqh+NeZg8d3ov5Bk+FfUjZJSIIpb9wumj6Ij5t03M=; b=q5t/eOJA4UiCzTebJn6jT7Dzf4tFolkwdgG40b+ImDrH6JxAtggHTJB2XjMXi175wp nWb80huLWhHNCL5rUVqZmdJcaiojfPrL1HOqaJg5PJWyTmZjpXTf2/3BBRx40iQGLR0c KrkRTH96RgKI8uaWPpa7k5xNS+zSKyvHkqOeK3KR50HZHe1mdXqmf2j+DsVJieq1E5XL tjEcJYKvIAAuqFsc5BqSXyhTeZ/MU46cEbtqeFdUI/qRhh0URRJKeHkYRFRGBPSUplLj w3Q4QytVPLpda+JvxapkIaFqUxYUPmFe8qQcI0KX3OQ7G4ytx34yhaPsAQEpfvM62x4n C+Ng== 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 j5si3191530pfi.225.2018.03.21.08.36.10; Wed, 21 Mar 2018 08:36:25 -0700 (PDT) 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 S1752739AbeCUPfN (ORCPT + 99 others); Wed, 21 Mar 2018 11:35:13 -0400 Received: from mga11.intel.com ([192.55.52.93]:37809 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752614AbeCUPfM (ORCPT ); Wed, 21 Mar 2018 11:35:12 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 Mar 2018 08:33:30 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,340,1517904000"; d="scan'208";a="27232812" Received: from unknown (HELO [10.7.201.126]) ([10.7.201.126]) by orsmga008.jf.intel.com with ESMTP; 21 Mar 2018 08:33:30 -0700 Subject: Re: [PATCH RFC v9 2/7] x86/entry: Add STACKLEAK erasing the kernel stack at the end of syscalls To: alex.popov@linux.com, Peter Zijlstra , Laura Abbott , Linus Torvalds , Kees Cook , Andy Lutomirski 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> Cc: PaX Team , Brad Spengler , Ingo Molnar , 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, "kernel-hardening@lists.openwall.com" From: Dave Hansen Message-ID: <295a6830-fce9-ee00-f45d-7dafd74d11a1@linux.intel.com> Date: Wed, 21 Mar 2018 08:33:29 -0700 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: 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 03/21/2018 04:04 AM, Alexander Popov wrote: > The main obstacle: > erase_kstack() must save and restore any modified registers, because it is > called from the trampoline stack (introduced by Andy Lutomirski), when all > registers except RDI are live. Wow, cool, thanks for doing this! PTI might also cause you some problems here because it probably won't map your function. Did you have to put it in one of the sections that gets mapped by the user page tables?