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 55B32C43219 for ; Tue, 15 Nov 2022 19:33:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6988E6B0071; Tue, 15 Nov 2022 14:33:56 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 5FAD56B0072; Tue, 15 Nov 2022 14:33:56 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4756E6B0074; Tue, 15 Nov 2022 14:33:56 -0500 (EST) 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 31ED66B0071 for ; Tue, 15 Nov 2022 14:33:56 -0500 (EST) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id E3DD61A0349 for ; Tue, 15 Nov 2022 19:33:55 +0000 (UTC) X-FDA: 80136676830.30.929F2B4 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf21.hostedemail.com (Postfix) with ESMTP id 5B0871C000B for ; Tue, 15 Nov 2022 19:33:54 +0000 (UTC) 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> ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1668540835; a=rsa-sha256; cv=none; b=bMtckiSqvNjdvHg7BiwVijrq99K36gxS3scM1B9SddZCSOTFR5pjZVx6kPwzGAMxLFCxlq +SJmprbsuFVal2XqlwJ4mwyzEf1G8LLxkdKTDtYClG3mwbablCtXtUys/JdYk/+XzA052N xKEIGLGb4W9udz+Sl1EJLhNpxeaBREw= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=R+jp8cla; dmarc=none; spf=none (imf21.hostedemail.com: domain of peterz@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=peterz@infradead.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1668540835; 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=xQGbwJBFPdywGVEY1nsUqo2w6Ph8/bC9PDVo83SGkBE=; b=MsdU4t0I1P/56CJDvNThI/DLXvlzLrQ29fKqizYdl+VVbx6Mshb+rexluU7Td+pl8/m0JY YX6jHDzpbNAxcwVGDp/p1HXST93hr38dDFOMjwEs7mnIDbmHGsv8mKNOTpaEfDn27THHNk YvTXyj1U74aA/GWjJMaQjUOI6G4qzZk= X-Rspamd-Queue-Id: 5B0871C000B X-Rspam-User: Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=R+jp8cla; dmarc=none; spf=none (imf21.hostedemail.com: domain of peterz@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=peterz@infradead.org X-Rspamd-Server: rspam06 X-Stat-Signature: k45ksrssxoiwbyj4okk4ob4qh8ddixej X-HE-Tag: 1668540834-470057 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 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 >