Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp981187imm; Fri, 28 Sep 2018 09:51:47 -0700 (PDT) X-Google-Smtp-Source: ACcGV60QP2O9kTKKz3eTSjQobPSN4gjqlbxVeDeZno9GWWuscgFPIFAfQB/bgC816PRdoDhM1VBL X-Received: by 2002:a63:5509:: with SMTP id j9-v6mr15502698pgb.208.1538153507383; Fri, 28 Sep 2018 09:51:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538153507; cv=none; d=google.com; s=arc-20160816; b=ZnmgZYdI68W8bChlq/v8JYwEB2xDvk4qavhv8GmF12Cl3E9piH3Culpo+dazkGk2Xn 5UGjblggA47U1jVTWohsGRjJxoOmP8+B3cxtHP/ddmKcXsohu2gw0wNawzEcFk5zjz4+ u+cF110TcqvElyhh/MTyv4YzxTjpZrZyUNbgKgLA+mqHO3+1z6IwLqy8cyOklTSLL/Yw 5pgFS8W5pD161LGbH+h6NJ9UtSsI3z2SNtoMqupIlvZZTsCd6r/AfoQYcmIXQsAFsqLD JOJas6kjUIYCt9nChcjCz0SRb6rPkRwxRCm1dtm6mocS/Hwl2qPn4yQjAjuHgc9/ilXT JZ4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=rHML0RPkRzSS5Ul+tswWJTPywebbwhTxyXarMQxAzk0=; b=eZFjRjEmI0D7r54gkXveSYkjzZ5KVO2s3v6in6YS91LDtvlY3XsTtHP+ACvSRNPsHW xxQwJuzc4rwrRLrDjYTgUo8NtHFSIgx70hYK+xiUXJPodpgwpERoFe2PJ7N5L+6WKhRM Ig+byK2PuXBjOd3HmOSDJK+JzB4K/wc4btnLUhk7mE+X1CIvU3upA6QII3LvE0m0b7pM he2qHO0ExdCOMzektzn5MXgaDTjCftYx2ysLj2c6JvNA3rMbxXZFEeVeI51EO3VYyQmL Ek1qWssBnIDyrdBLof44XjMnAgYNe2bXEbhvuD9HUR9wCDcopEcJ8MO/MPND7iw2ub2h wO5g== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p126-v6si417100pfp.318.2018.09.28.09.51.32; Fri, 28 Sep 2018 09:51:47 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729417AbeI1XPv (ORCPT + 99 others); Fri, 28 Sep 2018 19:15:51 -0400 Received: from mail.skyhub.de ([5.9.137.197]:51142 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727361AbeI1XPu (ORCPT ); Fri, 28 Sep 2018 19:15:50 -0400 X-Virus-Scanned: Nedap ESD1 at mail.skyhub.de Received: from mail.skyhub.de ([127.0.0.1]) by localhost (blast.alien8.de [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id vWIfeBIMko_j; Fri, 28 Sep 2018 18:51:11 +0200 (CEST) Received: from zn.tnic (p200300EC2BCA5700329C23FFFEA6A903.dip0.t-ipconnect.de [IPv6:2003:ec:2bca:5700:329c:23ff:fea6:a903]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 7414C1EC00E8; Fri, 28 Sep 2018 18:51:11 +0200 (CEST) Date: Fri, 28 Sep 2018 18:51:18 +0200 From: Borislav Petkov To: Yu-cheng Yu 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 Subject: Re: [RFC PATCH v4 01/27] x86/cpufeatures: Add CPUIDs for Control-flow Enforcement Technology (CET) Message-ID: <20180928165118.GD20768@zn.tnic> References: <20180921150351.20898-1-yu-cheng.yu@intel.com> <20180921150351.20898-2-yu-cheng.yu@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20180921150351.20898-2-yu-cheng.yu@intel.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 -- Regards/Gruss, Boris. Good mailing practices for 400: avoid top-posting and trim the reply.