Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp1226148rdh; Fri, 27 Oct 2023 08:06:35 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFmbIGvU1PgYzRLLtxyb3Z5XZAbth9wClFPXDJ7/iIn4uKFoWlDwFlZaubkhqUQqf8MNAIe X-Received: by 2002:a05:6808:10d2:b0:3b2:dda7:d2b8 with SMTP id s18-20020a05680810d200b003b2dda7d2b8mr3777663ois.2.1698419194283; Fri, 27 Oct 2023 08:06:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698419194; cv=none; d=google.com; s=arc-20160816; b=ZXMy59ZPOktFq6HcIqBVkdHrzypLaAsaF3Fss3zE1Vm/fn/8tT/pYZhIF6X5/H3qtM 8tWmlGFQwQ0LC1CHdgKgWEnlt+r8wqAERCa7YG3+22AZiPIZMUA/00no/nuKpmAaT9rF vCarMg9RZ0JX+K4uYB4wiM58zeCVnKw3WVxNNDNXrtQ9RYRmRo8snKDxD57kmOp0dipE P5i9adwCRy/CZb7euDDjZELCQTp9Dive/K6C9wThnlHsb0rl9ObS2uyB6URo/yhyHFwg B32OnTdYWA82kD09wc8BSQjhNwgHiYJJcJMAstpSLg38EZFt1dX5hxBGOI12DYLBGICP qNtA== 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=PpMJIdoe3bmE+920JpMmxd1jccvyccBHcr6EI9Qw7fY=; fh=hKT2tKI4Mr3Fgx9MJcnQ5h5PBdcopCeROpxKf8lxj8I=; b=C6lDUxSjkmRu+8+MLLPARHqwfDGYW37Llb3gIIR0uBtNo2ih78XXH3zGt9xwlpsqlw o0i/ujPBLYsPZG/xCmqSpb2BWT8W2NqjLZx9sjgBQlrvCSeg5aIJJeaVepB04YbUia1W qmV1ozeAs/am12KUIzI3HQPw17Z64iThd1DCoqZQxxJqlS/fvp2dJnP2oYykB05SY+fn w1Hwn0PW6SLi/Zzhrl2nguvPaFLksvlKR+DrNqhthlcgiYD/syuPbU9qMEW/hxK9vYFp PQm1iQLn7hqW2cJHLsxcFdQaME+nJd4ZH4OgVZc5FSmdHFj5W4VP1IWZT2m4t9WAS5mV GTtw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=IldsEiFB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id q2-20020a67f042000000b0045271cb1ed9si235297vsm.714.2023.10.27.08.06.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Oct 2023 08:06:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=IldsEiFB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 8E6D38063035; Fri, 27 Oct 2023 08:05:50 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346164AbjJ0PFj (ORCPT + 99 others); Fri, 27 Oct 2023 11:05:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33640 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231791AbjJ0PFh (ORCPT ); Fri, 27 Oct 2023 11:05:37 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6C40FC4; Fri, 27 Oct 2023 08:05:35 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4DFB2C433C7; Fri, 27 Oct 2023 15:05:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1698419135; bh=6DZb3YA47Tj4rWwCUYdaQTqFi0PaTzEpzyXKXZEANKI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=IldsEiFBj4G8bFlHXmKFlE+eUMVgVikT3NgQFmOcR8SacS3pqo7bvRekw039Esax4 3FgDWRcqT/4xdsUDIjm7LOKo6qObo+FUmOq51f+MAJA1gKNTg1BnC5z36Wt/PKhy42 /ppg7WET2RC5CucQufQLZr22UiIlTyhqFBqK+z7DIx4VLRa9H4xaQPEnmdt09GyX38 tUazlq8ar5etBziJs7z0JrfekI/2+hI1TasBwBeZPlQTlmryXjGSAaehyY/TkZFFRn 2HXCfwSOI3JMe+sUZEAhZMJGXenQ+N0DsEJFsciTf4envhDeTVMWpTkWI+5EJIquX/ DlVueeyZDnC2A== Date: Fri, 27 Oct 2023 16:05:28 +0100 From: Mark Brown To: "Szabolcs.Nagy@arm.com" Cc: Deepak Gupta , "Edgecombe, Rick P" , "dietmar.eggemann@arm.com" , "keescook@chromium.org" , "brauner@kernel.org" , "shuah@kernel.org" , "mgorman@suse.de" , "dave.hansen@linux.intel.com" , "fweimer@redhat.com" , "linux-kernel@vger.kernel.org" , "vincent.guittot@linaro.org" , "hjl.tools@gmail.com" , "rostedt@goodmis.org" , "mingo@redhat.com" , "tglx@linutronix.de" , "vschneid@redhat.com" , "catalin.marinas@arm.com" , "bristot@redhat.com" , "will@kernel.org" , "hpa@zytor.com" , "peterz@infradead.org" , "jannh@google.com" , "bp@alien8.de" , "bsegall@google.com" , "linux-kselftest@vger.kernel.org" , "linux-api@vger.kernel.org" , "x86@kernel.org" , "juri.lelli@redhat.com" Subject: Re: [PATCH RFC RFT 2/5] fork: Add shadow stack support to clone3() Message-ID: References: <20231023-clone3-shadow-stack-v1-0-d867d0b5d4d0@kernel.org> <20231023-clone3-shadow-stack-v1-2-d867d0b5d4d0@kernel.org> <8b0c9332-ba56-4259-a71f-9789d28391f1@sirena.org.uk> <2ec0be71ade109873445a95f3f3c107711bb0943.camel@intel.com> <807a8142-7a8e-4563-9859-8e928156d7e5@sirena.org.uk> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="iYamXeVK/ZDq+CMx" Content-Disposition: inline In-Reply-To: X-Cookie: Save energy: Drive a smaller shell. X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Fri, 27 Oct 2023 08:05:50 -0700 (PDT) --iYamXeVK/ZDq+CMx Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Fri, Oct 27, 2023 at 12:49:59PM +0100, Szabolcs.Nagy@arm.com wrote: > The 10/26/2023 13:40, Deepak Gupta wrote: > > In general, I am assuming such placement requirements emanate because > > regular stack holds data (local args, etc) as well and thus software may > > make assumptions about how stack frame is prepared and may worry about > > layout and such. In case of shadow stack, it can only hold return > no. the lifetime is the issue: a stack in principle can outlive > a thread and resumed even after the original thread exited. > for that to work the shadow stack has to outlive the thread too. > (or the other way around: a stack can be freed before the thread > exits, if the thread pivots away from that stack.) > posix threads etc. don't allow this, but the linux syscall abi > (clone) does allow it. > i think it is reasonable to tie the shadow stack lifetime to the > thread lifetime, but this clearly introduces a limitation on how > the clone api can be used. such constraint on the userspace > programming model is normally a bad decision, but given that most > software (including all posix conforming code) is not affected, > i think it is acceptable for an opt-in feature like shadow stack. I tend to agree - software that's doing a lot of stack pivoting could do something like allocate a small stack with clone3() and then immediately pivoting away from it so they never actually use the stack that's tied to the thread. It's a bit clunky and wasteful but should work. Since everyone seems OK with dealing with the placement issues by specifying size only I'm planning on sending a new version that does that after the merge window, assuming nobody else raises concerns. --iYamXeVK/ZDq+CMx Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmU70bUACgkQJNaLcl1U h9D6DQf8DwMUjt+7+yvXg6kbkMf4F05kvLRL/c3h4p7Kqy6K8wQ78rycdYFYqE/3 cKDlS5Y2Cu8antdFPldSlObYFxJo7VAgGC0IL1IkJay2J+uerz3BzNReTuvLU82J NL04R/znP08P8RUxbclaEjGQ/cfkYqLj+aNO3vLQyxscA7a3VkeZsdagcsB18tH7 OfivqAaI2+umntU0jJ7ixfVv0Xt/WlgHYyEPD9bLY8lCA6wHPnZ0RQ6NYDW0jhpg L/7Nx/pdtVtogt+ko1IfiPmBKVdipTArRVGuc1nj2Ru3u6p0hexzZC25PsbViBNv r0s5BMFEAuzQzv2Gs0866iKwfAY+gA== =6Vdn -----END PGP SIGNATURE----- --iYamXeVK/ZDq+CMx--