Received: by 10.223.185.116 with SMTP id b49csp3073164wrg; Mon, 5 Mar 2018 13:39:04 -0800 (PST) X-Google-Smtp-Source: AG47ELu/c3rJjt4ChS/t2q4iBleTEwDJ+uZ+XoXKr8a2KO32l4Id/wF+U+s2XwWVRknrh+ucBBT2 X-Received: by 2002:a17:902:68cc:: with SMTP id x12-v6mr14404770plm.198.1520285944732; Mon, 05 Mar 2018 13:39:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520285944; cv=none; d=google.com; s=arc-20160816; b=lxUAWK7kUgPs1GTyjgSIQo4ZMNa0CB4DVe7+FRYTUTFz6ZQNZF4fIxQ+Lq+dSNwHOJ c8iS6FBdXhuhs/cogF/tXLnI+xScV1r+1VICYAVgc1XxvG3gCglkFGh8bmnfYutHfs+o XLkcxsxYtHSkfApel1+aDSD8J8rlZH2ESjXRFFFJfq+tu+GgEMZLigBH/yZyYmJiGIop odf49HhFdU4iz7Vz/Mow3o8E4cU7wIL7xHHnVwmsm0CkRB7AJ8/YE7c8cPpxx2tug/pT RAD5L2iOW8cTuieEhZgrKwKQWb+bboF8utg0HJW92u/2/730+JxXMPQmuZ/KBEsT0tu2 wCBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature:dkim-signature :arc-authentication-results; bh=nH4/+MrbblmnhL8cmzeJEbuWBaMg3iFgKfv1tcT2WRA=; b=uWChedfTXpPyUqxPArHgBrYoOGTJPdD3V+E+3+w3GHu8eP5oGFcqtbBZLUu+b1kg1f m6TU1mXu7vCjOt3C1JLOKDh7Cd6wM2/2vCnXvUjZG6JHCZUa/gMWxg/AuTGpwErjLrMW YbKiab/E2PXL0hC7eiqYFbibK04JevvJ5mLN5OBWxSJTchpIPqKUvf6O2beovn7Tzqnn u4fS0hxmGJMp6od72yX1TELaRNuGU4/L1J8mlChyCHafWZUz2jQ2Km3bxLBa8ZB1rrBJ H7FatkBohAyS1IOWbN5nbfAvtLw4iv4MWoG4DTtB/wg9Wk2hZKfxV3FrdJrwhO27FilE jpRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@google.com header.s=20161025 header.b=SOZ333G2; dkim=fail header.i=@chromium.org header.s=google header.b=BWj1atfs; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p2si8879103pga.143.2018.03.05.13.38.50; Mon, 05 Mar 2018 13:39:04 -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; dkim=fail header.i=@google.com header.s=20161025 header.b=SOZ333G2; dkim=fail header.i=@chromium.org header.s=google header.b=BWj1atfs; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933187AbeCEVgI (ORCPT + 99 others); Mon, 5 Mar 2018 16:36:08 -0500 Received: from mail-vk0-f67.google.com ([209.85.213.67]:39301 "EHLO mail-vk0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932470AbeCEVgD (ORCPT ); Mon, 5 Mar 2018 16:36:03 -0500 Received: by mail-vk0-f67.google.com with SMTP id f6so1485297vkh.6 for ; Mon, 05 Mar 2018 13:36:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=nH4/+MrbblmnhL8cmzeJEbuWBaMg3iFgKfv1tcT2WRA=; b=SOZ333G21sX+DnDPx5hrNQ6Stl4KbUUYo2KeQNY2bRqCHHdKTqeiG867nt7dOpFEGL OnCv+T55QgOxImsBKK0LtXzAweoidjHuccSXoZZYo+YfM1rM1Qw8tVhcTwBpL8nsvIFA A/rkd4jsu2gyBSvC9fOODKjB85iLCzkNPHD9wn1EDr9rD0E4o4bIxfOPSWrLEOeg0B/u vlZXEV5y9OYPzMF/g/OoWkm37Fzdai5rx6z7dqd6jvfsylvXL+zjlZF6a+ub8OUNzsLx TtbSduNz7ywdz/wrxvpjYDzwL3gI5KrTG8lRzMK8NlEj8yXdEIJfWA94JoVnmuxApA4E 8ENQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=nH4/+MrbblmnhL8cmzeJEbuWBaMg3iFgKfv1tcT2WRA=; b=BWj1atfsf+ntv/+m34MyT12x9X7tAKeg6pep3uEuscrcCz9U0BGCesigNXudysQEWj GIwtqcaeNZkDjAzMdcQoQQRi4GrRpScYvw8dNZXp9YYAOzWmIhQHxEjVyPPMSWbUjkAA Z16Kpram3j1wkeanM6L5u89JgUFA3zVw8wKic= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=nH4/+MrbblmnhL8cmzeJEbuWBaMg3iFgKfv1tcT2WRA=; b=H4+Iof2zz1T35S+pWoCUpLKF0m3axq8LpIyko8vfJ+juUhgAeX4bn2zeT+ZwBvMxsa uirX+DIQWK/8Owx4DDo8mi7ybT2ogZv1uXzBngdYfphCEJLWxiskMWuLS5Cv8agn5EBO 0mPDWSq3fCr5pEvJlMgBFcvIeGllMK8S3XFE00XRaEvDC29TUlS/L71i3HFzQR3UG99U kdtmy1ZOEnwXN3dGopwC5uxZensoLloaAQek/Dzhxdl/FWDHY+CBG0olTlJUeHclDoOU Q4/AC2a9ChvalGTZWfziTX+H0fudoAiPZ9lBU2rSOsOqILlABWhY9KdkE1d94e10TC0H 4x6g== X-Gm-Message-State: APf1xPD4vOS8n6NUiQbP4IPTrU94tMPk0hFJe8xRR6W/F5twYn6/I8Cj kndW/L1cQAR0LFFG4WN+fZ/zIhNMWxZpHZvdF9UwFA== X-Received: by 10.31.192.210 with SMTP id q201mr11217951vkf.7.1520285761579; Mon, 05 Mar 2018 13:36:01 -0800 (PST) MIME-Version: 1.0 Received: by 10.31.242.140 with HTTP; Mon, 5 Mar 2018 13:36:01 -0800 (PST) In-Reply-To: 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: Kees Cook Date: Mon, 5 Mar 2018 13:36:01 -0800 X-Google-Sender-Auth: rxKex_gJDMBdlGpTVnz5yxDeI8U Message-ID: Subject: Re: [PATCH RFC v9 2/7] x86/entry: Add STACKLEAK erasing the kernel stack at the end of syscalls To: Alexander Popov Cc: Peter Zijlstra , Laura Abbott , Dave Hansen , Kernel Hardening , 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 ML , LKML Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 5, 2018 at 1:21 PM, Alexander Popov wrote: > 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. Maybe explicitly mention the C experiments in future change log? -Kees -- Kees Cook Pixel Security