Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp38889imm; Thu, 30 Aug 2018 07:50:32 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYY3maJLQD0hfl1AaTLpBnjb0uQdBknjvVa76VIRqhK/6v1zxH6KT9W9UZNTRxy3W5PWd7Z X-Received: by 2002:a63:e4b:: with SMTP id 11-v6mr8678896pgo.320.1535640632848; Thu, 30 Aug 2018 07:50:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535640632; cv=none; d=google.com; s=arc-20160816; b=xsD6ieL8+bksejxjwIq8ZBCy8d1uBZwlvozs38ixUWnhF95YFdD4U8WnMJAHWZh8wn X6axwOVcrOK/hqnvSvctMfN7eBeWEgCxZYmfVWt74WjwpoVy7ByB/W/SlHtGCO/4ODo2 aLTqqOsyyWWnKRbCtUB/VgyrBUDU8JB2kmib3/Y2+JH9GFwD7sYL1b+AHZCFoqE3iseP 8NCws1vbeUjgQtU0jrOijHepcvwuk1+b1mpYaGVFuShzStWh7OyY9hMQISlIH5kQWcTo cSEDr9gk2LhrgRmgkZiHhf0YoWpEoDC/5NjWtX71iHOKW8qidzfB/KqHPqzu5toFO5CZ Jn+g== 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=GItZ6zMjewsshyErngy5TzAWyns2xf+Aa7z7tr61mP8=; b=VFSbx+2KK5wh81BRerj13rgBRb+rMeSWVSIH2qFWIdD+apqgoRi7ARzu4WME/8oZcv kZ0lChVDHJeoWyOGD+QTRBiJNUIaRUpSogjKehdT4wOPo2k19Y0WU8kWppDXbh/20m4l iDB+LmyVB21VjCx+U9/RA/gFFGSS/9SQogbFeFYzCQdX6P1M1kwagx7ZwRy8kZsGLCDx 3xxcI9Had3oP+OTCvXT8jSl2YOVW/VJO/uLHJFIsYwnaOJhJOq6fOQd8SUG2gDgo1c19 nDzH5gOwJxGXPy7N5ubrkrWVUSS7DaQYMFD6nDD7zGbq7UxpZ78CgT3FDClszbqoc2Ul n8GQ== 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 f32-v6si2992657plf.252.2018.08.30.07.50.18; Thu, 30 Aug 2018 07:50:32 -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 S1729859AbeH3Suf (ORCPT + 99 others); Thu, 30 Aug 2018 14:50:35 -0400 Received: from mga01.intel.com ([192.55.52.88]:38430 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729495AbeH3SqQ (ORCPT ); Thu, 30 Aug 2018 14:46:16 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Aug 2018 07:43:43 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,307,1531810800"; d="scan'208";a="67186662" Received: from 2b52.sc.intel.com ([143.183.136.52]) by fmsmga008.fm.intel.com with ESMTP; 30 Aug 2018 07:43:39 -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 v3 01/24] x86/cpufeatures: Add CPUIDs for Control-flow Enforcement Technology (CET) Date: Thu, 30 Aug 2018 07:38:41 -0700 Message-Id: <20180830143904.3168-2-yu-cheng.yu@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180830143904.3168-1-yu-cheng.yu@intel.com> References: <20180830143904.3168-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 Add CPUIDs for Control-flow Enforcement Technology (CET). CPUID.(EAX=7,ECX=0):ECX[bit 7] Shadow stack CPUID.(EAX=7,ECX=0):EDX[bit 20] Indirect branch tracking Signed-off-by: Yu-cheng Yu --- arch/x86/include/asm/cpufeatures.h | 2 ++ arch/x86/kernel/cpu/scattered.c | 1 + 2 files changed, 3 insertions(+) diff --git a/arch/x86/include/asm/cpufeatures.h b/arch/x86/include/asm/cpufeatures.h index 89a048c2faec..fa69651a017e 100644 --- a/arch/x86/include/asm/cpufeatures.h +++ b/arch/x86/include/asm/cpufeatures.h @@ -221,6 +221,7 @@ #define X86_FEATURE_ZEN ( 7*32+28) /* "" CPU is AMD family 0x17 (Zen) */ #define X86_FEATURE_L1TF_PTEINV ( 7*32+29) /* "" L1TF workaround PTE inversion */ #define X86_FEATURE_IBRS_ENHANCED ( 7*32+30) /* Enhanced IBRS */ +#define X86_FEATURE_IBT ( 7*32+31) /* Indirect Branch Tracking */ /* Virtualization flags: Linux defined, word 8 */ #define X86_FEATURE_TPR_SHADOW ( 8*32+ 0) /* Intel TPR Shadow */ @@ -321,6 +322,7 @@ #define X86_FEATURE_PKU (16*32+ 3) /* Protection Keys for Userspace */ #define X86_FEATURE_OSPKE (16*32+ 4) /* OS Protection Keys Enable */ #define X86_FEATURE_AVX512_VBMI2 (16*32+ 6) /* Additional AVX512 Vector Bit Manipulation Instructions */ +#define X86_FEATURE_SHSTK (16*32+ 7) /* Shadow Stack */ #define X86_FEATURE_GFNI (16*32+ 8) /* Galois Field New Instructions */ #define X86_FEATURE_VAES (16*32+ 9) /* Vector AES */ #define X86_FEATURE_VPCLMULQDQ (16*32+10) /* Carry-Less Multiplication Double Quadword */ diff --git a/arch/x86/kernel/cpu/scattered.c b/arch/x86/kernel/cpu/scattered.c index 772c219b6889..63cbb4d9938e 100644 --- a/arch/x86/kernel/cpu/scattered.c +++ b/arch/x86/kernel/cpu/scattered.c @@ -21,6 +21,7 @@ struct cpuid_bit { static const struct cpuid_bit cpuid_bits[] = { { X86_FEATURE_APERFMPERF, CPUID_ECX, 0, 0x00000006, 0 }, { X86_FEATURE_EPB, CPUID_ECX, 3, 0x00000006, 0 }, + { X86_FEATURE_IBT, CPUID_EDX, 20, 0x00000007, 0}, { X86_FEATURE_CAT_L3, CPUID_EBX, 1, 0x00000010, 0 }, { X86_FEATURE_CAT_L2, CPUID_EBX, 2, 0x00000010, 0 }, { X86_FEATURE_CDP_L3, CPUID_ECX, 2, 0x00000010, 1 }, -- 2.17.1