Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3309093imu; Mon, 19 Nov 2018 13:58:35 -0800 (PST) X-Google-Smtp-Source: AJdET5cqGjTofBt8vl6xqjstjJYxBcB+dv3KCcUh89+Mn2138EdRQ/Pgm1/FoOIzvKb3GhhxLu/o X-Received: by 2002:a63:7e5b:: with SMTP id o27mr21578421pgn.214.1542664715235; Mon, 19 Nov 2018 13:58:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542664715; cv=none; d=google.com; s=arc-20160816; b=hAJQXYXL4S4aX6RHQr0402UEYwawCThIUy/187nvAh8emPWCnecR4QaCKkSCUt3zIk 93uGqbpGY81eeKY8AmPeDxZokrOztKgj5vY2XyZsRe44xPQIVZMg53cH3hDPqEU2jMzv 25NPdyoxSVOnTiBHsOiuqaIbx7AHJmCeirBjcEbfPcRf2FMx40WDypfnuJWjDuS9bweD q2hCUxQ8H8kCro0gDVbpvALfO9ycAKzM9pcQPG8Hl2X2R0UOvuBc83PW7O2h8bbsntFk hVmqiXmygbyxxejaYOuh0MqhVhYHrzjDIP4yMskgXattXTDXZ5e3RCOlL/2b+xJdX+JD CVew== 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; bh=QCHYrD5sAwVf/rvr/h1K17NE542y7XSPWeOeWJqblEc=; b=D5X2ftsBtUeJpQO/T9+6FGTvIQJJ4iY0ow2OVCla1sCa+dPdjM/JDDmxj7sVsLzDZM JPvsuE/jJOfYhArCdVocJvQkDMSj0twYiznibls45OD4eqqa8yYOjEUKGsT66O27wXjO FUd6JltUcvoDIjS4kz41iW7NDfpw6qK0Ucnjng3BhBOHa0fR3E86V6DH421q/8TqPYTM bEYGwbMy3Ru4OnE79bR+77rEzPV3a2xJ/bKPFQ3LRXU8qrXkjvd3tM5VXU9uPeZzv0ln A2k5D3IjDTlyucz3BOf0BplD345rbdEoPU/p+HrGsqJY4nT7/r+zNzjfYwLtPTJnnk0V VBCQ== 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 o127si5569427pfo.251.2018.11.19.13.58.20; Mon, 19 Nov 2018 13:58:35 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731697AbeKTIUf (ORCPT + 99 others); Tue, 20 Nov 2018 03:20:35 -0500 Received: from mga09.intel.com ([134.134.136.24]:32114 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731297AbeKTIUe (ORCPT ); Tue, 20 Nov 2018 03:20:34 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Nov 2018 13:54:54 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,254,1539673200"; d="scan'208";a="92423879" Received: from yyu32-desk1.sc.intel.com ([143.183.136.147]) by orsmga006.jf.intel.com with ESMTP; 19 Nov 2018 13:54:52 -0800 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 , Eugene Syromiatnikov , Florian Weimer , "H.J. Lu" , Jann Horn , Jonathan Corbet , Kees Cook , Mike Kravetz , Nadav Amit , Oleg Nesterov , Pavel Machek , Peter Zijlstra , Randy Dunlap , "Ravi V. Shankar" , Vedvyas Shanbhogue Cc: Yu-cheng Yu Subject: [RFC PATCH v6 01/11] x86/cet/ibt: Add Kconfig option for user-mode Indirect Branch Tracking Date: Mon, 19 Nov 2018 13:49:24 -0800 Message-Id: <20181119214934.6174-2-yu-cheng.yu@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181119214934.6174-1-yu-cheng.yu@intel.com> References: <20181119214934.6174-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 and feature setup. Signed-off-by: Yu-cheng Yu --- arch/x86/Kconfig | 16 ++++++++++++++++ arch/x86/Makefile | 7 +++++++ 2 files changed, 23 insertions(+) diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 73dfb94cde71..b7f30ac89e27 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -1925,6 +1925,9 @@ config X86_INTEL_CET config ARCH_HAS_SHSTK def_bool n +config ARCH_HAS_AS_LIMIT + def_bool n + config ARCH_HAS_PROGRAM_PROPERTIES def_bool n @@ -1948,6 +1951,19 @@ 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_AS_LIMIT + select ARCH_HAS_PROGRAM_PROPERTIES + ---help--- + Indirect Branch Tracking provides hardware protection against return-/jmp- + oriented programming 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 0e4746814452..7e6c4aeb0d92 100644 --- a/arch/x86/Makefile +++ b/arch/x86/Makefile @@ -159,6 +159,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