Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp7403117rwb; Tue, 15 Nov 2022 11:44:42 -0800 (PST) X-Google-Smtp-Source: AA0mqf5DtnB1fQAnZFI6PW4ZfcdAY0yNxoZLdDChwhChbrwN8lmmc6MTPXOjYKnwQOEsm++I0ksd X-Received: by 2002:a17:907:1ddb:b0:78d:894d:e123 with SMTP id og27-20020a1709071ddb00b0078d894de123mr14882067ejc.112.1668541482087; Tue, 15 Nov 2022 11:44:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668541482; cv=none; d=google.com; s=arc-20160816; b=W+dA+hqC/RaafYuVi8m1XZ3cT4Quy1ZA4111FsacMyNR4ACcxPGgTGvXzEemDFt4YD CEmWFlEBsjFT/YrOwe8/qOyvadS/z5SO+c4g+ZBs8/H1h4CbXPr/JSrhtsmRbpyGJ1io 3eYqQqCead4HFL1t/yJu9hktKpLXS4bSMDof0OKfZZy8hVgTRf6NgoRz+kgmdtD7fKgC CF9fd2Vfm99zMT41bkkygEcgifDKmrjaJ87W0YFlD6/DtMNyeA2m8nfpmIZFCa6FyM2v QtcqTZkPTKk7/quSpWB/UqCpfi/9vOM8Vh8fHqWnfhZp6dMA9qXirh1xQ62WpOvRS5FS pyuQ== 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-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=xQGbwJBFPdywGVEY1nsUqo2w6Ph8/bC9PDVo83SGkBE=; b=GOg7uFPekiXjhYFyqplFmeOwGtwevVzBoffyfBCN+hxYsBQM9Ntf0RCw1gPRCrEAbM LlWpAd/PzRAI7qQGiYmebfQj63i7VPEV5PFERSuel44YxsY49urHl0vWoBQpmcHM9H1U ybBIPMh8MZ1B1u8DCijZSZkeRjRFUqfdCZOwbhOF3JB1OCAGR0uXftC0Vi3SSOtZX9SB Tj/hj2Z3DiCcsIW3UF/jN/oK/efckszL2Dm1VXU+AGDvXAeh+ilO6ltnP7vwBhc8+A4B IHpUpyBXPqskT/v/V8DZB8RFx+vae1zYugWINQ2TsOV2bQfX9DpQacazU66O/mvA6tLc 3ZPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=R+jp8cla; 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 sg10-20020a170907a40a00b007ae40ff2f11si1665454ejc.651.2022.11.15.11.44.18; Tue, 15 Nov 2022 11:44:42 -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=casper.20170209 header.b=R+jp8cla; 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 S230331AbiKOTeR (ORCPT + 91 others); Tue, 15 Nov 2022 14:34:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37614 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229693AbiKOTeK (ORCPT ); Tue, 15 Nov 2022 14:34:10 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 41BE7A189; Tue, 15 Nov 2022 11:34:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=xQGbwJBFPdywGVEY1nsUqo2w6Ph8/bC9PDVo83SGkBE=; b=R+jp8claD3kKSP26LER/jd1Ub6 HsbUQoiGXISXe/c+55v0VWTJ7MnwOd1HJ//X2FPUubx7XQHvOUC5E7OMqWpyL+eIOxwMvnFtP5ghV jNiCS1exb5MvPmxmmwN+6KZ/cRdFwQhFqqul6jk/djVlHvafCMK7qaNh60B9AHTOnvvKx0P3hD4F1 V+mRLnIPWrspe+2jaznHOVlEQNkYki1Dq9DjWnoHW0+jhXtvqtLai3X2uKrnsI0LT/Cc49yIp+moF Mo7iBZfk1TzIoJ9xeGU6nJv+5tACw6fSSFnoQiiy/ZuHvkt+lmGEkUE2sGAkrDpX9WyHW38x9CJVQ bd38ONNw==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1ov1gd-00GXs5-9I; Tue, 15 Nov 2022 19:33:35 +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 71321302D84; Tue, 15 Nov 2022 15:47:05 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 590C820C99E5C; Tue, 15 Nov 2022 15:47:05 +0100 (CET) Date: Tue, 15 Nov 2022 15:47:05 +0100 From: Peter Zijlstra 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 , Kees Cook , Mike Kravetz , Nadav Amit , Oleg Nesterov , Pavel Machek , Randy Dunlap , "Ravi V . Shankar" , Weijiang Yang , "Kirill A . Shutemov" , John Allen , kcc@google.com, eranian@google.com, rppt@kernel.org, jamorris@linux.microsoft.com, dethoma@microsoft.com, akpm@linux-foundation.org, Mike Rapoport Subject: Re: [PATCH v3 36/37] x86/cet/shstk: Add ARCH_CET_UNLOCK Message-ID: References: <20221104223604.29615-1-rick.p.edgecombe@intel.com> <20221104223604.29615-37-rick.p.edgecombe@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221104223604.29615-37-rick.p.edgecombe@intel.com> 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 Fri, Nov 04, 2022 at 03:36:03PM -0700, Rick Edgecombe wrote: > diff --git a/arch/x86/kernel/shstk.c b/arch/x86/kernel/shstk.c > index 71620b77a654..bed7032d35f2 100644 > --- a/arch/x86/kernel/shstk.c > +++ b/arch/x86/kernel/shstk.c > @@ -450,9 +450,14 @@ long cet_prctl(struct task_struct *task, int option, unsigned long features) > return 0; > } > > - /* Don't allow via ptrace */ > - if (task != current) > + /* Only allow via ptrace */ Both the old and new comment are equally useless for they tell us nothing the code doesn't already. Why isn't ptrace allowed to call these, and doesn't that rather leave CRIU in a bind, it can unlock but not re-lock the features, leaving restored processes more vulnerable than they were. > + if (task != current) { > + if (option == ARCH_CET_UNLOCK && IS_ENABLED(CONFIG_CHECKPOINT_RESTORE)) { Why make this conditional on CRIU at all? > + task->thread.features_locked &= ~features; > + return 0; > + } > return -EINVAL; > + } > > /* Do not allow to change locked features */ > if (features & task->thread.features_locked) > -- > 2.17.1 >