Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp2536362rdb; Wed, 21 Feb 2024 10:32:42 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUUTL/Zgu8SVWb91mQiWf6UN2WL9JgQ9iuarKN5uCDGKI1jO3Kvv+x1BgPPD2/UoTrN/2MFT50mr0BGBRzXTQ4lBCBJyQMyOuXFvK3GcA== X-Google-Smtp-Source: AGHT+IG70NxHVThhZqOFuYWWeyHnPpWW4+FCF+/v5BATLYrrNpzmhoA/Pchgsk76DQiVquj7Eo7G X-Received: by 2002:a17:903:24c:b0:1d4:cd4d:923b with SMTP id j12-20020a170903024c00b001d4cd4d923bmr23056069plh.54.1708540361937; Wed, 21 Feb 2024 10:32:41 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708540361; cv=pass; d=google.com; s=arc-20160816; b=t+zLe+FRVr35HoBv4YUAsrDqqQZhfo3GxYfoVncIwMxiL/SUh5nEWxLszQsYInwNki GRowpSAcOB3GqLaEzgkYiEh3FJeBNk0pLfMZeGxa4pLW6p6N8qk+aPydtUkwSeQ3qNck 1hmzSbReKG5rWh8GC8KcVN6Um2bGZRoWtNJV7IXytIbXbktmVj2U3LZ/6/u5+X77dpDv tX7WbvulmwkO+cawRrqtwy/LgYjN/vyjkzcV8f2hiNvgoy6dxgiU4XxNkBSeygvpLW7R WAzMxNUFEdkjLJidBwXYOmPbTdKO//QYlEYiVL469qQNfR9OaaxVkfYOKRXqSSqucGM5 kHKw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=eroNIRyHkPWDxUtEH98ZLw13+2pQUaouULYrnPNuNus=; fh=bK2TNWI1JdrPPde3YQZQXeUk6vxxXnhujJyiMpPsIY4=; b=d1tC3OKfGtIE0jHgYsz6Ah3P1HNk3HBHPznn6vAKWld6C7ZvZJ95MrtBpa85RVUS+S IyUpI2s9C3vyh9kyoym11a0iAvUeZyQQcLIMeiqzsonyYTPv8fTiteNGix5MSVVqwf1I S8gjfd53CRJFjXr966BACO0VTnJAomeccPr6pZA3voaeyS4IsY4HR4HAO2FmLIpYR8hO ba9jDmwPp5oipatqvXzwX8T/L28mAYHitDWrzZu9QXAguxuB/Y13zsaqVRUqo3Z0hzFt DfOpHQeM6F9HDGm8nY2AZQeDXpG+jTXxwVkXH++7rcRQMwV/EbadrLgMaYsk0somyf0P C9Sg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=H40tZsSH; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-75298-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75298-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id ma16-20020a170903095000b001dc0d1fd943si4563114plb.212.2024.02.21.10.32.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 10:32:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-75298-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=H40tZsSH; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-75298-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75298-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 53911284E02 for ; Wed, 21 Feb 2024 18:32:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9247485642; Wed, 21 Feb 2024 18:32:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="H40tZsSH" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9299A3C068; Wed, 21 Feb 2024 18:32:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708540350; cv=none; b=LZqybXkjD+104g3RnB6QTELKU0iQN/ePqk9kSvCyhk/B6lKZMpphQZvaVLKjBkswq9TviTQhwxQN7FYLaajCDRzJgI61iw0YG38AEcrbVMkhI4THcNGUkX2rQ/gQLSe/jPf8VF8sM0KyHJ27XZKlvniP9zypmOa0UBD1+EBFfeU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708540350; c=relaxed/simple; bh=2gbTzpi4a1N3obFiGlpwydsY4IO9OTAD9wjD4yTOHtU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=reh+Nck48pMPe7KXPwwFeLleWx6VIlDjJCJDZuR+MaYpXWZZOQvB6V2MbW0GNPT3TrCyJHjD2EHfV7QYKtlGjWEZUP9Iieyggw65ujFGKzzEa92YuUlut78hJy3qkCD6n9ZzfibWoeBO8ONJd58K/1jwETO1BTC9fHR6HHtbl+U= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=H40tZsSH; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 761A0C433C7; Wed, 21 Feb 2024 18:32:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708540350; bh=2gbTzpi4a1N3obFiGlpwydsY4IO9OTAD9wjD4yTOHtU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=H40tZsSHO3GGXtYAAc+MX1H9hfXkqwzWeiS1DXzFw/AxJv57LXIcw9mhK5Su5mCC9 i7wBl/5lZkXR64n/gvb9Qu6kwvmY4KSzCfoDfdOA/0HOVJOyFi99fo5AUrZzfMf21M H5ZfGf4y6MVG3cjBzbpNByDEsfiX1Nhpk3W13pSfKx1vxCizFYAPrtIdE1dQdlHFoa M62tazglgeiMA/9SJ7abPRLFww+GYA8BdkndbbknsJBZotawG1kAYGbU/63Fwwwo5S qZIBiA4tp0C5/RmatwR1pY7XKkdWRv+L3TpkPOGgYU7whHYd38xXjaXnKyLaZVOEPA F+OljWdJ5xjYA== Date: Wed, 21 Feb 2024 18:32:20 +0000 From: Mark Brown To: "dalias@libc.org" Cc: "Edgecombe, Rick P" , "linux-arch@vger.kernel.org" , "suzuki.poulose@arm.com" , "Szabolcs.Nagy@arm.com" , "musl@lists.openwall.com" , "linux-fsdevel@vger.kernel.org" , "linux-riscv@lists.infradead.org" , "kvmarm@lists.linux.dev" , "corbet@lwn.net" , "linux-kernel@vger.kernel.org" , "catalin.marinas@arm.com" , "oliver.upton@linux.dev" , "palmer@dabbelt.com" , "debug@rivosinc.com" , "aou@eecs.berkeley.edu" , "shuah@kernel.org" , "arnd@arndb.de" , "maz@kernel.org" , "oleg@redhat.com" , "fweimer@redhat.com" , "keescook@chromium.org" , "james.morse@arm.com" , "ebiederm@xmission.com" , "will@kernel.org" , "brauner@kernel.org" , "hjl.tools@gmail.com" , "linux-kselftest@vger.kernel.org" , "paul.walmsley@sifive.com" , "ardb@kernel.org" , "linux-arm-kernel@lists.infradead.org" , "linux-mm@kvack.org" , "thiago.bauermann@linaro.org" , "akpm@linux-foundation.org" , "sorear@fastmail.com" , "linux-doc@vger.kernel.org" Subject: Re: [musl] Re: [PATCH v8 00/38] arm64/gcs: Provide support for GCS in userspace Message-ID: References: <4c7bdf8fde9cc45174f10b9221fa58ffb450b755.camel@intel.com> <20240220185714.GO4163@brightrain.aerifal.cx> <9fc9c45ff6e14df80ad023e66ff7a978bd4ec91c.camel@intel.com> <20240220235415.GP4163@brightrain.aerifal.cx> <20240221012736.GQ4163@brightrain.aerifal.cx> <20240221145800.GR4163@brightrain.aerifal.cx> <4a3809e8-61b2-4341-a868-292ba6e64e8a@sirena.org.uk> <20240221175717.GS4163@brightrain.aerifal.cx> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="aNn12J2DOa91OM79" Content-Disposition: inline In-Reply-To: <20240221175717.GS4163@brightrain.aerifal.cx> X-Cookie: The second best policy is dishonesty. --aNn12J2DOa91OM79 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Wed, Feb 21, 2024 at 12:57:19PM -0500, dalias@libc.org wrote: > On Wed, Feb 21, 2024 at 05:36:12PM +0000, Mark Brown wrote: > > This feels like it's getting complicated and I fear it may be an uphill > > struggle to get such code merged, at least for arm64. My instinct is > > that it's going to be much more robust and generally tractable to let > > things run to some suitable synchronisation point and then disable > > there, but if we're going to do that then userspace can hopefully > > arrange to do the disabling itself through the standard disable > > interface anyway. Presumably it'll want to notice things being disabled > > at some point anyway? TBH that's been how all the prior proposals for > > process wide disable I've seen were done. > If it's possible to disable per-thread rather than per-process, some > things are easier. Disabling on account of using alt stacks only needs Both x86 and arm64 currently track shadow stack enablement per thread, not per process, so it's not just possible to do per thread it's the only thing we're currently implementing. I think the same is true for RISC-V but I didn't look as closely at that yet. > to be done on the threads using those stacks. However, for dlopen > purposes you need a way to disable shadow stack for the whole process. > Initially this is only needed for the thread that called dlopen, but > it needs to have propagated to any thread that synchronizes with > completion of the call to dlopen by the time that synchronization > occurs, and since that synchronization can happen in lots of different > ways that are purely userspace (thanks to futexes being userspace in > the uncontended case), I don't see any way to make it work without > extremely invasive, high-cost checks. Yeah, it's not particularly nice - any whole process disable is going to have some nasty cases I think. Rick's message about covered AFAIR the discussion, there were also some proposals for more limited userspaces I think. > If folks on the kernel side are not going to be amenable to doing the > things that are easy for the kernel to make it work without breaking > compatibility with existing interfaces, but that are impossible or > near-impossible for userspace to do, this seems like a dead-end. And I > suspect an operation to "disable shadow stack, but without making > threads still in SS-critical sections crash" is going to be > necessary.. Could you be more specific as to the easy things that you're referencing here? --aNn12J2DOa91OM79 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmXWQbMACgkQJNaLcl1U h9DFYgf/eUQGsS5iljaIOTVjUeRJr5sdmobctbHRbzZDrRfndMq/8GGcuj4IwRdx QH2JWncI0dBc3SdIsUCDuiT5M80YdW0MbbyF0WnodznOGFFOmAdShPrpJOYpq0PJ uxQlFwIl/RPfqC9VKTRflsuttBL5yWgTCWiM0qX0TSs8CSSzLHZJZGy0EB0BLJUj aWIcOnrEMi/h7VJY3PdqDd048xQMlVz9u3igr9rRr0yInyVXgkBu5W+9ORlWZ9Tc CDbo/yL8Wjz0PdEVRaoPUQqpVVfY01V/Ka3X3aX1b3VJBEkvcOCjncbp4epk3z9e ZahyLth4XwKs8PXzuwjgpHYnESAYJg== =//LR -----END PGP SIGNATURE----- --aNn12J2DOa91OM79--