Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2211996imm; Tue, 10 Jul 2018 15:34:09 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcxzW0RQy6q+k+Ii304lK8MmqO14Y6ZvrRPdBjFhiSNDbzSfZo92jqHnmofyK97LCuEVS7S X-Received: by 2002:a63:6383:: with SMTP id x125-v6mr24246393pgb.127.1531262049453; Tue, 10 Jul 2018 15:34:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531262049; cv=none; d=google.com; s=arc-20160816; b=B1QzHUKobjQyWmzl0iygpI/ImA4XRzgmmyeCx+aYNyKkhZeOokytpCP6SQ/nZ1zFyu DCSh1g8Xu/4ruwa3gECyeFGDeIBcII9X5pmnhscSMB7RzVSWfds5SQJXCP70Q7XjEYmq Hk7CuJK//WlT8V1+jb2KEfcp/3IioPEQ9qlg2AS6UAdFpmP/x2x7hwMvmiQQ9eQyQ/zI TNKmSHoT+xOrGZIOfWJPXmh/ZzyfsmBaE8Npgv+4XuRQrbCAE0+w17qvPDZHhzKgPGxM U8bQ5XyC7iHlQRf7A3nuNMjuYBMIPx5YmarA4xURu2Ug2rAccaeeWPyrx0bO7l0+eDXM Ce7A== 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=kx+lo6UpVP3UsF9WQbo8HAcIYgvVwvthPk9F4G7XGe0=; b=EZUG9R5RhevVtO/xBA5KFB8HkqjQAk2wy4d57MAIHZasbjwWpa687onb1I6UkimfZS hFnEQgSmzfBGM738IzofUk8RNrC1oW28lABcqrfeZG/DFzwCRGZrkArH8XrHrI77t8tn A+6Oofwt+hsX8enbMt0wb72xdFoMn2BpzfYxMyBzggi4L4j+ZY/DmRxHaxgQy20doLdh SvDTc+UFGSEnFbJcbL+QMNoZEQprmCMa4aM08E6PMMSC5Ygkdx2K3Zklo/onBpHt6HPI NQ8fBvgQu2JdVjGE5vb36PC9d/NrREF8SnVYdEEoU7mE3Ied/C+67HZCZ+B+DOVVg1d7 65YA== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k13-v6si6159323pgh.213.2018.07.10.15.33.54; Tue, 10 Jul 2018 15:34:09 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732646AbeGJWdW (ORCPT + 99 others); Tue, 10 Jul 2018 18:33:22 -0400 Received: from mga11.intel.com ([192.55.52.93]:41888 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732490AbeGJWc1 (ORCPT ); Tue, 10 Jul 2018 18:32:27 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Jul 2018 15:31:16 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,335,1526367600"; d="scan'208";a="70305445" Received: from 2b52.sc.intel.com ([143.183.136.52]) by fmsmga004.fm.intel.com with ESMTP; 10 Jul 2018 15:31:16 -0700 From: Yu-cheng Yu To: x86@kernel.org, "H. Peter Anvin" , Thomas Gleixner , Ingo Molnar , linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-api@vger.kernel.org, Arnd Bergmann , Andy Lutomirski , Balbir Singh , Cyrill Gorcunov , Dave Hansen , Florian Weimer , "H.J. Lu" , Jann Horn , Jonathan Corbet , Kees Cook , Mike Kravetz , Nadav Amit , Oleg Nesterov , Pavel Machek , Peter Zijlstra , "Ravi V. Shankar" , Vedvyas Shanbhogue Cc: Yu-cheng Yu Subject: [RFC PATCH v2 21/27] x86/cet/ibt: Add Kconfig option for user-mode Indirect Branch Tracking Date: Tue, 10 Jul 2018 15:26:33 -0700 Message-Id: <20180710222639.8241-22-yu-cheng.yu@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180710222639.8241-1-yu-cheng.yu@intel.com> References: <20180710222639.8241-1-yu-cheng.yu@intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The user-mode indirect branch tracking support is done mostly by GCC to insert ENDBR64/ENDBR32 instructions at branch targets. The kernel provides CPUID enumeration, feature MSR setup and the allocation of legacy bitmap. Signed-off-by: Yu-cheng Yu --- arch/x86/Kconfig | 12 ++++++++++++ arch/x86/Makefile | 7 +++++++ 2 files changed, 19 insertions(+) diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 768343768643..01de9743efe6 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -1945,6 +1945,18 @@ config X86_INTEL_SHADOW_STACK_USER If unsure, say y. +config X86_INTEL_BRANCH_TRACKING_USER + prompt "Intel Indirect Branch Tracking for user-mode" + def_bool n + depends on CPU_SUP_INTEL && X86_64 + select X86_INTEL_CET + select ARCH_HAS_PROGRAM_PROPERTIES + ---help--- + Indirect Branch Tracking provides hardware protection against return-/jmp- + oriented programing attacks. + + If unsure, say y + config EFI bool "EFI runtime service support" depends on ACPI diff --git a/arch/x86/Makefile b/arch/x86/Makefile index ad1314e5ef65..a7913de34866 100644 --- a/arch/x86/Makefile +++ b/arch/x86/Makefile @@ -164,6 +164,13 @@ ifdef CONFIG_X86_INTEL_SHADOW_STACK_USER endif endif +# Check compiler ibt support +ifdef CONFIG_X86_INTEL_BRANCH_TRACKING_USER + ifeq ($(call cc-option-yn, -fcf-protection=branch), n) + $(error CONFIG_X86_INTEL_BRANCH_TRACKING_USER not supported by compiler) + endif +endif + # # If the function graph tracer is used with mcount instead of fentry, # '-maccumulate-outgoing-args' is needed to prevent a GCC bug -- 2.17.1