From patchwork Tue Apr 3 11:09:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Rutland X-Patchwork-Id: 132722 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp3666158ljb; Tue, 3 Apr 2018 04:10:20 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/YwC1u7Ot3gFhvX/HP9SwlAJl4uMxjkJsieDDUpjTvaW6HLK1GpdbmxrMVh2vZ3QrcXO62 X-Received: by 2002:a17:902:158b:: with SMTP id m11-v6mr13642035pla.300.1522753820538; Tue, 03 Apr 2018 04:10:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522753820; cv=none; d=google.com; s=arc-20160816; b=mNYfFffygqVkavwyWM4IrTX9s1AjluWbGHPcVAriZf+RCwMSsvwtdJLdokgLQMYZjZ zzXfEJMahzo/lHfgZBa1rAX0yye175x1IdMHOO+eBrqjnH8y3AoMcXGsYaRGjxsTcZAY VIgw7poHzkIhsEe6A3Cw4qwSs6ZUhWOxHi19elQTKhM2dwrgJuvHCBzlIZCBWyh07jRE vj7RvOA2OczoLLkx+LzaFQT2QpqwbmBOMFtiQyVJw3zEsLbYw1/KnGO80DYgAJpcqTnJ LDxM6QM+RL1lArQiwNWKFwUiwTGjErCwNjOrmpamsyU0yyTnyRodRk7hlE2hT9W21V0k b7Pw== 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=rWmmMK/ZiYuDHn+CJ4397Yu+O6Nc6r9VsJHBYOA2KeQ=; b=QLDpsM2RweS7kPNynqXEwUz92DlmgROD7KQD96CgrJCn1AYkCY94tBM9uD5MI+dare fy1i/MEtktrwGtwlLnP3KovNSuZP8yBtNsfucmpGrztE0WjJhW3si8iknOxpzGdRZW34 pXPDsZuR5BP5Ry5XT5dgEo0EPUO6/eWS7c1QI+KrSjoUJDxH2A3aFK2q61+P+W7IbVpF khuV8LrVImPmit2YoXzttLHH38pPUeNv2B/jgC3LABhMYLxiyux8xqKIrXJ25joq/fQy 6OMa/2yL4LcmoVAhdU9YVW+qk7TrJYVMEViXBBBLiO7YWmAlsON5X5m3913MZ4xf7ynE lv9Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-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 l91-v6si306341plb.301.2018.04.03.04.10.20; Tue, 03 Apr 2018 04:10:20 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-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 stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755503AbeDCLKT (ORCPT + 11 others); Tue, 3 Apr 2018 07:10:19 -0400 Received: from foss.arm.com ([217.140.101.70]:59368 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755402AbeDCLKS (ORCPT ); Tue, 3 Apr 2018 07:10:18 -0400 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 0620B1435; Tue, 3 Apr 2018 04:10:18 -0700 (PDT) Received: from lakrids.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 C9AA33F587; Tue, 3 Apr 2018 04:10:16 -0700 (PDT) From: Mark Rutland To: stable@vger.kernel.org Cc: mark.brown@linaro.org, ard.biesheuvel@linaro.org, marc.zyngier@arm.com, will.deacon@arm.com Subject: [PATCH v4.9.y 16/27] arm64: Kconfig: Add CONFIG_UNMAP_KERNEL_AT_EL0 Date: Tue, 3 Apr 2018 12:09:12 +0100 Message-Id: <20180403110923.43575-17-mark.rutland@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180403110923.43575-1-mark.rutland@arm.com> References: <20180403110923.43575-1-mark.rutland@arm.com> Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Will Deacon commit 084eb77cd3a8 upstream. 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. Reviewed-by: Mark Rutland Tested-by: Laura Abbott Tested-by: Shanker Donthineni Signed-off-by: Will Deacon Signed-off-by: Alex Shi [v4.9 backport] Signed-off-by: Mark Rutland [v4.9 backport] --- arch/arm64/Kconfig | 13 +++++++++++++ 1 file changed, 13 insertions(+) -- 2.11.0 diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index 7769c2e27788..6b6e9f89e40a 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -733,6 +733,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