Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp3822462pxb; Mon, 30 Aug 2021 11:25:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzSSdfZO0bytG/xi5ybj8icO24TO+hsQvn7zIQTbbFFu0uG3FV0KhWrwxhN0TtKREZusI3P X-Received: by 2002:a17:906:d04d:: with SMTP id bo13mr27093504ejb.351.1630347939963; Mon, 30 Aug 2021 11:25:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630347939; cv=none; d=google.com; s=arc-20160816; b=e/kBLtgmNQHf+xNgHkynIFoGtjc/AtmtCGAmwp19gW2r9qfeV0x4OKmn8WXYLweppr 0EEJgERBAfC3At9C6YfuXPxDyItUbd70aIxjWkN7KU/9kOZgC3E6nBjQZnnOWlAz86br /qgBQrpA7wLfzWXbhX7p2d9Y9ZDTM6RPFAleIedJHsW9YqfEg72/hWT8fW7ncVP8gLvx wAtkQ1roiReZUhpCd3ZhH1oFrP1/QgmtMaDEVMygeCfR6tFF/GIHS2r6f8BtbT2sLZ8x SJSkBvbiAyrLw1M7ilXYsdDvV0XHetDz9EQU9f2B2coTeIvTA8d6StZwWxyWwefqXKoQ nakQ== 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=QTe8J1/0NdlFCw4lzlG1BUy8JLyv/otohVdKlzi6C9sKuY3w+NZ41pfiaQCvLh8hrc pQlrzpN3O8DpFZKuM/7TE06pOCsBUdDIYZ+mDyHdVYVrmf2f4ZIngv8Uo5leKM3AvPRo 9TfQNbb9Y/SkrYPoS6R/nScwQk1Gavc5H9r/2fYWfQ6RW1rqm1ydcUixWMOXADUpKfbo VtMUceVPnXgiwDwNZuJfp/8sy0KRZXPTy6xgCh9uIZNj4HnGH7ffhr/cM/ZNIjwZqSRh /WszPdjQba4BXNcmsQH59pP9Pr7qvavZxWfeiLLox0a9HCqGAnTl05UV572wbn7D9kk2 Nlww== 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 j7si15967091edt.402.2021.08.30.11.25.07; Mon, 30 Aug 2021 11:25: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 S238610AbhH3SYW (ORCPT + 99 others); Mon, 30 Aug 2021 14:24:22 -0400 Received: from mga05.intel.com ([192.55.52.43]:57612 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229839AbhH3SYD (ORCPT ); Mon, 30 Aug 2021 14:24:03 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10092"; a="303905709" X-IronPort-AV: E=Sophos;i="5.84,364,1620716400"; d="scan'208";a="303905709" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Aug 2021 11:23:09 -0700 X-IronPort-AV: E=Sophos;i="5.84,364,1620716400"; d="scan'208";a="540650943" Received: from yyu32-desk.sc.intel.com ([143.183.136.146]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Aug 2021 11:23:08 -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 v30 01/10] x86/cet/ibt: Add Kconfig option for Indirect Branch Tracking Date: Mon, 30 Aug 2021 11:22:12 -0700 Message-Id: <20210830182221.3535-2-yu-cheng.yu@intel.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20210830182221.3535-1-yu-cheng.yu@intel.com> References: <20210830182221.3535-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