Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp2371403rdb; Wed, 21 Feb 2024 05:53:53 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUFlj6xbIEetbCXCXmbU24cLifQYB6Cc2gQp30v8pO3T2sBA5y8yqI589ycD5Zn8ih+C6ILSQ/EkrKEmVP3OnoqN4xZ9HFceEoaBvJ60w== X-Google-Smtp-Source: AGHT+IF3wa9TQdWcCZ1/hjDyj17FkxqOvwKjQv5MuViDDvrLubR0R9dTTTNFSr0jZJa86DQ7ySea X-Received: by 2002:a17:906:aac5:b0:a3e:cb4a:6e71 with SMTP id kt5-20020a170906aac500b00a3ecb4a6e71mr6928049ejb.18.1708523633460; Wed, 21 Feb 2024 05:53:53 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708523633; cv=pass; d=google.com; s=arc-20160816; b=bT9TbpFJBaVkVL9KTSk87m1qwKs5WZ3aZJ2cT79HwbRELiKNLV44YJpRL57HT2NY1a Jgqspy+JzihQvzb3F1CRz//6cGS/f1q6zyaVYUvPbBUtzEv2JYgHGNAgP7Abs2dLxTm4 OSPFsStyIn58NYrdxa2ucTlxbx2POjV3KVmMurws7tabCxf5zkC+B6+3Vk++/0kcLmpv sFX8K2Br/v6Jv/P7A0nienv8VKFdL8b+qxSr3b6PZVbOzCDtzf3ccZkwpASJ7Xr3gtpO vugc6V7d650Jl3KXEogQedYXhhusgDhZzUuMzF1UhqF1ecadk69SjF1rsQQkr1I4eRAw JTbQ== 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=ZWBbb7BbTz0vjEY+xqZa4IIgHLdSWLXI9GwGSGp2If0=; fh=bK2TNWI1JdrPPde3YQZQXeUk6vxxXnhujJyiMpPsIY4=; b=Di+6pF7FchKFecpnZrmd4I0Mq5q5d+q/FJYu5f5rWkdfmI7tjbO4eWkhNSJzGC3sd+ AE3OQCbcIa1WnQ5TWoVs55pxapquYnVEAQMstgr3FoQEqsVyU+gvix5TWQblsX8XB5jz Sg8qGfS3K+cf5u11TH8FnU4FxH/T0gTwo38Pr27H9iZsAh5ApBHUqnTKasI4P6ligir+ EZKOZA/Lw1P0IJBvcaVddudr5xVH1ZczOi1nPzanQaKmDROog390PxCT1iA2l+wWVnpA DsaSwRHgqyUOL0RgodtymbzDNSx0Nww4921z29Ytbuvyp2YiCg4ROsYHXnCoh5h++0wk AM0w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=XYWFYY21; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-74829-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-74829-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id qw17-20020a1709066a1100b00a3ec245bc6dsi2491892ejc.620.2024.02.21.05.53.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 05:53:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-74829-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=XYWFYY21; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-74829-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-74829-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 142871F22404 for ; Wed, 21 Feb 2024 13:53:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6FDC57D417; Wed, 21 Feb 2024 13:53:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="XYWFYY21" 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 6532676C99; Wed, 21 Feb 2024 13:53:20 +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=1708523600; cv=none; b=mv8H7iIi5f50H62oEtHw1Izhf5rR7mCA0fXRd6YmDPVEIa/+9lqyZx7SOyOXiQzhNSdp5yn2VG0YmH0vOJ+dbj5U1wifqTyKLiI6DW0NTVjZecbYjUine0sFmx5AYUZ0OQK0s0h0ptLkG6tMIPjXipXDzsJFDNyRb1BuMhnWCRY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708523600; c=relaxed/simple; bh=2qDB6aCchFqvsRrIZrlOnBUWRusFLsK6a7t86lO4/kc=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=myu69FE7P+NnX/+X6Qtt7TxnZjPsU1wcAz28khjxoE0gcTRqTiE51tjsPQbh6YrXQR/b6OYitj6wX1XlKBVf88Vfc2gXXh2pj2BXzjphcj6venRC0FFyyMU+PU9FO1voszbr5LL2dZ7x849d9+oJjdHKKXkdPpqAXUb4c7NTL1M= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=XYWFYY21; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6E8B9C433F1; Wed, 21 Feb 2024 13:53:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708523600; bh=2qDB6aCchFqvsRrIZrlOnBUWRusFLsK6a7t86lO4/kc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=XYWFYY21ChMcDnqRafHBvRB0QxejjlT/bZHLI49dgPa5dRacaD3UN0LLMesLDhEVK FQALDj09HDwKPE6W4jj/Eh1jqbUH+H+QnFzr8lEIlZA/imkC3dRk/JOQvq/V/1qmnf AKtPOLPebGuFFRe5xPIXDbSmUtlL944IsVvIA7rGpLNSg/1AcaSk659q46C8HRHywn bhl8FLesEaZJjbv9GARHL60svpyiaFNTpyRdOuK9i5QgdctkDvVHFN/fMwhmSVZRSB /NtzQjotaqwXeqdsZ0ePVwa6GV0m+bjLd5HQ/Rwg6sMIIZRNIfrgzJfc4uR31QEOgk nbyq6X4Uq/GjQ== Date: Wed, 21 Feb 2024 13:53:10 +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: <20240203-arm64-gcs-v8-0-c9fec77673ef@kernel.org> <22a53b78-10d7-4a5a-a01e-b2f3a8c22e94@app.fastmail.com> <4c7bdf8fde9cc45174f10b9221fa58ffb450b755.camel@intel.com> <20240220185714.GO4163@brightrain.aerifal.cx> <9fc9c45ff6e14df80ad023e66ff7a978bd4ec91c.camel@intel.com> <20240220235415.GP4163@brightrain.aerifal.cx> <20240221012736.GQ4163@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="cNQgfjDz+IAKI+aZ" Content-Disposition: inline In-Reply-To: <20240221012736.GQ4163@brightrain.aerifal.cx> X-Cookie: The second best policy is dishonesty. --cNQgfjDz+IAKI+aZ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Tue, Feb 20, 2024 at 08:27:37PM -0500, dalias@libc.org wrote: > On Wed, Feb 21, 2024 at 12:35:48AM +0000, Edgecombe, Rick P wrote: > > (INCSSP, RSTORSSP, etc). These are a collection of instructions that > > allow limited control of the SSP. When shadow stack gets disabled, > > these suddenly turn into #UD generating instructions. So any other > > threads executing those instructions when shadow stack got disabled > > would be in for a nasty surprise. > This is the kernel's problem if that's happening. It should be > trapping these and returning immediately like a NOP if shadow stack > has been disabled, not generating SIGILL. I'm not sure that's going to work out well, all it takes is some code that's looking at the shadow stack and expecting something to happen as a result of the instructions it's executing and we run into trouble. A lot of things won't notice and will just happily carry on but I expect there are going to be things that care. We also end up with an additional state for threads that have had shadow stacks transparently disabled, that's managable but still. > > > The place where it's really needed to be able to allocate the shadow > > > stack synchronously under userspace control, in order to harden > > > normal > > > applications that aren't doing funny things, is in pthread_create > > > without a caller-provided stack. > > Yea most apps don't do anything too tricky. Mostly shadow stack "just > > works". But it's no excuse to just crash for the others. > One thing to note here is that, to enable this, we're going to need > some way to detect "new enough kernel that shadow stack semantics are > all right". If there are kernels that have shadow stack support but > with problems that make it unsafe to use (this sounds like the case), > we can't turn it on without a way to avoid trying to use it on those. If we have this automatic conversion of pages to shadow stack then we should have an API for enabling it, userspace should be able to use the presence of that API to determine if the feature is there. --cNQgfjDz+IAKI+aZ Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmXWAEUACgkQJNaLcl1U h9BTcAf+MujJo/pNOGU2neBJWmbVKrnAz60+j+uAD98t6m1YXtFChsz+YR6gQOA1 7FEah97yBTtTiSGpgeKnKCJZMVaWEYHF0Oal7bU/cO0uO6DshP7BIWygF/xyL6/r AiFhQ5IAhgRYlGKzShiXTP3rx7ITjIS/1ejalkQ4vHwCOA/N0rsnZwJadUytQjJv bHJxu0pC95Sb9lZG3yrrOqZJdljkMsnb7ThBwPRENX0XmGz/Y8l0/FjQwiyWc+Bv i4HuekjDwxdxIknpEI/kciFlk8gjthTCrAloZNN/PGNExBEppzAMUg44bTcUkuuu CReIkIoN/x1s3gztzAkcLF2nu1EF6w== =wfib -----END PGP SIGNATURE----- --cNQgfjDz+IAKI+aZ--