From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9F733C433FE for ; Mon, 3 Oct 2022 17:40:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 25DEC6B0075; Mon, 3 Oct 2022 13:40:51 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1E7156B0074; Mon, 3 Oct 2022 13:40:51 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 03A466B0075; Mon, 3 Oct 2022 13:40:50 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id D94B56B0073 for ; Mon, 3 Oct 2022 13:40:50 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id A21771A0275 for ; Mon, 3 Oct 2022 17:40:50 +0000 (UTC) X-FDA: 79980353460.19.DDCA305 Received: from mail-pj1-f51.google.com (mail-pj1-f51.google.com [209.85.216.51]) by imf03.hostedemail.com (Postfix) with ESMTP id 3D79220002 for ; Mon, 3 Oct 2022 17:40:50 +0000 (UTC) Received: by mail-pj1-f51.google.com with SMTP id x32-20020a17090a38a300b00209dced49cfso8009327pjb.0 for ; Mon, 03 Oct 2022 10:40:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date; bh=7trZKNMH95kI/vdclw2zTtJbLljChYab2N/m8HA2aLk=; b=KJmn+3c/xJjpT22xjRIMBTxDLO7GD6WCvCmoYYhclb4OwxuUfDcVrF5sx0CMqpPmQE tlWzP1Pt52Ej+zHCMN/xFotPDK7bduuzPXBvFElPX5qQhqUUFRM5ixnbZLjvI4Z1IVcC zHmEXUg5sNFLFhfSakgkdCc7SJHWhA8dMF2Fw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date; bh=7trZKNMH95kI/vdclw2zTtJbLljChYab2N/m8HA2aLk=; b=LQjY3hTaSqk1JfhRAuSDVmoKeoD8J+/1Yba12ri2opdZ7NF4T6vuM6sr1QIW67yPrG Dgkl+TeW3rNdRE2vtdLH3DnqDVbEI3vyzJCE4iYfomXaHO1j565GVKajNIBBfcs09tEa 9zUDi9b1JxWYhU/J4eyQfeguTBljFme23leSlBYnssiJT9QqJKauL0lcBC+Yluy1Fgfm gHhiXqiamWikpD0Qp+dpPo9K6kbm5MuG5SrnhyUFsoNzQGYWjP4gZbFCH7GohT0tQrPI b4GxSqGYzfje5rb23PNsJz38AHCr4Qhwk9IzwGzy2HyqQIErbmGO+Ew6aGzCoznaWbU6 LBjA== X-Gm-Message-State: ACrzQf23NGgnatDpYWNMWs6I7GOvFqMAoKQqdrli/mLavQNsQ/Rfytqy iuIlCPZqaGs9fsdj5ANRjmMjTQ== X-Google-Smtp-Source: AMsMyM6P+kbQZa+MmQq3yIJOz6N3zTNS9HCzupkiFwvUnyAIMLQFO7JZpP6RaaJ86An0YJJfI0NRMw== X-Received: by 2002:a17:902:e547:b0:178:43de:acac with SMTP id n7-20020a170902e54700b0017843deacacmr23426908plf.39.1664818849212; Mon, 03 Oct 2022 10:40:49 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id g13-20020a170902e38d00b0017550eaa3eesm7404108ple.71.2022.10.03.10.40.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Oct 2022 10:40:48 -0700 (PDT) Date: Mon, 3 Oct 2022 10:40:47 -0700 From: Kees Cook To: Rick Edgecombe 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 , Borislav Petkov , Cyrill Gorcunov , Dave Hansen , Eugene Syromiatnikov , Florian Weimer , "H . J . Lu" , Jann Horn , Jonathan Corbet , Mike Kravetz , Nadav Amit , Oleg Nesterov , Pavel Machek , Peter Zijlstra , Randy Dunlap , "Ravi V . Shankar" , Weijiang Yang , "Kirill A . Shutemov" , joao.moreira@intel.com, John Allen , kcc@google.com, eranian@google.com, rppt@kernel.org, jamorris@linux.microsoft.com, dethoma@microsoft.com, Yu-cheng Yu Subject: Re: [PATCH v2 05/39] x86/fpu/xstate: Introduce CET MSR and XSAVES supervisor states Message-ID: <202210031032.82AD49E14@keescook> References: <20220929222936.14584-1-rick.p.edgecombe@intel.com> <20220929222936.14584-6-rick.p.edgecombe@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220929222936.14584-6-rick.p.edgecombe@intel.com> ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1664818850; a=rsa-sha256; cv=none; b=xQ0YGrPZUKB1+RfcuPvM5H6TKwnoSzvKz65EAL4c7nDmRfN5OPQ4BmkooHPEL0dsLZmGYK fyc0CVojOOx5555JH8dduLpTSFWEoYlzmLwYeQriFgzsi27R3k48ChuDxwUH/VELtAQ7eq oZFFFtK8NnpicATX+r1NhQn34pAcDRE= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b="KJmn+3c/"; spf=pass (imf03.hostedemail.com: domain of keescook@chromium.org designates 209.85.216.51 as permitted sender) smtp.mailfrom=keescook@chromium.org; dmarc=pass (policy=none) header.from=chromium.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1664818850; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=7trZKNMH95kI/vdclw2zTtJbLljChYab2N/m8HA2aLk=; b=Jc6R4E7PnLa0Th8j2pqSJqFAtYos8/3kUpUjOepf/jNtxl0HxkvOL4lOlU/Yf4zZPDXssV ekhfy3xcJfV8YlsN8d2qbCO2Jzeu8vBsaVxgFa1s/tNP/t3GGlKFMuKgjfQHnndyvXM3G/ LmFmFoD5DhmPcwNaFPiPZU+PR0bjp0U= X-Rspamd-Server: rspam08 X-Rspam-User: X-Rspamd-Queue-Id: 3D79220002 Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b="KJmn+3c/"; spf=pass (imf03.hostedemail.com: domain of keescook@chromium.org designates 209.85.216.51 as permitted sender) smtp.mailfrom=keescook@chromium.org; dmarc=pass (policy=none) header.from=chromium.org X-Stat-Signature: ief6gj8koamuhi49t5gj43po96kaxbim X-HE-Tag: 1664818850-163741 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Thu, Sep 29, 2022 at 03:29:02PM -0700, Rick Edgecombe wrote: > [...] > xfeatures. So refactor these check's by having XCHECK_SZ() set a bool when > it actually check's the xfeature. This ends up exceeding 80 chars, but was Spelling nit through-out all patches: possessive used for plurals. E.g. the above "check's" instances should be "checks". Please review all the documentation and commit logs; it shows up a lot. :) > [...] > diff --git a/arch/x86/kernel/fpu/xstate.c b/arch/x86/kernel/fpu/xstate.c > index c8340156bfd2..5e6a4867fd05 100644 > --- a/arch/x86/kernel/fpu/xstate.c > +++ b/arch/x86/kernel/fpu/xstate.c > @@ -39,26 +39,26 @@ > */ > static const char *xfeature_names[] = > { > - "x87 floating point registers" , > - "SSE registers" , > - "AVX registers" , > - "MPX bounds registers" , > - "MPX CSR" , > - "AVX-512 opmask" , > - "AVX-512 Hi256" , > - "AVX-512 ZMM_Hi256" , > - "Processor Trace (unused)" , > - "Protection Keys User registers", > - "PASID state", > - "unknown xstate feature" , > - "unknown xstate feature" , > - "unknown xstate feature" , > - "unknown xstate feature" , > - "unknown xstate feature" , > - "unknown xstate feature" , > - "AMX Tile config" , > - "AMX Tile data" , > - "unknown xstate feature" , > + "x87 floating point registers" , > + "SSE registers" , > + "AVX registers" , > + "MPX bounds registers" , > + "MPX CSR" , > + "AVX-512 opmask" , > + "AVX-512 Hi256" , > + "AVX-512 ZMM_Hi256" , > + "Processor Trace (unused)" , > + "Protection Keys User registers" , > + "PASID state" , > + "Control-flow User registers" , > + "Control-flow Kernel registers (unused)" , > + "unknown xstate feature" , > + "unknown xstate feature" , > + "unknown xstate feature" , > + "unknown xstate feature" , > + "AMX Tile config" , > + "AMX Tile data" , > + "unknown xstate feature" , What a strange style. Why not just leave the commas after the " ? Then these kinds of multi-line updates aren't needed in the future. > [...] > - /* > - * Make *SURE* to add any feature numbers in below if > - * there are "holes" in the xsave state component > - * numbers. > - */ > - if ((nr < XFEATURE_YMM) || > - (nr >= XFEATURE_MAX) || > - (nr == XFEATURE_PT_UNIMPLEMENTED_SO_FAR) || > - ((nr >= XFEATURE_RSRVD_COMP_11) && (nr <= XFEATURE_RSRVD_COMP_16))) { > + if (!chked) { > WARN_ONCE(1, "no structure for xstate: %d\n", nr); > XSTATE_WARN_ON(1); > return false; This clean-up feels like it should be part of a separate patch, but okay. :) Reviewed-by: Kees Cook -- Kees Cook