From patchwork Fri Nov 17 18:22:01 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Will Deacon X-Patchwork-Id: 119197 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp844116qgn; Fri, 17 Nov 2017 10:23:09 -0800 (PST) X-Google-Smtp-Source: AGs4zMZC5RJMgEHYDOvqiAkKUqilPoKnJ5/Qn9R5s2riQ4P0dDurCMYnbJdb5CDfSNpt2IAZWuPt X-Received: by 10.99.108.66 with SMTP id h63mr5962969pgc.362.1510942989102; Fri, 17 Nov 2017 10:23:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510942989; cv=none; d=google.com; s=arc-20160816; b=P84rocyyRQyYesoKXUVhdLDOiq5in5aiSO9r71KMgM1R2yLsjm2Bz1VpWU0aE92xPj b7kSv/rcaFC98pNlLgZ7OOKoUYwV1MFBSby+wxu9NhGw8f+ncRLx37SVMxzWpCyk/zRw IjV4Mlp8TQJY4fuU5/nXEU3Eg9g+1BcFbd78/D++cNsDQKwFA6szaf6sJYM6joZLhY5H ERtesCr/BMGBsX/uA23dkkaViC5VI+Tg3jr5tbvQ+8Y5qmlvIVJZvA6CAHrwc+wgbTX+ +6MDPLc5t628Th4HwDJjdrdM/2K+b1Eer95DlN0d2T+jL5oCaLz6Bqle4nwcX4RxTkH2 ENmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=qsKfeItzhCYGiPJQ8gapOR1rLd52bThpe+fuui1MwIg=; b=T3hcCUPyzyXXe4BgEZLJDNwz7kyTwNEMIvikB856BH1Wm8RiDYbUpxHOY+5ERN+xvI fJsatv+uh2bMvnqm4MFs3udNydyBCSSm3l1W+owhjAr8ApQBoSu1326AKZ8blxWRjTKL EkrfkaxCt76XFhQjEdbhtomCam14w03sETHFJNLSVErh37OmoVI9lvh9CCJedtPBlTMn jZpJ68cDjsLmR9LE0OAtaPzzunbieJtX8NY8UcGF9jlCTBr57rHMYoAFH4fP38e/XUIV so7frw/NW8dCeFp7oynNn8i3/qQUnvO8BOXaVyMvkT4866btslz8DnENulbpOTX9q6IR dx6w== 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 g12si3179518pla.762.2017.11.17.10.23.08; Fri, 17 Nov 2017 10:23:09 -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 S1752102AbdKQSXF (ORCPT + 28 others); Fri, 17 Nov 2017 13:23:05 -0500 Received: from foss.arm.com ([217.140.101.70]:39478 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760319AbdKQSWD (ORCPT ); Fri, 17 Nov 2017 13:22:03 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id E1EE61AC1; Fri, 17 Nov 2017 10:21:55 -0800 (PST) Received: from edgewater-inn.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id B37463F599; Fri, 17 Nov 2017 10:21:55 -0800 (PST) Received: by edgewater-inn.cambridge.arm.com (Postfix, from userid 1000) id 03F941AE17F5; Fri, 17 Nov 2017 18:22:03 +0000 (GMT) From: Will Deacon To: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org, catalin.marinas@arm.com, mark.rutland@arm.com, ard.biesheuvel@linaro.org, sboyd@codeaurora.org, dave.hansen@linux.intel.com, keescook@chromium.org, Will Deacon Subject: [PATCH 18/18] arm64: Kconfig: Add CONFIG_UNMAP_KERNEL_AT_EL0 Date: Fri, 17 Nov 2017 18:22:01 +0000 Message-Id: <1510942921-12564-19-git-send-email-will.deacon@arm.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1510942921-12564-1-git-send-email-will.deacon@arm.com> References: <1510942921-12564-1-git-send-email-will.deacon@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add a Kconfig entry to control use of the entry trampoline, which allows us to unmap the kernel whilst running in userspace and improve the robustness of KASLR. Signed-off-by: Will Deacon --- arch/arm64/Kconfig | 13 +++++++++++++ 1 file changed, 13 insertions(+) -- 2.1.4 diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index f0fcbfc2262e..f99ffb88843a 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -796,6 +796,19 @@ config FORCE_MAX_ZONEORDER However for 4K, we choose a higher default value, 11 as opposed to 10, giving us 4M allocations matching the default size used by generic code. +config UNMAP_KERNEL_AT_EL0 + bool "Unmap kernel when running in userspace (aka \"KAISER\")" + default y + help + Some attacks against KASLR make use of the timing difference between + a permission fault which could arise from a page table entry that is + present in the TLB, and a translation fault which always requires a + page table walk. This option defends against these attacks by unmapping + the kernel whilst running in userspace, therefore forcing translation + faults for all of kernel space. + + If unsure, say Y. + menuconfig ARMV8_DEPRECATED bool "Emulate deprecated/obsolete ARMv8 instructions" depends on COMPAT