Received: by 2002:a05:7412:1492:b0:e2:908c:2ebd with SMTP id s18csp556707rdh; Wed, 23 Aug 2023 08:07:34 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHeK2kiee6AB9J8C1kD/MRaDg82b8x7KXpLCz/9HgCJS2vRgn1Li4PHS3skDEwh8ORu+9AD X-Received: by 2002:a05:6a00:124b:b0:68a:582b:44c4 with SMTP id u11-20020a056a00124b00b0068a582b44c4mr6894701pfi.3.1692803253646; Wed, 23 Aug 2023 08:07:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692803253; cv=none; d=google.com; s=arc-20160816; b=Rs2+nwrlYVW64WVDAU2B8WDtCZV3NVundUSuqKRqsFcqd/GfRRGTYKnJpr9GkbYLv2 MVKOf7bmCpxTeUnL9IatPXrUL32HSpwiicM/GKXyGLAuO/kXck3wJ8tslt+zbt/s38op mPz3Wvrc0W6xq7A4xZXvx1DXLNWoHX6sWeg+y4CJ6WpsVVhVYwONUwDgEdhTZt6FSGSA x8c0RV2NTXwbxJbfS++B6D3y7TeUFkXuWv/8A48yTTsEfbu8l8Sdzm0XIK4z4l2SzDoi QOavML32s5BJi88KC7qQsF5nkckso15XxNRK0EZXcBLHO5hs1r4BuKjsESyOGSpjOzHY ZJhw== 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=XQlYNLstkXezpVGR3Z9q9y7i0CmOgCIf6i0uCW7hdeY=; fh=xfAWAqAfX205dWUcwbPkJ2R1puUzDBUwGB2vLSxI14c=; b=Pdca0rbQCZb71wOMW7d+pkSGr9/arWfnCjtg15cKeJ1Km4H+PyJryEIA5D/MJIKlH1 W00tNzAZj2o14tclTwKDtQM45xeu5278AkGH+U4R9CVi6RxtSEJZ+KTIAVKRFmUJZ5b+ S6Q/26ADMssht/XHCYJA+sJ3dXRU6kLFzrP003EepfMipx3NZoU2y/GKYvkYG5Lor3US eTQGoJuGhQeiPZDTMvn/egICoJ8SR5zZYQKAGNJYc6B+fSQhVV8V1hpFlp4+dtUDuu/d /n0DLHZWP1/RME8dWZ6Y3qcOWa68emHkr1mx8xK3tVtqT9KIPNAyAHS/dZFBLRyO1pzV 8NGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=khDVpCaQ; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t17-20020a639551000000b00565f2784db2si11499428pgn.517.2023.08.23.08.07.20; Wed, 23 Aug 2023 08:07:33 -0700 (PDT) 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=@kernel.org header.s=k20201202 header.b=khDVpCaQ; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235114AbjHWMvt (ORCPT + 99 others); Wed, 23 Aug 2023 08:51:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56418 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232211AbjHWMvr (ORCPT ); Wed, 23 Aug 2023 08:51:47 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1FAEEE47; Wed, 23 Aug 2023 05:51:46 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A14E8645AF; Wed, 23 Aug 2023 12:51:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E4984C433C8; Wed, 23 Aug 2023 12:51:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1692795104; bh=aIGZdAZfibpwOhOBqgFa8nf151J9Hk7d7fWvjMeY4zc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=khDVpCaQdQhHesYs9RGRpVlvH8eWo3qrAoJKrfl6rCMMNb3+VNdzi5pk2+Le8Y9ph pjjFWBvFAjVLuMOHcw6ky5TwIBqzGIeijbo2SRxr602ZcPxbmBg0NBa4El+5f1jRbr uQ8Gdwk7KGPF1ZuROilSORtcM8Q8jen2QoY/J5xt8KrtGhe6i09i87Gj80vGx+LwzA Y4GMrP0i8eRT/b1xndfov0OxmF2Cz4oGiGH00guo7/YhFkDyuUKDLBQ8t5uExGCnkM CfV0NIyavGSn7UdSBpuE5djPSMDymoFZn4E8QzB6e0N2EDt8dObvj+9ZSIZtzI6gMq dbRiW9VbzcTqQ== Date: Wed, 23 Aug 2023 13:51:35 +0100 From: Mark Brown To: Szabolcs Nagy Cc: Catalin Marinas , Will Deacon , Jonathan Corbet , Andrew Morton , Marc Zyngier , Oliver Upton , James Morse , Suzuki K Poulose , Arnd Bergmann , Oleg Nesterov , Eric Biederman , Kees Cook , Shuah Khan , "Rick P. Edgecombe" , Deepak Gupta , Ard Biesheuvel , "H.J. Lu" , Paul Walmsley , Palmer Dabbelt , Albert Ou , linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, kvmarm@lists.linux.dev, linux-fsdevel@vger.kernel.org, linux-arch@vger.kernel.org, linux-mm@kvack.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org Subject: Re: [PATCH v4 03/36] arm64/gcs: Document the ABI for Guarded Control Stacks Message-ID: <227e6552-353c-40a9-86c1-280587a40e3c@sirena.org.uk> References: <20230807-arm64-gcs-v4-0-68cfa37f9069@kernel.org> <20230807-arm64-gcs-v4-3-68cfa37f9069@kernel.org> <43ec219d-bf20-47b8-a5f8-32bc3b64d487@sirena.org.uk> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="UdmTiHBngnlr6cvp" Content-Disposition: inline In-Reply-To: X-Cookie: Some optional equipment shown. X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS 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 --UdmTiHBngnlr6cvp Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Aug 23, 2023 at 11:09:59AM +0100, Szabolcs Nagy wrote: > The 08/22/2023 18:53, Mark Brown wrote: > > On Tue, Aug 22, 2023 at 05:49:51PM +0100, Catalin Marinas wrote: > > the what but not the why. For example roughly the current behaviour was > > already in place in v10 of the original series: > well the original shstk patches predate clone3 so no surprise there. > e.g. v6 is from 2018 and clone3 is 2019 linux 5.3 > https://lore.kernel.org/lkml/20181119214809.6086-1-yu-cheng.yu@intel.com/ Ah, that'd do it. People weren't excited enough on about clone3() when reviewing the shadow stack patches, I hadn't realised clone3() was so new. > > I do worry about the story for users calling the underlying clone3() API > > (or legacy clone() for that matter) directly, and we would also need to > > handle the initial GCS enable via prctl() - that's not insurmountable, > > we could add a size argument there that only gets interpreted during the > > initial enable for example. > musl and bionic currently use plain clone for threads. > and there is user code doing raw clone threads (such threads are > technically not allowed to call into libc) it's not immediately > clear to me if having gcs in those threads is better or worse. Right, that's my big worry - I hadn't realised it was extending as far as musl/bionic. > one difference is that userspace can then set gcspr of a new thread > and e.g. two threads can have overlapping gcs, however i don't think > this impacts security much since if clone3 is attacker controlled > then likely all bets are off. Yeah, I think that's a "you broke it, you get all the pieces" thing. =20 > > My sense is that they deployment story is going to be smoother with > > defaults being provided since it avoids dealing with the issue of what > > to do if userspace creates a thread without a GCS in a GCS enabled > > process but like I say I'd be totally happy to extend clone3(). I will > > put some patches together for that (probably once the x86 stuff lands). > > Given the size of this series it might be better split out for > > manageability if nothing else. > i would make thread without gcs to implicitly disable gcs, since > that's what's bw compat with clones outside of libc (the libc can > guarantee gcs allocation when gcs is enabled). That'd create a pretty substantial divergence with the x86 patches if they land this time around, there's not enough time to rework them now - I suppose it'd mainly bite people implementing libc type stuff but still, doesn't feel great. --UdmTiHBngnlr6cvp Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmTmANcACgkQJNaLcl1U h9CieQf+MMgnojrsBIaDJI83Wq0C8xk7vAXbThpL0v56u9wjmEZMDh7EcY2ddq/2 JABAkm2liE7SLPjWQBEUUN0/IeeUmkf96mYK4WQlULgjiwfY47oi3jWUhZ6k9LhM 8pjyl1KON9bRNIrulNLtQVYAPXm7vhGBmR0BjziAHJsdoaxh/mFuY24eV8GU6M+g 3y8nYYgKNOAjB6E6//Acfg4jVvxYJGMdmVlJl4REhmre1EGrE2R3NAiKDJZ/sKGz 3F4rR/Opy2Sa/VQFqR1eyjhZEjZxVgbrBukhZV+ExyMSjPfagV2qok97yi7jIIXg lRrBa8MwILXz0GiOAj9Xz5WDbjUsRQ== =F2xx -----END PGP SIGNATURE----- --UdmTiHBngnlr6cvp--