Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp1577316rdb; Mon, 2 Oct 2023 14:11:22 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGYOerSsN6tqvBOxRKhnBRcrvnzDIDa4YullcbNIDu+LVTwC6JA9McleMkTiDir6lI/e5FF X-Received: by 2002:a17:902:724a:b0:1c6:2927:fbbd with SMTP id c10-20020a170902724a00b001c62927fbbdmr11797460pll.18.1696281082186; Mon, 02 Oct 2023 14:11:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696281082; cv=none; d=google.com; s=arc-20160816; b=a3xL4soQuY6ce/iad+1iBcX0esQTFb3prRJhrE4iaiwNPSvuapPZaDHGs5jqR1/hW9 OLOrN4Xzgl3C2GFb6YY7N+xdWfX5/utkL+69jHRcnQDnALGxkTuk1C0chyPChQRVMZkw 2CQyrQlc/uggYLHep5ZTO6M8xbeAHyNmcYFt/CYJPYUMex45FdCV/EAd3L77Oeja7N/B swpPxaRU/Vwt2mowquNsP6srBwsCI2oaW9UANlI8gofpBoCYCAi/aGL4STT86q5ApOGD OGZf+DBzyQQlKvRgcJ2hAPKM81jbg5VE/tfxU+eqBfdn0w+6D5wIM5WqX1HdVHJubCmS l5Gw== 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=O7KyxLpElC1Kmd7M3B7OSWlskD2qA8r9ggMVZ39Nl3w=; fh=oOLr+n7Zwasjdvc8adg9RVTtdSQPcIDVNx1+AMNjpGY=; b=WIniZ17eRQNxMLUuV1eXb5qAh73JlDeXtzJpTEHUH+Yh11DfBAZztKKBx6DAjX2SNo BjUc9WbC6fKRrX9MdH+Lqae538U8aYEncta2lnFi8CqxdPLXR+rOcfn+XS+cBNP0MJZr JycHi6LY9QgIBjlOJd1VsNHa8pvWytsHTvPinnPn7StChHaUJ6hs9u59bBgwMNxv7GKV zDati5cytO4s0zIgRw+YZxd0vYgzBcLeAkrOgm4FERRHEAsO4ukOTyojpMn4OkKfhBL0 bXXasYmmXw0l1p+/uVRRTKdFAUv7a8h9+RHURnPGZPxOP5LWKrLUDlo/knf88JrzPKC5 Jzzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=kKXwOWMa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id u6-20020a17090341c600b001c0c4be62basi30369972ple.617.2023.10.02.14.11.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Oct 2023 14:11:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=kKXwOWMa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (Postfix) with ESMTP id 7E10080ECF9B; Mon, 2 Oct 2023 12:49:46 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238935AbjJBTtm (ORCPT + 99 others); Mon, 2 Oct 2023 15:49:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39010 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229750AbjJBTtl (ORCPT ); Mon, 2 Oct 2023 15:49:41 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E85EB3; Mon, 2 Oct 2023 12:49:38 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 54401C433C8; Mon, 2 Oct 2023 19:49:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1696276178; bh=LSyryQpZ8HNgK9TYVlNlqsE7lc5WMeTA4wsbmFm3L9s=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=kKXwOWMamRR/cwKFQzaeuZxYaQcA9pAOs++Wwik8ym5z22A7p3jNfV2rtHHzHNGC8 0lheJnqFSM7L6ZYmOforDPwwL/34IFYGrLkgotPsqeADaR3LXrKS8hbZ/2FUWkkJNw LPB+4mw1S7AfYmbFrEOJSjjElJ1mJhnH1mh9IY7IFLod4E9pim8Rsyo+JVFASECtPU 7BJQzLgZfLui0jLmBNFFeGBb8GdQjLybPYSQZzcK78Be1ldmSWDG2t/IIul/GB9ivp PcFV0VmXEr1/HmvuFQ9ZAmkhFvUg2DUTdbV6RN72AGy3lVH9mUOZ3mPBUhvBoTKNPk Q6T67HS2ww7dA== Date: Mon, 2 Oct 2023 20:49:29 +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: <38edb5c3-367e-4ab7-8cb7-aa1a5c0e330c@sirena.org.uk> References: <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="gCNrmYlrm9/empAg" Content-Disposition: inline In-Reply-To: X-Cookie: Postage will be paid by addressee. 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Mon, 02 Oct 2023 12:49:46 -0700 (PDT) --gCNrmYlrm9/empAg Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Thu, Sep 28, 2023 at 05:59:25PM +0100, Szabolcs Nagy wrote: > The 08/23/2023 14:11, Catalin Marinas wrote: > > > 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. > i think raw clone / clone3 users may be relevant so we need a > solution such that they don't fail when gcs args are missing. Are we sure about that? Old binaries shouldn't be affected since they won't turn GCS so we're just talking about new binaries here - are there really so many of them that we won't be able to get them all converted over to clone3() and GCS in the timescales we're talking about for GCS deployment? I obviously don't particularly mind having the default size logic but if we allow clone() then that's keeping the existing behaviour and layering allocation via clone3() on top of it which Catalin didn't want. Catalin? > userspace allocated gcs works for me, but maybe the alternative > with size only is more consistent (thread gcs is kernel mapped > with fallback size logic if gcs size is missing): If we have size only then the handling of GCS and normal stack in struct clone_args would be inconsistent. Given that it seems better to have the field present, we can allow it to be NULL and do the allocation with the specified size but it should be there. > > An alternative would be for the clone3() to provide an address _hint_ > > and size for GCS and it would still be the kernel doing the mmap (and > > munmap on clearing). But at least the user has some control over the > > placement of the GCS and its size (and maybe providing the address has > > MAP_FIXED semantics). > the main thread gcs is still special: the size is provided > via prctl (if at all). Either that or we have it do a map_shadow_stack() but that's an extra syscall during startup. --gCNrmYlrm9/empAg Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmUbHsgACgkQJNaLcl1U h9Dyngf9Hy8AfP5kC/6h6EPVo7EVDeJ1A4cbGRBtR61F+kO0Gknu6S0AxnHkfkgt cODaJDIw85fav0lGTTx8Rlr/77kzihHWSNLwnyAaR1gPYzRgqM/XBdwf9M6mnT7I 907nXSNYnfB1pE+8Be1LmcXX8hbHhr6l3K+FT5vZQTcpEAGrxAv7xLNEZ7xMkqV0 PPa+7hjf+9MpBcZQbqjK+KpoCWdTAZkTcnqpKQApUqiAbs5aeKuDfqulxl4eQ7IF 4y3g5jbZpwsCSjlxNnQaT+K8cof3zDuHUV6Hf4rpNA4XfwybEbSPNYD8zZ8TYzbj 1IGtDcFokNQ4Y0FbRpYBRx621claGQ== =f6SF -----END PGP SIGNATURE----- --gCNrmYlrm9/empAg--