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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C2561C433FE for ; Mon, 3 Oct 2022 17:41:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229819AbiJCRld (ORCPT ); Mon, 3 Oct 2022 13:41:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60778 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229820AbiJCRky (ORCPT ); Mon, 3 Oct 2022 13:40:54 -0400 Received: from mail-pj1-x1034.google.com (mail-pj1-x1034.google.com [IPv6:2607:f8b0:4864:20::1034]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2ABFA34716 for ; Mon, 3 Oct 2022 10:40:50 -0700 (PDT) Received: by mail-pj1-x1034.google.com with SMTP id g1-20020a17090a708100b00203c1c66ae3so10562031pjk.2 for ; Mon, 03 Oct 2022 10:40:50 -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=Z+hZ2CpQ/2/MQxqp9qMN7GgkY2ob1dxcVrSII3jAkEq6pR1w6a/squddpeO2eEEPSM ynUGjTaSHF1ny77zenHNJdAII4qsz6Fh4UZMAVd+yo+fNADEM/sF8EwWzIJ5XzKeCXLJ MigTST69zskYmk9j49dB1DmPIxSTN+vc5hruA+0yeObZX2dwIqEdi4trdgUO1tw/YqMc uBAwxvTyzChAIfXl+ChaCsI+V1Yh3LPe8q1eXDhrbJ/fqhLoe5+GLgc4rxxgBRUPXQdf EJSdnwNbdoX0AQzH92tC16SNwWnvH3IQxMDEQbVKX/w9ypKMe8zBZJYSh5h5+EZIH/SF xkWw== X-Gm-Message-State: ACrzQf2638g+7xB1W+EtMVhTK6/xy2HBEqI4inL1IGBwNzrhP/A1u5fj wnV69QxxOt3oqV+YgdO/+0hvdw== 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> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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