Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp1691210pxb; Fri, 20 Aug 2021 11:26:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJycVg2Eb7aOKvn5h4FBizx6GZYqQ6HcrcKY37iv56efioU/g46xlRbW9iD3b73aarxhQUKf X-Received: by 2002:a02:7318:: with SMTP id y24mr4710322jab.43.1629483999921; Fri, 20 Aug 2021 11:26:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629483999; cv=none; d=google.com; s=arc-20160816; b=vNXQxEb0nIBfLuf1HwsWOoLiwWVF7KPV3KD01Rvzi+SF4Oifa15oCEW9S/q20Jhil+ CvRk1ekF/y6AUMOjiGJehQGVx8k9ScxeNqOwGygMAw5gpD7jG6Byp/wwBNyIOLG0tulJ rwX/hk3EtSJEFb4aFmQa1hi/4qtA5KbcPmcR0/TE7pFWrqm5Wwrafb7egUG4gpwUEohK r0aaG0YgwSniGNNtY8BNdXDm5W0cPjd3rCFEJ2FYbgpA/JbwUUeo9nSNa4sSwmR35u1f j7WGoQpv1QhBgeVRGKm2zsiz3r0k08w4EwYZ8xHls8Hp+nMRRxUjANsQrrKFpMfA6jXn saXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=57yN7wYdBBjnEaHHYZbfZyhGFD4AzvJeihiQeKUZNmM=; b=Ua+jbVCCH+lswPKZtaehmQUWpFAXT+xoQ4oo/bsvAox5JR1+Af9vQjknd+yowitx3W 23I+qZbcCH5utgyIi3f0WvMerOB7aAAmgVetXUnKAlQkXFdWHYwaqBiv99m7nuF8fk9o 7HA3tsqtkZmE8uqQrsck3dDaMSq2HZKpGV91KHptYGkE2vSofbkqtADwOMt9/3OygcU6 MV7AHJYyCLEUL/uV6vc0n99vYjuBIlRziEqUbZzi18d2d7phEYdVREic0Udo+nDIOter deduj8NHhF9Xom5PnqDEvX/5042sFX0ThGitmqsT9hu57hmsulrz6LeGXPpaxvd6F9YY EU3A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id h19si7014976jaj.67.2021.08.20.11.26.28; Fri, 20 Aug 2021 11:26:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S236635AbhHTS0P (ORCPT + 99 others); Fri, 20 Aug 2021 14:26:15 -0400 Received: from mga18.intel.com ([134.134.136.126]:48046 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236023AbhHTSYG (ORCPT ); Fri, 20 Aug 2021 14:24:06 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10082"; a="203964940" X-IronPort-AV: E=Sophos;i="5.84,338,1620716400"; d="scan'208";a="203964940" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Aug 2021 11:23:07 -0700 X-IronPort-AV: E=Sophos;i="5.84,338,1620716400"; d="scan'208";a="523799153" Received: from yyu32-desk.sc.intel.com ([143.183.136.146]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Aug 2021 11:23:07 -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 , Borislav Petkov , 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" , Dave Martin , Weijiang Yang , Pengfei Xu , Haitao Huang , Rick P Edgecombe Cc: Yu-cheng Yu Subject: [PATCH v29 01/10] x86/cet/ibt: Add Kconfig option for Indirect Branch Tracking Date: Fri, 20 Aug 2021 11:22:36 -0700 Message-Id: <20210820182245.1188-2-yu-cheng.yu@intel.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20210820182245.1188-1-yu-cheng.yu@intel.com> References: <20210820182245.1188-1-yu-cheng.yu@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Indirect Branch Tracking (IBT) provides protection against CALL-/JMP- oriented programming attacks. It is active when the kernel has this feature enabled, and the processor and the application support it. When this feature is enabled, legacy non-IBT applications continue to work, but without IBT protection. Signed-off-by: Yu-cheng Yu Reviewed-by: Kees Cook --- arch/x86/Kconfig | 19 +++++++++++++++++++ arch/x86/include/asm/disabled-features.h | 8 +++++++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 34692f02118c..b063d6d2491f 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -1932,6 +1932,25 @@ config X86_SHADOW_STACK If unsure, say N. +config X86_IBT + prompt "Intel Indirect Branch Tracking" + def_bool n + depends on X86_SHADOW_STACK + depends on $(cc-option,-fcf-protection) + help + Indirect Branch Tracking (IBT) provides protection against + CALL-/JMP-oriented programming attacks. It is active when + the kernel has this feature enabled, and the processor and + the application support it. When this feature is enabled, + legacy non-IBT applications continue to work, but without + IBT protection. + Support for this feature is present on Tiger Lake family of + processors released in 2020 or later. Enabling this feature + increases kernel text size by 3.7 KB. + See Documentation/x86/intel_cet.rst for more information. + + If unsure, say N. + config EFI bool "EFI runtime service support" depends on ACPI diff --git a/arch/x86/include/asm/disabled-features.h b/arch/x86/include/asm/disabled-features.h index b7728f7afb2b..e3a08fcd72f4 100644 --- a/arch/x86/include/asm/disabled-features.h +++ b/arch/x86/include/asm/disabled-features.h @@ -71,6 +71,12 @@ #define DISABLE_SHSTK (1 << (X86_FEATURE_SHSTK & 31)) #endif +#ifdef CONFIG_X86_IBT +#define DISABLE_IBT 0 +#else +#define DISABLE_IBT (1 << (X86_FEATURE_IBT & 31)) +#endif + /* * Make sure to add features to the correct mask */ @@ -93,7 +99,7 @@ #define DISABLED_MASK16 (DISABLE_PKU|DISABLE_OSPKE|DISABLE_LA57|DISABLE_UMIP| \ DISABLE_ENQCMD|DISABLE_SHSTK) #define DISABLED_MASK17 0 -#define DISABLED_MASK18 0 +#define DISABLED_MASK18 (DISABLE_IBT) #define DISABLED_MASK19 0 #define DISABLED_MASK_CHECK BUILD_BUG_ON_ZERO(NCAPINTS != 20) -- 2.21.0