Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp992522imm; Fri, 28 Sep 2018 10:03:07 -0700 (PDT) X-Google-Smtp-Source: ACcGV63cpl6hpCurvWL4ODY9++0jUdtne6r9AbCUfEKN17XMA5Drp2uFnWbxjYKad6MJ8ZNbN/bM X-Received: by 2002:a65:5245:: with SMTP id q5-v6mr15683604pgp.67.1538154187432; Fri, 28 Sep 2018 10:03:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538154187; cv=none; d=google.com; s=arc-20160816; b=PFyn8TPCL5di5gpBA2XBzfGVmkCesvf/3VSn/w4j36c7aBo3N2VqL4zpVSVVJfKb2b FHObmJxZkALHHx/ug+eY8KHPlyY3WmKsagXzNdH6rigko9OXt7CX0uTnt6+YO0jly9Nn +nSPC1Ri1GilOeGPLHKuVlAuNvPW/90wK/f+HYJo9cmUNm/mVjE8WJWKWfIXq/PwdlZO Yh7P0HNB+6yUIpsEF5qq7tTV9kh1zyhfK0Gh6kI96fm1IymnnSPhwF7Cqo7laBauSC9H qf83crCZYMQm9zLaaTUP7vQA+OWSZdaoHiT/kIhqjZ3x05IgyRbjoqQcYn8t1qYTLTik tTLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id; bh=16zL9s7i/s7X1uVBXXDQSwNuETFzCjmJfibhFkEhWbw=; b=AiBLzdNKl6OZz6bNamTiYV/XLO126zHO94x4SB2ejqDp35+VnW0Ro0qDa8lAFYJMkR z9eruJHHxmjHBwlv2+18A9w9kFfDglfBDJlvVZ7cRZSpEbqNj3GEqY5gN+FxAWkeavqL G146eENWy8YuiXrCmQVphSLrpXZdLuA52FRQHnLs6MvQ6feOZVInom/S++qcrV6lezlh p+vuBE2JAlatZBBlGWngv/sXkg2dS/bdiQ3wTgL+15o3z9hMMdCRIdynSxILxU5R19Hu 6Vb3Srjcrbtw+bpAr+cLhYa1wXpjA6fRi7f22fhb8fjh+5N6LQ1NKKJSLFtAc38RAiVu OUAg== 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 f6-v6si4946521pgk.623.2018.09.28.10.02.51; Fri, 28 Sep 2018 10:03:07 -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 S1729342AbeI1XZv (ORCPT + 99 others); Fri, 28 Sep 2018 19:25:51 -0400 Received: from mga14.intel.com ([192.55.52.115]:7266 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726738AbeI1XZv (ORCPT ); Fri, 28 Sep 2018 19:25:51 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Sep 2018 10:01:11 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,315,1534834800"; d="scan'208";a="266822787" Received: from 2b52.sc.intel.com ([143.183.136.51]) by fmsmga005.fm.intel.com with ESMTP; 28 Sep 2018 10:01:11 -0700 Message-ID: <459b7c5d85ef57b02985813d59f7dd3f7cc18368.camel@intel.com> Subject: Re: [RFC PATCH v4 01/27] x86/cpufeatures: Add CPUIDs for Control-flow Enforcement Technology (CET) From: Yu-cheng Yu To: Borislav Petkov Cc: 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 Date: Fri, 28 Sep 2018 09:56:32 -0700 In-Reply-To: <20180928165118.GD20768@zn.tnic> References: <20180921150351.20898-1-yu-cheng.yu@intel.com> <20180921150351.20898-2-yu-cheng.yu@intel.com> <20180928165118.GD20768@zn.tnic> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.1-2 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 2018-09-28 at 18:51 +0200, Borislav Petkov wrote: > On Fri, Sep 21, 2018 at 08:03:25AM -0700, Yu-cheng Yu wrote: > > 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}, > > If you haven't noticed, there's already a separate leaf: > > /* Intel-defined CPU features, CPUID level 0x00000007:0 (EDX), word 18 */ > > in arch/x86/include/asm/cpufeatures.h > I will change to that one. Thanks! Yu-cheng