Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp268155rdh; Thu, 23 Nov 2023 03:38:11 -0800 (PST) X-Google-Smtp-Source: AGHT+IG/hu+fVhI5NYlHL1gzx0uX/7oyTJP1u7l8x6IFUcy0G+Pf8Dfg3XfKABHDVrvwnUebXqdS X-Received: by 2002:a05:6830:1084:b0:6b9:1af3:3307 with SMTP id y4-20020a056830108400b006b91af33307mr6251403oto.17.1700739491044; Thu, 23 Nov 2023 03:38:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700739491; cv=none; d=google.com; s=arc-20160816; b=XN/kTszrmG0zKOo/g7vPa6VlaABkWnC5ApTK2hnXH2lj86pj9yhJpozCEt5Dh1CgRC Ox50me0ETqAOfhI/x2F//kxP5ufsUlxHDGqKBSZOhxMxGs0KhMVO1Gt6dqL/lnezF06f C0GvY034+VSx48cmBPjI13PO7qk0QqTVLADJCSVfYd4XVALqCedPGbwcLqkcrvN8SYHG ZxoU/E+juxz/YnQlcyp8xiQSGZPo4OfoCzzM1SNMd3JkdgSAdH7zeyniG7KH2v+9tYFB fHHzxuBrDS6n3dNmXtgb3a3uOTPjuCSxlKHSUONSMiuRfMaZAhzJ7+jaDI9UzOTewrQS 98tQ== 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=9QYN4y7e0SufiloNuR2fXVoa2QmXVL+6wtyEc1LlrBE=; fh=pC6bmsIRTjZsjpPc7wHDrtbukWAPbkAD6EjldTop0I0=; b=t8Ow4x5zauhJBkbzHi7H/ek04Z50e2yjKR6Hgr9SGBRrEMoVozIE0etlE7afo3N9di 9CqqvJINt4A7lkpYEgns64xnPFNYflZ3kL3c3JMmx3UetQQJdSfPnTB7asxj67TioUoG UgQcz51v9KGHGG1b/Jeys8sgQncNiyHoG1T0xSOlHXHl9/rv+gq9pmSDqUMPXUYbBIR9 dclTrCTt5go+TCXiL0p3KvYCOlbpDzvZVWkVouxVEqzXFQ5N5A28i54Q31lfiXuLsCsR SAHLB09SPWv4ddVI2NgMGAaOyNke3lg1T/VkF/o8oq3UAbmfLh7yi9thvq6R0NU4Xcxs ulnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="O/nHMHVA"; 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 cm4-20020a056a020a0400b005be264316d6si1048136pgb.598.2023.11.23.03.38.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Nov 2023 03:38:11 -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="O/nHMHVA"; 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 87B97808BC96; Thu, 23 Nov 2023 03:38:08 -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 S1345079AbjKWLhw (ORCPT + 99 others); Thu, 23 Nov 2023 06:37:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49694 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345034AbjKWLhu (ORCPT ); Thu, 23 Nov 2023 06:37:50 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 448129F for ; Thu, 23 Nov 2023 03:37:57 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 66FE0C433C7; Thu, 23 Nov 2023 11:37:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1700739476; bh=dfH7JLtcaLOZ5kG93bZ9K1NDFAoPQb3niVTAkrcwM6M=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=O/nHMHVA2T8YyXHLsQiPMBTNfyPVqZEU3c+ddYbEKGySp9U1JL38kfmY8FVar5+TH BoUk8QeM1GlbxOEeCVj/UDEQdYrG2z+v27SVKZqKqXMFhjH7KFShqf5SlnHcY/ZSHf PcQ1b5ZKg/7AFGzBF+5MCSmvxsp9EaOgUyIN9vlvNH74GzUCl2jrA1LltMAhy70rT0 Q3WbjdlWMVTAugc/4S2UKhZkEKDKasuoDm3KThIq0SqSMBWBTSMXtlukkS8lwySK8/ +U7hsj2iP7B0SEin0j0nLKNDcwgTTSgsaO4efB+mUJcsPJCgVyC1J5sTRybku9YHvC GZoQiTFQp+nLg== Date: Thu, 23 Nov 2023 11:37:54 +0000 From: Mark Brown To: Christian Brauner Cc: Szabolcs Nagy , "Rick P. Edgecombe" , Deepak Gupta , "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 , Shuah Khan , linux-kernel@vger.kernel.org, Catalin Marinas , Will Deacon , Kees Cook , jannh@google.com, linux-kselftest@vger.kernel.org, linux-api@vger.kernel.org, David Hildenbrand , nd@arm.com Subject: Re: [PATCH RFT v3 0/5] fork: Support shadow stacks in clone3() Message-ID: References: <20231120-clone3-shadow-stack-v3-0-a7b8ed3e2acc@kernel.org> <20231121-urlaub-motivieren-c9d7ee1a6058@brauner> <20231123-geflattert-mausklick-63d8ebcacffb@brauner> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="Ifsxvz+P4lhF/q6b" Content-Disposition: inline In-Reply-To: <20231123-geflattert-mausklick-63d8ebcacffb@brauner> X-Cookie: Slow day. Practice crawling. X-Spam-Status: No, score=-1.3 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]); Thu, 23 Nov 2023 03:38:08 -0800 (PST) --Ifsxvz+P4lhF/q6b Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Thu, Nov 23, 2023 at 11:10:24AM +0100, Christian Brauner wrote: > On Tue, Nov 21, 2023 at 04:09:40PM +0000, Mark Brown wrote: > > On Tue, Nov 21, 2023 at 12:21:37PM +0000, Szabolcs Nagy wrote: > > > The 11/21/2023 11:17, Christian Brauner wrote: > > > > (2) With what other interfaces is implicit allocation and deallocation > > > > not consistent? I don't understand this argument. The kernel creates > > > > a shadow stack as a security measure to store return addresses. It > > > > seems to me exactly that the kernel should implicitly allocate and > > > > deallocate the shadow stack and not have userspace muck around with > > > > its size? ... > > The inconsistency here is with the management of the standard stack - > > with the standard stack userspace passes an already allocated address > > range to the kernel. A constant tension during review of the shadow > > stack interfaces has been that shadow stack memory is userspace memory > > but the security constraints mean that we've come down on the side of > > having a custom allocation syscall for it instead of using flags on > > mmap() and friends like people often expect, and now having it allocated > > as part of clone3(). The aim is to highlight that this difference is > So you have two interfaces for allocating a shadow stack. The first one > is to explicitly alloc a shadow stack via the map_shadow_stack(). The > second one is an implicit allocation during clone3() and you want to > allow explicitly influencing that. Yes. Shadow stacks are also allocated when the inital call to enable shadow stacks is done, the clone()/clone3() behaviour is to implicitly allocate when a thread is created by a thread that itself has shadow stacks enabled (so we avoid gaps in coverage). > > feature (hence the RFT in the subject line) - Rick Edgecombe did the x86 > > work. The arm64 code is still in review, the userspace interface is > > very similar to that for x86 and there doesn't seem to be any > > controversy there which makes me expect that a change is likely. Unlike > > x86 we only have a spec and virtual implementations at present, there's > > no immintent hardware, so we're taking our time with making sure that > > everything is working well. Deepak Gupta (in CC) has been reviewing the > > series from the point of view of RISC-V. I think we're all fairly well > > aligned on the requirements here. > I'm still not enthusiastic that we only have one implementation for this > in the kernel. What's the harm in waiting until the arm patches are > merged? This shouldn't result in chicken and egg: if the implementations > are sufficiently similar then we can do an appropriate clone3() > extension. The main thing would be that it would mean that people doing userspace enablement based on the merged x86 support can't use the stack size control. It's not the end of the world if that has to wait a bit, it's a bit of a detail thing, but it would make life easier, I guess the userspace people can let us know if it's starting to be a real hassle and we can reevaulate if that happens. It's also currently a dependency for the arm64 code so it'd be good to at least get ageement that assuming nothing comes up in testing the patches can go in along with the arm64 series, removing the dependency and then adding it as an incremental thing would be a hassle. It's likely that the arm64 series will be held out of tree for a while to as more complete userspace support is built up and validated so things might be sitting for a while - we don't have hardware right now so we can be cautious with the testing. --Ifsxvz+P4lhF/q6b Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmVfOZEACgkQJNaLcl1U h9As+gf+Pxhf4DP4/Gc70QKkmbV/StXWUr7/NSbwvfFW4+t5Zwvb/WUg8ny2X2HW aSy4S2PsFjDbFCJqzm5MOCM7N6eTbOE0mtMj2A4SO6F/bms1pcyypX92AdXW9ZCX eEHjaW3XEZZVRuiDW4qyjnr65pdzjdzu4HFqDOpqDIOitEykecpRHsipNOSp1pLm 7dNprMnhBi+XQaBnZD6OGuQFFy7vuQ/7uPSxSZ2YNm3alEj7aIFwDuIef86d2C7S zPGkKy06taKf1tN4lLQDoyev3Lzm+Ho/iPh0b9isQ6g8+v7js/jvcKibVnGViJ/c WU3wuqpTgZ8lZwwlUkAVWYGqrP7LPQ== =KbKk -----END PGP SIGNATURE----- --Ifsxvz+P4lhF/q6b--