Received: by 2002:ac0:b08d:0:0:0:0:0 with SMTP id l13csp11602imc; Thu, 8 Nov 2018 12:46:18 -0800 (PST) X-Google-Smtp-Source: AJdET5dOpofDlxImp9L+wI+Bsz5v+E0w87TEtv3vmoPPt4GV3gj5Yyz2t5FIA2dqhqLNVKq0a0Es X-Received: by 2002:a17:902:61:: with SMTP id 88-v6mr6108300pla.189.1541709978437; Thu, 08 Nov 2018 12:46:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541709978; cv=none; d=google.com; s=arc-20160816; b=n/vQi9YK3Oah/NM5D3PRpGIFL9IUTyaqCXXfnp7Ursu9baWteDo61WyhlM0esMU5Mt Bcbn16EtxleZdJoSotXBjpb1wcKIhltYmvjcVm1odNqQ/QekPfk2701cbzCRah4v8ibk FXg8t/xkPl36HIni9FiRU3FyfGSxzCs6naM35Z8PLGaXHMI9MB7rTdAQr0MWD+FCIiDz Iz0EGjlTE3DyoplFLBn7Wv6RR1xVGubteGpTKinrdjsWJeL9QUMlXJueDdEbi2mxtnCs sUypr5rpdlLOGu5XYzeRGowwEzXSDo3PA8Iwr3EvfcJzlBqhnp+OAaeWHYqICHibZ1mh SNGA== 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=Vp5AVKo/YepWVYMxnKHYxNX3ldC1U4p49vG1REBPx6s=; b=UHWwJTX8gQZ+9cyEvpsEnv0VoPF5fEJ1YpN63CjwfVMsDVDcRE45wU30ouwbqvMPTX YO7PaF61dmbEJ0y/uUlEnsb4MxEJ0JTkNuZcCXhqsMCte0JcWhi/dncLRP8gm14yNvW/ k4V5JH0zjTmUKZHjDXeNWf6VkJesvjcvJPuykKFnZ1Xw3b2Ck59bq1B5T4PiP+aNwOCy JgvGwEgDN3s3l9gykNIyDDRP60zw5qUwm05b7nyl4P95MHICs45KddGPOG1wa2I6ccDB 3EbhLmcx+x5bRjZ23rfXnrFn17FrTFC70+TMyBp+LbwZODeLE4o7cUSarRw29MXtJ7uB QBUw== 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 g92-v6si5404068plg.354.2018.11.08.12.45.41; Thu, 08 Nov 2018 12:46:18 -0800 (PST) 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 S1727215AbeKIGWa (ORCPT + 99 others); Fri, 9 Nov 2018 01:22:30 -0500 Received: from mga07.intel.com ([134.134.136.100]:14746 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726140AbeKIGW3 (ORCPT ); Fri, 9 Nov 2018 01:22:29 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 Nov 2018 12:45:18 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,480,1534834800"; d="scan'208";a="89671600" Received: from yyu32-desk1.sc.intel.com ([143.183.136.147]) by orsmga006.jf.intel.com with ESMTP; 08 Nov 2018 12:45:16 -0800 Message-ID: Subject: Re: [PATCH v5 04/27] x86/fpu/xstate: Add XSAVES system states for shadow stack 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 , 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" , Vedvyas Shanbhogue Date: Thu, 08 Nov 2018 12:40:02 -0800 In-Reply-To: <20181108184038.GJ7543@zn.tnic> References: <20181011151523.27101-1-yu-cheng.yu@intel.com> <20181011151523.27101-5-yu-cheng.yu@intel.com> <20181108184038.GJ7543@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 Thu, 2018-11-08 at 19:40 +0100, Borislav Petkov wrote: > On Thu, Oct 11, 2018 at 08:15:00AM -0700, Yu-cheng Yu wrote: > > [...] > > +/* > > + * State component 11 is Control flow Enforcement user states > > Why the Camel-cased naming? > > "Control" then "flow" then capitalized again "Enforcement". > > Fix all occurrences pls, especially the user-visible strings. I will change it to "Control-flow Enforcement" everywhere. > > + */ > > +struct cet_user_state { > > + u64 u_cet; /* user control flow settings */ > > + u64 user_ssp; /* user shadow stack pointer */ > > Prefix both with "usr_" instead. Ok. > [...] > > Just write "privilege level" everywhere - not "ring". > > Btw, do you see how the type and the name of all those other fields in > that file are tabulated? Except yours... I will fix it. [...] > > > > diff --git a/arch/x86/kernel/fpu/xstate.c b/arch/x86/kernel/fpu/xstate.c > > index 605ec6decf3e..ad36ea28bfd1 100644 > > --- a/arch/x86/kernel/fpu/xstate.c > > +++ b/arch/x86/kernel/fpu/xstate.c > > @@ -35,6 +35,9 @@ static const char *xfeature_names[] = > > "Processor Trace (unused)" , > > "Protection Keys User registers", > > "unknown xstate feature" , > > + "Control flow User registers" , > > + "Control flow Kernel registers" , > > + "unknown xstate feature" , > > So there are two "unknown xstate feature" array elems now... > > > static short xsave_cpuid_features[] __initdata = { > > @@ -48,6 +51,9 @@ static short xsave_cpuid_features[] __initdata = { > > X86_FEATURE_AVX512F, > > X86_FEATURE_INTEL_PT, > > X86_FEATURE_PKU, > > + 0, /* Unused */ > > What's that for? In fpu_init_system_xstate(), we test and clear features that are not enabled. There we depend on the order of these elements. This is the tenth "unknown xstate feature". Yu-cheng