Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2097383rwb; Thu, 17 Nov 2022 06:33:02 -0800 (PST) X-Google-Smtp-Source: AA0mqf7CjawcbCd2AcCzyiMiOfH2nPiMQUQdLTBNeibZypLYNlE+BNC7u/i0Hk+KV2qcPX64T6Uv X-Received: by 2002:a63:6485:0:b0:476:bfb9:582 with SMTP id y127-20020a636485000000b00476bfb90582mr2267706pgb.306.1668695582464; Thu, 17 Nov 2022 06:33:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668695582; cv=none; d=google.com; s=arc-20160816; b=cmMoLMuzf8F3+aO671H26sWpj7qHJVWtFtFFONLgLN6sva60URd1O/HQB+QDAD8Mgy vtQb8Xe+RJ4yDAiyy28uIokHTqHJNwwPEV+d9mu5sl7+avO0vAuXJCQnlw+/LY92/l1Z t3TkQ/4DN8I4GdkuoVwSeZ1adg5xQiP8x/0EFLJE2WvvoYG04E4k3RFRxmFQGMtOzuLu rheQgwmJu+Flzk2CHbx026Omfpi62MGD8bmU2ARuagqE14b87D6QXZQBkkWPhJ05Pg1U cPEOxvN1o2E0JnlLKdw6v0dvBERrLhZdkrH4+OykrGTdayzTD95oSlxlZJS4bufNaR6e 2VBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=fwfXj9i+0drfeAtV3x/BJbMGowEj2984Cc/3ytwqZcU=; b=IMQxWKCZsZ5qGa3dP1cGzyC+eNc5uL8mMXFfA8h0y/daDusfrusYS+hI1SnMwx4U34 SmPRbfPCFnS2Re8LzMivgvzF/yJTMsuWpGwoyMApPCaDay0yAOVFsCb4scEz15VqsmmS ARrJM3L80uhJpCzjVS8/He5YJ7e1kV0vYik7ILhqH1EIUEY9YMyteRQW9MUNjUzLRa1W BXg22FolrhnjwvhBUdcM5mZLWnEweDTwjLXC/TQOD2h511g3EGmE1N+Pnq/UlIkEuV9o 6iu+pHcGhfahGkF3gh4YU9WtfzIp0rIiVLbQpupbhoA+DLiNqD01Aqx9R/k/HjeL5UD+ Qxsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=KZVC5rsc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f14-20020a170902ce8e00b001853ad3944dsi1232200plg.480.2022.11.17.06.32.49; Thu, 17 Nov 2022 06:33:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=KZVC5rsc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234765AbiKQOPq (ORCPT + 92 others); Thu, 17 Nov 2022 09:15:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46882 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234758AbiKQOPf (ORCPT ); Thu, 17 Nov 2022 09:15:35 -0500 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D55D63E5; Thu, 17 Nov 2022 06:15:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Transfer-Encoding: Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Sender:Reply-To:Content-ID:Content-Description; bh=fwfXj9i+0drfeAtV3x/BJbMGowEj2984Cc/3ytwqZcU=; b=KZVC5rscvSiJsyoZlBXxoTQtTB 5ldi2h+HYWjRL1mnMiZtA39wkJdfvf9ezxl3yKLMMVJnDkoG0btc/6h8cUs10tELVVdgxp5/HP13k lty5MCtWPNWA8yVbzaNK6Erpks/hJfDwdkagDaJH/50gefiKH4OuJqQa6sDhi9BEH4UdUyg+A3+MY t7N0sM4tE4/X/wG+mH2DUnF2cx/E7okVhFaHzmFdOvVSLBse+ad6x6xJ961SiYWD48vNi9CK8tkez BbI5DPiuGl29Y6FLhXH2dm9j2fl2pRZ+1vWOXmtVTvQmF7Ct0tc/aZjtkquIQ2GdhQIa3vVlqCjuU EABT5AzQ==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1ovffP-001hFW-Uz; Thu, 17 Nov 2022 14:15:00 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 73C33300454; Thu, 17 Nov 2022 15:14:58 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 5B4D0207D6246; Thu, 17 Nov 2022 15:14:58 +0100 (CET) Date: Thu, 17 Nov 2022 15:14:58 +0100 From: Peter Zijlstra To: "Schimpe, Christina" Cc: "Edgecombe, Rick P" , "bsingharora@gmail.com" , "hpa@zytor.com" , "Syromiatnikov, Eugene" , "rdunlap@infradead.org" , "keescook@chromium.org" , "Yu, Yu-cheng" , "dave.hansen@linux.intel.com" , "kirill.shutemov@linux.intel.com" , "Eranian, Stephane" , "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" , "bp@alien8.de" , "oleg@redhat.com" , "hjl.tools@gmail.com" , "Yang, Weijiang" , "Lutomirski, Andy" , "pavel@ucw.cz" , "arnd@arndb.de" , "tglx@linutronix.de" , "mike.kravetz@oracle.com" , "x86@kernel.org" , "linux-doc@vger.kernel.org" , "jamorris@linux.microsoft.com" , "john.allen@amd.com" , "rppt@kernel.org" , "mingo@redhat.com" , "Shankar, Ravi V" , "corbet@lwn.net" , "linux-kernel@vger.kernel.org" , "linux-api@vger.kernel.org" , "gorcunov@gmail.com" , "akpm@linux-foundation.org" Subject: Re: [PATCH v3 35/37] x86/cet: Add PTRACE interface for CET Message-ID: References: <20221104223604.29615-1-rick.p.edgecombe@intel.com> <20221104223604.29615-36-rick.p.edgecombe@intel.com> <223bf306716f5eb68e4f9fd660414c84cddd9886.camel@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Nov 17, 2022 at 12:25:16PM +0000, Schimpe, Christina wrote: > > + Christina > > > > On Tue, 2022-11-15 at 15:43 +0100, Peter Zijlstra wrote: > > > On Fri, Nov 04, 2022 at 03:36:02PM -0700, Rick Edgecombe wrote: > > > > From: Yu-cheng Yu > > > > > > > > Some applications (like GDB and CRIU) would like to tweak CET state > > > > via ptrace. This allows for existing functionality to continue to > > > > work for seized CET applications. Provide an interface based on the > > > > xsave buffer format of CET, but filter unneeded states to make the > > > > kernel’s job easier. > > > > > > > > There is already ptrace functionality for accessing xstate, but this > > > > does not include supervisor xfeatures. So there is not a completely > > > > clear place for where to put the CET state. Adding it to the user > > > > xfeatures regset would complicate that code, as it currently shares > > > > logic with signals which should not have supervisor features. > > > > > > > > Don’t add a general supervisor xfeature regset like the user one, > > > > because it is better to maintain flexibility for other supervisor > > > > xfeatures to define their own interface. For example, an xfeature > > > > may decide not to expose all of it’s state to userspace. A lot of > > > > enum values remain to be used, so just put it in dedicated CET > > > > regset. > > > > > > > > The only downside to not having a generic supervisor xfeature > > > > regset, is that apps need to be enlightened of any new supervisor > > > > xfeature exposed this way (i.e. they can’t try to have generic > > > > save/restore logic). But maybe that is a good thing, because they > > > > have to think through each new xfeature instead of encountering > > > > issues when new a new supervisor xfeature was added. > > > > > > Per this argument this should not use the CET XSAVE format and CET > > > name at all, because that conflates the situation vs IBT. Enabling > > > that might not want to follow this precedent. > > > > Hmm, we definitely need to be able to set the SSP. Christina, does GDB need > > anything else? I thought maybe toggling SHSTK_EN? > > In addition to the SSP, we want to write the CET state. For instance for inferior calls, > we want to reset the IBT bits. This is about Shadow Stack -- IBT is a completely different feature and not subject of this series. Also, wth is an inferior call?