Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp2588540rdb; Wed, 21 Feb 2024 12:26:14 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUUCqfA2bFiWjJHbPzkadDFeY7KXNhzFhvRX414xw8iWKipRDhtPxVtZVa5chBBnuhn3cfGxmYyfk93Ir26+zO47K8QeiB7F9gTg41Ilg== X-Google-Smtp-Source: AGHT+IEiJbYqIJqap5Y6TzcKX3hKR+LBjmyS3ER75awliZjEtWSC/QpiJe5wkcxXnlpDF9MLWd/A X-Received: by 2002:a17:902:6841:b0:1db:28dd:a428 with SMTP id f1-20020a170902684100b001db28dda428mr18031507pln.23.1708547173994; Wed, 21 Feb 2024 12:26:13 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708547173; cv=pass; d=google.com; s=arc-20160816; b=UDvRpCp6lSXUZNyaymD08BF9rNTwWhwocKMnu6KYC1X8sIWZbRr2xrDaunYiIFIQg8 2VvfqMAcnEWr87wuCZR2Jytga1vYTMeroe2DD4bO58SJL8XvC9czKe20WaHy0jKGauDc f08Yr0ZujPLj1qr/ZoUDEzZ2CAC5aUg1nUno8HF00dMQRk2bNtIbLFDLG6cgzSCu3FP7 IdhTD0J1vUtwfQrTNVwmKsYbmc7b4qX3M2lS0unwn/xnWwludPGFoqHo+q4nD6LIpbCY bZWxGWe1XhlzWdGwhf0NvmMA+zPPk3MfwMw/bhxE820Cl8Vy4D44GL0qItBVDz9CVrA2 p7yA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=KUZZ04EW9/qUv3qL29C/Oq6T36PR4Q6EbgcYZzQ1nWg=; fh=Hlxvs1Vq/90pVpJU3d6gGvQeCoBSWspx5rQkQWb86RQ=; b=Re6x+wnibTVGPeSvdtoiI1FtApVA0SzlGMeVWRXrDKczg6m59z0RaQTI3Of4kYrNzo mf6sMw0U7cRnvoP6pwo9PtR5PbdcFaNw+vZluR97zMwUrWJCSV4zvl8833GI7M7DacfW vFfwc02mYbRmyKgUGvjM4kPuSm1PYxb90S1EZI/T16s+InUgM/Dak80j86HuNnlkks/y ZYTohtZ3bOTTK2vwp76GxITxeZberGbVh7dramsfthX5dcLhSCIQwZLmQrZsrbJJ9PHr 6PFO4QaOfx7abVHf7CZn5DfLKzKP9TKoEE4Xma7fK93L9ZsPG2BBm5GHc+/aS34Celj7 qypg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=CXJvB53F; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-75458-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75458-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id e10-20020a170902cf4a00b001dbfefe66fbsi5630248plg.591.2024.02.21.12.26.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 12:26:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-75458-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=CXJvB53F; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-75458-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75458-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com 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 A6A5B28667A for ; Wed, 21 Feb 2024 20:25:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5C1CC86AFC; Wed, 21 Feb 2024 20:25:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="CXJvB53F" Received: from mail-yb1-f178.google.com (mail-yb1-f178.google.com [209.85.219.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9A63A85958; Wed, 21 Feb 2024 20:25:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.178 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708547145; cv=none; b=CK9hIprvKLoxuh/ciZlvw/bskDc71VqBCVABOguiAQZOxD6kfuYF82RTTW2SXtFxz15YXWA+xSuVUoAdpgh+5P+e8ETLpiRdaBQbKZwaBiWfZ1kAynslmz3EERw3bX9dQ/6a3sBt9QeEq3Ze2PrHXTYCuQnxwT3YuihtIvWRyk4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708547145; c=relaxed/simple; bh=ctqglnnCAjYhrU7DgoFcCYpe21K+LqH9msD+JxCEk8I=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=G1fB5bGYpKLnQURZ9fqXLszzzd4WZpv2Z21mWVqfCELa/XF5Dd8X0BidG1y7OJk2Q3ezKzZOvEmVp+tTzjZyDAjWB8n6Vu52F1RCDhXSO/kg0ak+iwUpy5u1dwu43wMCsOwq4AQ+Rfgtoq9NX6AAkgUXBadVHq/c853RdhFLgCw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=CXJvB53F; arc=none smtp.client-ip=209.85.219.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-yb1-f178.google.com with SMTP id 3f1490d57ef6-dcc7cdb3a98so7347067276.2; Wed, 21 Feb 2024 12:25:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708547142; x=1709151942; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=KUZZ04EW9/qUv3qL29C/Oq6T36PR4Q6EbgcYZzQ1nWg=; b=CXJvB53FdF2inK8jk9wO2zptQSqDu+Zxhe3+4/pIN1AY7sFtJ1Pk8QAcId214t79od HF+YAY2kLt26GZ/8tKP3vXlxmb2rWXpKTqVCGxuQx3BmK4S0da2XtlQa2oGddEA6vo+A XmXXIm7yaLBlIAGgJfjaCU9cwdgehlCTAeoUkTDDr6i4CANDXjFLzjaJqMfjjFjuZrgg 6EMbYDF/pacSNmj7Uhc43mlc8RytVfwmye/sGndpiZSzXPoz9jOiKe376nVyEfBycMKB u7DhtFsJYxZ/wPEQlcSQ2DxTc6Ze7c6e5I6hFy3j9wvKFA4Qvb3BHC1EM6Qny0aKeanD ofVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708547142; x=1709151942; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=KUZZ04EW9/qUv3qL29C/Oq6T36PR4Q6EbgcYZzQ1nWg=; b=ZYiLcqP8Eh0plARBI8zkjPWq0/X1WQt42I6TyRfIrMFl+2uYXWfC0f1JBqRU/SdCAY Z12470ai2RvrzCRRvn1WXQgQfMPTmYWxymhidwd6V4YrDDg46ImKk3UQIhOu/tLwft4s sPoDjj0GBcULLxt11p8JO8xsit+DfLymBE8XF7wP3C6bcb29JiSDWz5zI0FQvuB4zVTw vLUqw34XxSe+9H6Hk7o+mlGoqEdeAbKT6AWC7PeBnIw816PNIRKW3LLWnuJtsBrS3ilj 2dzWC0P0wmqzNHBDkOQJnrIuv2tqVzGWt318yWhblVaSOy3c9+h4Izla94pdCLeWSG8Z vnYg== X-Forwarded-Encrypted: i=1; AJvYcCXOuIpvE5g86kH2IFKZlvjQRNuQVtImbh+wE2dAhAOv4fghoIpfInBQztIA0lokalOS6dlEcN2CadVsayad998XjAlMk3Yzxla/qO+baw1LznXjttK6LCjBYEX+WuINQVbYGYFS6M8WNLhrh6Vq8urSZNDwgOewMYxLTEKgxlrwcX4TN/EfPponbzxJMXMPG/PDgyEc8jdpLPAhc0L+wytkvAqq06xF5BNLYltCBugdatoGWVvM8+YgUc8zH5xobjaJLbw= X-Gm-Message-State: AOJu0YzV1y/KGW6NlgEMnz0XxfOsWrfh3Tc06CFG3revtGvcBPbvhw8W LBqoCzdcD6a/jQKEpb/MjXlWog1lUpu6q55jIhZvPpPPjKnkOmvc5ddMGG+ZgsvuG4bhb5dIVwG PNmiCCraExD+nhPcha9qpXT490QU= X-Received: by 2002:a25:1f8b:0:b0:dc7:46ef:8b9e with SMTP id f133-20020a251f8b000000b00dc746ef8b9emr389206ybf.29.1708547142617; Wed, 21 Feb 2024 12:25:42 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <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> <20240221183055.GT4163@brightrain.aerifal.cx> <20240221190639.GU4163@brightrain.aerifal.cx> In-Reply-To: From: "H.J. Lu" Date: Wed, 21 Feb 2024 12:25:06 -0800 Message-ID: Subject: Re: [musl] Re: [PATCH v8 00/38] arm64/gcs: Provide support for GCS in userspace To: "Edgecombe, Rick P" Cc: "dalias@libc.org" , "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" , "broonie@kernel.org" , "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" , "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" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, Feb 21, 2024 at 12:18=E2=80=AFPM H.J. Lu wrot= e: > > On Wed, Feb 21, 2024 at 11:22=E2=80=AFAM Edgecombe, Rick P > wrote: > > > > On Wed, 2024-02-21 at 14:06 -0500, dalias@libc.org wrote: > > > Due to arbitrarily nestable signal frames, no, this does not suffice. > > > An interrupted operation using the lock could be arbitrarily delayed, > > > even never execute again, making any call to dlopen deadlock. > > > > Doh! Yep, it is not robust to this. The only thing that could be done > > would be a timeout in dlopen(). Which would make the whole thing just > > better than nothing. > > > > > > > > > > > > > > > It's fine to turn RDSSP into an actual emulated read of the SSP, or > > > at > > > least an emulated load of zero so that uninitialized data is not left > > > in the target register. > > > > We can't intercept RDSSP, but it becomes a NOP by default. (disclaimer > > x86-only knowledge). > > > > > If doing the latter, code working with the > > > shadow stack just needs to be prepared for the possibility that it > > > could be async-disabled, and check the return value. > > > > > > I have not looked at all the instructions that become #UD but I > > > suspect they all have reasonable trivial ways to implement a > > > "disabled" version of them that userspace can act upon reasonably. > > > > This would have to be thought through functionally and performance > > wise. I'm not opposed if can come up with a fully fleshed out plan. How > > serious are you in pursuing musl support, if we had something like > > this? > > > > HJ, any thoughts on whether glibc would use this as well? > > Assuming that we are talking about permissive mode, if kernel can > suppress UD, we don't need to disable SHSTK. Glibc can enable > ARCH_SHSTK_SUPPRESS_UD instead. Kernel must suppress all possible SHSTK UDs. > > It is probably worth mentioning that from the security side (as Mark > > mentioned there is always tension in the tradeoffs on these features), > > permissive mode is seen by some as something that weakens security too > > much. Apps could call dlopen() on a known unsupported DSO before doing > > ROP. I don't know if you have any musl users with specific shadow stack > > use cases to ask about this. > > > > -- > H.J. --=20 H.J.