Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp1244014rdb; Fri, 1 Dec 2023 10:29:24 -0800 (PST) X-Google-Smtp-Source: AGHT+IHdpxL0oGNNp2l0Dp0tiotz+DzLobx51IQAMrJAymLsFY4gcnV6GgmddpvZP7vU8rS/iSra X-Received: by 2002:a62:5146:0:b0:6cd:ecfd:6cc1 with SMTP id f67-20020a625146000000b006cdecfd6cc1mr5465250pfb.26.1701455363358; Fri, 01 Dec 2023 10:29:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701455363; cv=none; d=google.com; s=arc-20160816; b=eZypjGXmd6ix6c11oKQ0I3tO6rueUEfrxslHhTofRYsPbp+GifMHbF9XMjiFAY1Onh f4Ior2YhfDPWJJeBqVY+iS8Rln9fRLb/LKVL/SFq08n2Qb1kYlp81hBL7++CUtyY8FYj MhI3H1rmhlj+4k2kqIBS0J4FdtKl/LZlLgLGQDhWJHfctEawbynSqN7XwYg07x6KF0zl O7MIxHzxneHRNTPv8hFJx2snw0fqHpDUt6+8mzZcOUDgvyWPGarUcHX+Q46z/84TCX8E 0yuq95AZBICt/bDy8fbI62twCGgNV7yuWY4ZpW3LGn1KckZ39lc6W66B7qWDJwu6Ivew +i1Q== 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=t27XT8s7D610GabxjsjG+HZfprwzDUZWAlwQusYckME=; fh=uxC1qAnC45zIDM+tVDe1SuFOhsKIbbOGzDlXRmGRI4w=; b=A368xP+DlQCJY+NJmq9+S4+uw4vCoan6irPBvakPPM/ZiqHSWl4es/nIpTt3MuIWNk IIIwvjN/PKN8AUbUFKZb4TXIeEcv5xwHwOS7jN1ocNMwa/uk2yFyFqmv2oAHBm2479YK qObdI7Mn2KUzUerM5ISNNiUfHdmmdPyAROptKn2rWegfYQzYCSPAuf1zbFqNFlgODT9a C5q/+5PKwOHwEqtZKDtHI3DPpXM7tiYqthBqBdplCUFW7QuCI9s+TVOaycxUGL+rvZaJ Ph+9ym6xacCShyHZe5qhpy573f48tUZQNJIU0BU1GxbRe6fF2PpVuWOTi1Rc++HB4RoR 2smw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=A81vm8Af; 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 z6-20020a63d006000000b005b977eea853si3818372pgf.694.2023.12.01.10.29.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Dec 2023 10:29:23 -0800 (PST) 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=A81vm8Af; 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 EF18982A3962; Fri, 1 Dec 2023 10:29:14 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230249AbjLAS2w (ORCPT + 99 others); Fri, 1 Dec 2023 13:28:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60716 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229534AbjLAS2w (ORCPT ); Fri, 1 Dec 2023 13:28:52 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9F64FC1 for ; Fri, 1 Dec 2023 10:28:58 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3274AC433C8; Fri, 1 Dec 2023 18:28:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1701455338; bh=GRzvb6K1F09jnFNhMGdAakhzpcFCOUV6/A//CTedh4I=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=A81vm8AffuWGRBlTGQ6h8Ukd3z/U1Ud6I5sNaVbK5J3kTwKD/u3+evexovH0kUvYr PtSE3KDikxJeZNGdGkSNH0mc6fmmAylgGwpToBd04E2B4LbMW14o+TcWeY25snyHDw fTtnf9n4lwHqrh8lDDaUZCoi9HMWqYsmkT0aVi2nsRZuoTN4oUBdH8i/5U/p/PTbu2 S2lGZJkv12gi0Q+9npLmBClZCuduDTBzgKiVkuRAouu7FmM1eWtUXxo2EweuRo9LfK ViEAJXevymtpRykKPA7pw6Da9zAy2v538ZItO3J830G494ZzD5isvKvrohPdYQ50j0 m6yojiW2HtnTQ== Date: Fri, 1 Dec 2023 18:28:48 +0000 From: Mark Brown To: Catalin Marinas Cc: "Rick P. Edgecombe" , Deepak Gupta , Szabolcs Nagy , "H.J. Lu" , Florian Weimer , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Valentin Schneider , Christian Brauner , Shuah Khan , linux-kernel@vger.kernel.org, Will Deacon , Kees Cook , jannh@google.com, linux-kselftest@vger.kernel.org, linux-api@vger.kernel.org, David Hildenbrand Subject: Re: [PATCH RFT v4 0/5] fork: Support shadow stacks in clone3() Message-ID: <37a35edb-e72d-4983-8be7-67c56d2292c5@sirena.org.uk> References: <20231128-clone3-shadow-stack-v4-0-8b28ffe4f676@kernel.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="CkFryha6tlsnAYUC" Content-Disposition: inline In-Reply-To: X-Cookie: The early worm gets the late bird. 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,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.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 (howler.vger.email [0.0.0.0]); Fri, 01 Dec 2023 10:29:15 -0800 (PST) --CkFryha6tlsnAYUC Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Fri, Dec 01, 2023 at 05:30:22PM +0000, Catalin Marinas wrote: > Another concern I had was that map_shadow_stack() currently takes > a flags arg (though only one flag) while the clone/clone3() allocate the > shadow stack with an implicit configuration (other than size). Would > map_shadow_stack() ever get new flags that we may also need to set on > the default thread shadow stack (e.g. a new permission type)? At that > point it would be better if clone3() allowed a shadow stack pointer so > that any specific attributes would be limited to map_shadow_stack(). The flags argument currently only lets you specify if a stack switch token should be written (which is not relevant for the clone3() case) and if a top of stack marker should be included (which since the top of stack marker is NULL for arm64 only has perceptible effect if a token is being written). I'm not particularly anticipating any further additions, though never say never. > If that's only theoretical, I'm fine to go ahead with a size-only > argument for clone3(). We could also add the pointer now and allocate > the stack if NULL or reuse it if not, maybe with some prctl to allow > this. It might be overengineering and we'd never use such feature > though. Yeah, it seems like a bunch of work and interface to test that I'm not convinced anyone would actually use. > > As well as the actual configuration of the size the other thing that we > > gain is that as well as relying on heuristics to determine if we need to > > allocate a new shadow stack for the new thread we allow userspace to > > explicitly request a new shadow stack. > But the reverse is not true - we can't use clone3() to create a thread > without a shadow stack AFAICT. Right. Given the existing implicit allocation only x86 ABI we'd need to retrofit that by adding an explicit "no shadow stack" flag. That is possible though I'm having a hard time seeing the use case for it. --CkFryha6tlsnAYUC Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmVqJeAACgkQJNaLcl1U h9DzAQf+LrewNdEd54lFym1uNzfqTALngDRzqEQiwyX9OjpXl7qCfKd77el1CZ0K CJz64ccqu/oWsPYXYcGbSzzFELkIyPbqIWZ48NeKCGVMapsadRneUI6QO0pONxhV UBVjFK0nqQeKMuXZXSPnPQ4r2TP6/8V0GXwpTmI6t2rMAIKgUQ0co0qAQBbVUWVh C+V88onP3gYcXwH6uKjmj27pT2gr2vJABiO/VkXt1CSXUlqK9VgG0cPwj/DHIq9X RiFY1ItDu4w+4efoNzq6mmX+hbBRDfqWWYzUeJl/XLd/1cDY3ZLB/CCzNvN5s4YW PXlpWyT3/osvaRjlXy33OnPqJ7lLQQ== =UeuB -----END PGP SIGNATURE----- --CkFryha6tlsnAYUC--