Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp1051555rdb; Fri, 1 Dec 2023 06:02:05 -0800 (PST) X-Google-Smtp-Source: AGHT+IFFRd+yX5P/1YC/voRAfPIsMHDgSGzZ4wpl4fKK3HEDR3rWFILcil1ttw2LqvuwhL7pYKEQ X-Received: by 2002:a05:6808:1705:b0:3a4:2941:af49 with SMTP id bc5-20020a056808170500b003a42941af49mr3339124oib.22.1701439324418; Fri, 01 Dec 2023 06:02:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701439324; cv=none; d=google.com; s=arc-20160816; b=Uz1zR7LRdnVJ7OYicTtX5LtVZHxyn6mgOWcvzT3Jo64fp/yBQofYvWDNt1CWVKJin6 1+KLxWOg6EqmvZfD50i3x1TVhxGZQVRW67UYGabDMajSqzZyFOw1ZYd+M+THPm9zsMF+ FbIh9+D+OeMktkOOyqr7dlLu16tP6g/VKG6/MOgAV1XZ4QJrWb+UNc9sxyofcw3W+VV0 CUoF5x/INq4tuWiyAPrLb5x8+ToztiZgSbqywiEidiBKP6eV2/4LDAb8K7EQNoJnEbST ByN+X4Usz785cX9dWyngK3kKxOydK7SKk8SlmNabWFyXL9E3NiPbMkU2+KYWB4+gYD0b hPYA== 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=cH/WQ4KETfzKoL236M7jGi9GYZdkGcwb5KqlIXUvyeg=; fh=16BDYB1psbxP8HPCWqUWyrDq+6sY9R1zpeEgATNdK6o=; b=II6jNdVW3mMik2fmVxv9zT08g4I3uo9uciEH4l01ep2FPRt0Sm+CxKRM56WgZMQTC2 yMcF4k61i/nzDYWmBsJ4RojNYg9mMyJ36mD6h5Mbnw2YY/hvy/+EctiQhWS2kT01a0wV dZ3NNolSkwbLr8Gpr6BF+PRYnz7lTfmjs9vc1R2F9XkbN72pg4Qyux9iWF53jGdjYAit RvTfq11ry5AMQc1NWcc+oFJ+ihuGKPLX2nN6KdMdQuuszqQdlnygjZ8CJiBD6K+Tw87Y r2L3DpqIWth2DN7Ur2vsJ5fL7wJ2GUPBLx3dsL++liUvROSLdDHWk29zvG9XeY6VPipV ACOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=XzdUKyur; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id e7-20020aca1307000000b003b842bc8c09si1277651oii.90.2023.12.01.06.01.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Dec 2023 06:02:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=XzdUKyur; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (Postfix) with ESMTP id CEF40807479F; Fri, 1 Dec 2023 06:00:46 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379087AbjLAOAf (ORCPT + 99 others); Fri, 1 Dec 2023 09:00:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37720 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379060AbjLAOAd (ORCPT ); Fri, 1 Dec 2023 09:00:33 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 534FACF for ; Fri, 1 Dec 2023 06:00:40 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2913FC433C8; Fri, 1 Dec 2023 14:00:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1701439240; bh=cH/WQ4KETfzKoL236M7jGi9GYZdkGcwb5KqlIXUvyeg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=XzdUKyurfLDqP1vkQGdkeo9Vp39hy0C1j4hwqhkwLy7UQuhcHmAyKkp1AaJR1YvpY wxRjWAynnlmZYfUCkPde5kSEXOKswvqf0pi37yfB8ceEgmFhbIfsHYODylbheVYZ+M wZRHT4F1OqsXdAoHXOVO4bc9nVePCrf5RQj2KhO2Pzg//uLffyqFr0St0XRTOHrQ6j LqiyoIRT2UAUU8Srdu/U64y5jcNsfh7rGTiZ437YpYybTc9hfO+eyb/jYRkRVYNdNk VinrS6WtrpYkKGsi0U9wEndI/l6c8EkO37vujystxtJrA3ddO160nmhXnf1zQNMAzk 1rtXbGcyuHkEQ== Date: Fri, 1 Dec 2023 14:00:31 +0000 From: Mark Brown To: "Edgecombe, Rick P" Cc: "catalin.marinas@arm.com" , "dietmar.eggemann@arm.com" , "keescook@chromium.org" , "Szabolcs.Nagy@arm.com" , "brauner@kernel.org" , "dave.hansen@linux.intel.com" , "debug@rivosinc.com" , "mgorman@suse.de" , "vincent.guittot@linaro.org" , "fweimer@redhat.com" , "linux-kernel@vger.kernel.org" , "mingo@redhat.com" , "rostedt@goodmis.org" , "hjl.tools@gmail.com" , "tglx@linutronix.de" , "linux-api@vger.kernel.org" , "vschneid@redhat.com" , "shuah@kernel.org" , "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" , "david@redhat.com" , "x86@kernel.org" , "juri.lelli@redhat.com" Subject: Re: [PATCH RFT v4 0/5] fork: Support shadow stacks in clone3() Message-ID: References: <20231128-clone3-shadow-stack-v4-0-8b28ffe4f676@kernel.org> <881e1b6d89d61cef4e71c6be688635fc47bb2b8e.camel@intel.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="RXABTafy96aV2/7C" Content-Disposition: inline In-Reply-To: <881e1b6d89d61cef4e71c6be688635fc47bb2b8e.camel@intel.com> X-Cookie: The early worm gets the late bird. X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Fri, 01 Dec 2023 06:00:47 -0800 (PST) --RXABTafy96aV2/7C Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Nov 30, 2023 at 11:37:42PM +0000, Edgecombe, Rick P wrote: > On Thu, 2023-11-30 at 21:51 +0000, Mark Brown wrote: > > On Thu, Nov 30, 2023 at 07:00:58PM +0000, Catalin Marinas wrote: > > explicitly request a new shadow stack.=A0 There was some corner case > > with > > IIRC posix_nspawn() mentioned where the heuristics aren't what we > > want > > for example. > Can't posix_spawn() pass in a shadow stack size into clone3 to get a > new shadow stack after this series? Yes, the above was addressing Catalin's suggestion that we add stack size control separately to clone3() instead - doing that would remove the ability to explicitly request a new stack unless we add a flag to clone3() at which point we're back to modifying clone3() anyway. > > > Another dumb question on arm64 - is GCSPR_EL0 writeable by the > > > user? If > > > yes, can the libc wrapper for threads allocate a shadow stack via > > > map_shadow_stack() and set it up in the thread initialisation > > > handler > > > before invoking the thread function? > > We would need a syscall to allow GCSPR_EL0 to be written. > I think the problem with doing this is signals. If a signal is > delivered to the new thread, then it could push to the old shadow stack > before userspace gets a chance to switch. So the thread needs to start > on a new shadow/stack. That's an issue, plus using a syscall just wouldn't work with a security model that locked down writes to the pointer which does seem like something people would reasonably want to deploy. --RXABTafy96aV2/7C Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmVp5v4ACgkQJNaLcl1U h9B1egf/blIXdR5uSvIkINi89u3Br4JE6lupOzoIADM0aQZN7uaqtT7T3F3qzJAV bqBIpN//uR3KUtud8CnlC1jMqYPUtCg4qiki9BYkG5z2libk8YJg/4rgFYhei7Zl iT9caiCXwNWGHxlp2yGLFh1VmRz4YFSuqf75Q3Cifl84LgcyvO5gu62jRHfwXDMU 9qL3k1dIhPVPKhGjORaj+80DUCC72LzolsXYrOZDwwqp9jb1g+8F31Em2P/d9HF0 7f0DkhYh+AI3t7qRYgGFYL+HW49MEfGFk0SxdOusMOsXF2CZN0LZgPuu0Xap7+CV 7IQIlw8S47qEV4/7yVFqNLoPb2Pp/g== =hmJJ -----END PGP SIGNATURE----- --RXABTafy96aV2/7C--