From patchwork Thu Nov 30 16:39:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Will Deacon X-Patchwork-Id: 120227 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp14902qgn; Thu, 30 Nov 2017 08:41:20 -0800 (PST) X-Google-Smtp-Source: AGs4zMb8N9w43GO5ruA/p+vjvhQBPZ1JFQBPjfVOpNQ60C6GWhnZd5r79gPLye6Z+RivGEckUpj+ X-Received: by 10.101.70.11 with SMTP id v11mr2910014pgq.306.1512060080089; Thu, 30 Nov 2017 08:41:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512060080; cv=none; d=google.com; s=arc-20160816; b=N9Rf3i4utnWi+lmq14TM9LT/y3+rrJHHQ/QZvLrBBhEo+a9RULuSKSwbX7/LvX5jEL i6BEZafxL7DSBOawI17rVwxh2EnI6NSaikSELbgXmFKqbvyTTPtNNyhlnaRkMzFar4Xj 34/mERMy1IJdXK0gXZtQmj3H/lQmbwgWbTtlRJCrlkDYnlqoVjN45xufFfO98ko1DfmN srkRyrJRa408T6pKgAIjDDge//ZJiA4Dtvni4Dx69LpYWl3SxVEAFsJcZjsYhmRhkqLm h91ijAhetQ/d1doYy1xFRjFGFHBz67T+9ctHn3MyhNOY/ZSEI8g9lr++qZ1kH65SglEX 5ylA== 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=n70RXBSLuXhyWLspoI0EYQyEdySg+bxuJ4tPpiOFrUg=; b=OoYRQg62hOFEOXK5DKn5TqlYJtnQe7HW5EEGa71vs3X9nthsbiAhNMJZeU50q6x63y OAZO9acwo0+rT1Wu8kefyaTxgrAnaJw6kzfTFKIti6C55Lot/G61TXVAH6BGUocEwioe E/dz60V3UaREgegAe53r4MjW1cODCT2LbgTHKZKYy8OnlGd2kyWiUXa+WfK55fQ68RV3 xS1CLxUxOFKqfocvSF2WWIfikvAiPsvT/4FVuFuDUjDH2uBkTIm4nfqSVvuK/sA8FMfO dXb1Y9kjh2RfCVpLRQezxB45whdI0WmI3OkLHkFVkcRoSCln9p0kkigtG2p2BwzHuwvp ALxg== 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 g5si3409671pll.15.2017.11.30.08.41.19; Thu, 30 Nov 2017 08:41:20 -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 S1753482AbdK3Qkh (ORCPT + 28 others); Thu, 30 Nov 2017 11:40:37 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:57576 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753369AbdK3Qjr (ORCPT ); Thu, 30 Nov 2017 11:39:47 -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 C740A1AED; Thu, 30 Nov 2017 08:39:45 -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 98F863F318; Thu, 30 Nov 2017 08:39:45 -0800 (PST) Received: by edgewater-inn.cambridge.arm.com (Postfix, from userid 1000) id 7E86F1AE3E09; Thu, 30 Nov 2017 16:39:48 +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, msalter@redhat.com, labbott@redhat.com, tglx@linutronix.de, Will Deacon Subject: [PATCH v2 17/18] arm64: Kconfig: Add CONFIG_UNMAP_KERNEL_AT_EL0 Date: Thu, 30 Nov 2017 16:39:45 +0000 Message-Id: <1512059986-21325-18-git-send-email-will.deacon@arm.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1512059986-21325-1-git-send-email-will.deacon@arm.com> References: <1512059986-21325-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 fdcc7b9bb15d..3af1657fcac3 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -833,6 +833,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