Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp783542imm; Fri, 21 Sep 2018 08:14:06 -0700 (PDT) X-Google-Smtp-Source: ANB0Vdb0U9t+/OgCqtuf2R83kPaVzTMXXnFLaGvVFNdmDMn2eQ19A1ARU+4XV1Zv6TE2p1EFgrlB X-Received: by 2002:a62:1456:: with SMTP id 83-v6mr46591863pfu.50.1537542846022; Fri, 21 Sep 2018 08:14:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537542845; cv=none; d=google.com; s=arc-20160816; b=yC2he+mJvJA63RVLUcUPjf/00tb9GTWnmqTfaMMSUtyw/hCfBiHMIv2DOMMVMMdBzW S5/0NIlgLoMmLYd2s1gy9U39IaVK6ncG+S/thzeFgqJQfXdAtcOl9EncEZtSeptH13mJ sxGZPaOSe3Tt3WvE7oPSUrSvFI+cZcGzB6g8+kj5kT66kiwOMQswiVhG7jPoy8AbwZcz 9Rbz+wobqhR0wQoKXS9ZEGoEAWNCPHT5XRz3VsHA9Bu1NoOcwXbgu/Y3HLVgikkbOMed qhqkdaJI9e0+D8mygmzUvscJGhh3oFwF34clXwjXurArUGNSXSZ8GFaOOjJGPTr0ilGo Ij8w== 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=9ge0BToENFLkDFx5+uBu/yHmjAvnoFdBtu1gWRK9/M0=; b=lNaiO4iCYUQQakpBO+2PDZXu0DYhF/whXv260OSE33GFsfzsCU1f33QgFgNntKWjxr ggpaE9JjLvgR4ZWkDdhecHRo2p74tBTfCZmjvZ4gICij00tU6ThSzO7H4UsgOtOZEnWL 1xH0UxJWKX36/f/Mv8KO/J+0eHgtg8OjZCPNPSBeD0CwmtLXthWkjAjLNMtwgXOrlSOq NFoSQ5qRNDx3/OuvlL+vMGaz8+nq9XEw0nQX3mqXR4Algl2ZieI8NhA1s/Uc8zhLWuVz Dchr0RwCOlJf26VFbqa9sBkNahf+Y5VgtLUjdqpodLrTblbS6AJjeDOYiP6gq7j0bFd5 yKaw== 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 b3-v6si27746221plc.502.2018.09.21.08.13.48; Fri, 21 Sep 2018 08:14:05 -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 S2390966AbeIUVAm (ORCPT + 99 others); Fri, 21 Sep 2018 17:00:42 -0400 Received: from mga11.intel.com ([192.55.52.93]:13767 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390842AbeIUU7p (ORCPT ); Fri, 21 Sep 2018 16:59:45 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 Sep 2018 08:10:27 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,285,1534834800"; d="scan'208";a="88187961" Received: from 2b52.sc.intel.com ([143.183.136.51]) by fmsmga002.fm.intel.com with ESMTP; 21 Sep 2018 08:10:27 -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 , Randy Dunlap , "Ravi V. Shankar" , Vedvyas Shanbhogue Cc: Yu-cheng Yu Subject: [RFC PATCH v4 1/9] x86/cet/ibt: Add Kconfig option for user-mode Indirect Branch Tracking Date: Fri, 21 Sep 2018 08:05:45 -0700 Message-Id: <20180921150553.21016-2-yu-cheng.yu@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180921150553.21016-1-yu-cheng.yu@intel.com> References: <20180921150553.21016-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 6377125543cc..2a0ff538a229 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -1941,6 +1941,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 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 b28842b80295..ff652bba849f 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