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 8A4FFC61DA4 for ; Mon, 13 Mar 2023 17:12:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231563AbjCMRMx (ORCPT ); Mon, 13 Mar 2023 13:12:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56698 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231439AbjCMRMn (ORCPT ); Mon, 13 Mar 2023 13:12:43 -0400 Received: from mail.skyhub.de (mail.skyhub.de [5.9.137.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3136A16AD4; Mon, 13 Mar 2023 10:12:06 -0700 (PDT) Received: from zn.tnic (p5de8e9fe.dip0.t-ipconnect.de [93.232.233.254]) (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 A39791EC0622; Mon, 13 Mar 2023 18:10:35 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1678727435; h=from:from: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; bh=nkKTq/4WyFVx6pB2Xg+q+iJ0RUH4l9vZi60hs/FYjRk=; b=c9pxxkI+7k7EHK3FvvIhyVXvpJdXznrzmK8aS32lEGgY/YvSl8mrdv6+RWUsTak5vUmrmg zG+mE+9padkduNFKg5PojdVsz5dqGOlR8cuCzm4Ku71Mx9Am59R9dH/HO79c1PQFx1rYWm BrqA28Maor8BpN0592FeDrSMMC4ZZqU= Date: Mon, 13 Mar 2023 18:10:31 +0100 From: Borislav Petkov To: "Edgecombe, Rick P" Cc: "david@redhat.com" , "bsingharora@gmail.com" , "hpa@zytor.com" , "Syromiatnikov, Eugene" , "peterz@infradead.org" , "rdunlap@infradead.org" , "keescook@chromium.org" , "Eranian, Stephane" , "kirill.shutemov@linux.intel.com" , "dave.hansen@linux.intel.com" , "linux-mm@kvack.org" , "fweimer@redhat.com" , "nadav.amit@gmail.com" , "jannh@google.com" , "dethoma@microsoft.com" , "kcc@google.com" , "linux-arch@vger.kernel.org" , "pavel@ucw.cz" , "oleg@redhat.com" , "hjl.tools@gmail.com" , "akpm@linux-foundation.org" , "Yang, Weijiang" , "Lutomirski, Andy" , "jamorris@linux.microsoft.com" , "arnd@arndb.de" , "tglx@linutronix.de" , "Schimpe, Christina" , "mike.kravetz@oracle.com" , "debug@rivosinc.com" , "linux-doc@vger.kernel.org" , "x86@kernel.org" , "andrew.cooper3@citrix.com" , "john.allen@amd.com" , "rppt@kernel.org" , "mingo@redhat.com" , "corbet@lwn.net" , "linux-kernel@vger.kernel.org" , "linux-api@vger.kernel.org" , "gorcunov@gmail.com" Subject: Re: [PATCH v7 38/41] x86/fpu: Add helper for initing features Message-ID: <20230313171031.GEZA9ZB01FRjCo98pr@fat_crate.local> References: <20230227222957.24501-1-rick.p.edgecombe@intel.com> <20230227222957.24501-39-rick.p.edgecombe@intel.com> <3385eaf888f4178607ce4621ae2103d08ba79994.camel@intel.com> <20230313110335.GAZA8DB6PNSMGOGHpw@fat_crate.local> <04f821e6d4a8a736e6df2eb73ce811022cd42537.camel@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <04f821e6d4a8a736e6df2eb73ce811022cd42537.camel@intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 13, 2023 at 04:10:14PM +0000, Edgecombe, Rick P wrote: > This seems more clear. I'm sorry for the noise here though, because > this has made me realize that the initing logic should never be hit. We > used to support the full CET_U state in ptrace, but then dropped it to > just the SSP and only allowed it when shadow stack is active. Right, you do check that at function entry. > This means that CET_U will always have at least the CET_SHSTK_EN bit > set and so not be in the init state. So this can probably just warn > and bail if it sees an init state. I don't mind the additional checks as this is a security thing so sanity checks are good, especially if they're cheap. And you don't need to reinit the buffer - just scream loudly when get_xsave_addr() returns NULL. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette