Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp376933rdb; Tue, 5 Dec 2023 07:51:44 -0800 (PST) X-Google-Smtp-Source: AGHT+IEgQ7czN4fc4GA8J1ZNheAYjaSfk3MnvnjbulXkdlqYV7rojiw1dP+NFbI7AKQcxVWhCmjb X-Received: by 2002:a5e:8a47:0:b0:7b4:5806:7526 with SMTP id o7-20020a5e8a47000000b007b458067526mr2245285iom.35.1701791503686; Tue, 05 Dec 2023 07:51:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701791503; cv=none; d=google.com; s=arc-20160816; b=QEs8Bop68hqdKBGVMAO2NrtHSPVePW/LbmFZgY3/E9Yu6GA4DjF/VPn1LzV09paamk ySV/VJMzAX7+QAZfS9GVHEdlUctmw1iGDd/4G1BPeCim9hvSv7uIDW+yd8CIMMAUxKUx 5BFet/528NYVxTyYiIu41d3l/ZY2liHG4xGtmVnJTPBS3SKxUMprHO2itfbdJlhlHNSI bKEUJse96xFPdrHgUNNO5PVKVwMutgI0IQyTaXSX5rGuNxEVPkH4gwZZVzBdaWfboMea 8VOo6kVSq5VfdRdSlLvoPI62y7vmhdJIj7ZzW+0CJkKBtuu5ZsV8o2Y7Ia6W3/CG6rb1 FZpg== 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=lyFBGF6vUpimrx4h6hHN/bmQ21964N+AHXDegOPx7zg=; fh=wxIW/wLWPpVspSZM507TUj48YeKu+U+R0TkO2JXe0es=; b=agvWMFL+xo/xwysRO3LwuuIYNmqadRRTbDdMCyqoWA69jBTTjlewIU5/OBaTJ7X8qj eRMRQCwtNCwOgmkLtHKJHMhnRS5SsVoT8enyIIGPngxBVIjbl88Kf5WsAaub0cQ659AI RFwxKZn9NzVYT7TeAnICy+Nt3Pc253+GH6h8uEl2RGGju4Dk8i5UA9VMhO+bMPLygjo3 jOIMCJgCi4dvciyBCtY7eHhlCXykovDL3IvnUedRcwwaO817m+q63gH4OCY+nba9EOtz QSKQKeW0wBRbu9/ITVJVuyMHfvSu3RtSRrUvtf1/IqpK7TqTJW6dsut3fUrLVQ0tK9Gn b1SQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=RGyeU7Qv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 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 morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id p17-20020a056602305100b007b6d2bfec45si240807ioy.128.2023.12.05.07.51.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Dec 2023 07:51:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=RGyeU7Qv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 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 morse.vger.email (Postfix) with ESMTP id 623A7815C20C; Tue, 5 Dec 2023 07:51:41 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1442494AbjLEPv1 (ORCPT + 99 others); Tue, 5 Dec 2023 10:51:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55022 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1442609AbjLEPvW (ORCPT ); Tue, 5 Dec 2023 10:51:22 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8162B1AB for ; Tue, 5 Dec 2023 07:51:28 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6DF6DC433CA; Tue, 5 Dec 2023 15:51:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1701791488; bh=cRtFwqVwGM/L5ElETR7/boeZZkQBM/dk1tSxRXa+SjE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=RGyeU7QvMB9+MJb48ISbSvf4giVhpNA1dzt2x0ApFyux9D1hNyJs59V5235TZ2GG4 YmmscdTAvjHB2f/Dzabq6WldhzjojX/lu0bKk4lcksWKzdLuGoTrT7fvHU9LKRoqKD S6fN3oMu6fGnXMPU4L/vZ6F9j9IuH35Qz5dhWGCkgVvbhBxiXlzpMFRGcGhkI0e2WY ZE++rhJDKQDduO5iCBtpGGCA7cUvKwqeWnAIZbSrOqwWlHJRndZ6IL6Q7Lsq2ZPYiE JTczBH9TsKFE66ZbfxdXRr6dqYK61eoQAS9hDwYl5X2RGRoSpJ3NNZMHrCdoArncrG 56cJ50OFSADtw== Date: Tue, 5 Dec 2023 15:51:19 +0000 From: Mark Brown To: "Edgecombe, Rick P" Cc: "dietmar.eggemann@arm.com" , "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" , "mingo@redhat.com" , "rostedt@goodmis.org" , "hjl.tools@gmail.com" , "tglx@linutronix.de" , "vschneid@redhat.com" , "shuah@kernel.org" , "bristot@redhat.com" , "hpa@zytor.com" , "peterz@infradead.org" , "bp@alien8.de" , "bsegall@google.com" , "x86@kernel.org" , "juri.lelli@redhat.com" , "keescook@chromium.org" , "jannh@google.com" , "linux-kselftest@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "catalin.marinas@arm.com" , "linux-api@vger.kernel.org" , "will@kernel.org" Subject: Re: [PATCH RFT v4 2/5] fork: Add shadow stack support to clone3() Message-ID: References: <20231128-clone3-shadow-stack-v4-0-8b28ffe4f676@kernel.org> <20231128-clone3-shadow-stack-v4-2-8b28ffe4f676@kernel.org> <61f80d032c6a630dd641c9b598b37c2eb40d51e8.camel@intel.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="ofW00QD6kVu0wbQR" Content-Disposition: inline In-Reply-To: <61f80d032c6a630dd641c9b598b37c2eb40d51e8.camel@intel.com> X-Cookie: I've Been Moved! 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 morse.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 (morse.vger.email [0.0.0.0]); Tue, 05 Dec 2023 07:51:41 -0800 (PST) --ofW00QD6kVu0wbQR Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Dec 05, 2023 at 12:26:57AM +0000, Edgecombe, Rick P wrote: > On Tue, 2023-11-28 at 18:22 +0000, Mark Brown wrote: > > -=A0=A0=A0=A0=A0=A0=A0size =3D adjust_shstk_size(stack_size); > > +=A0=A0=A0=A0=A0=A0=A0size =3D adjust_shstk_size(size); > > =A0=A0=A0=A0=A0=A0=A0=A0addr =3D alloc_shstk(0, size, 0, false); > Hmm. I didn't test this, but in the copy_process(), copy_mm() happens > before this point. So the shadow stack would get mapped in current's MM > (i.e. the parent). So in the !CLONE_VM case with shadow_stack_size!=3D0 > the SSP in the child will be updated to an area that is not mapped in > the child. I think we need to pass tsk->mm into alloc_shstk(). But such > an exotic clone usage does give me pause, regarding whether all of this > is premature. Hrm, right. And we then can't use do_mmap() either. I'd be somewhat tempted to disallow that specific case for now rather than deal with it though that's not really in the spirit of just always following what the user asked for. --ofW00QD6kVu0wbQR Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmVvRvYACgkQJNaLcl1U h9DXGQf6AvheyqUPcMw3T4JTt1lwn5bDs4oC7fZ63uO+BX16gGSEx73amHIyNaGv p+FtTHrVU1xQTu+Bh5L5QjW68t6061HLlHW0E+RoX9HlyW4v6GsBwzHxAYfp1eNw zce0c49OZQlgDA42/CH/PbejjX8H1a3jlwW+zIxwHNDqWs8pe+pEaZ/jEhLLUQ1W vJGRdn/PtZRKo7APLWn3uTOUGUbI9hXU/XQvJwKEo3DvNbYkezmTGe8ExIBkWQV3 5oecmztnkjUiARHVRvyxW3vjbljlNxG4ECGlrpchrZgpeanmraDINzcWNnwYIBHE lP5fF9Y4DIiSj/DAO0BKEO0x5wgfCw== =1erK -----END PGP SIGNATURE----- --ofW00QD6kVu0wbQR--