From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: from second.openwall.net (second.openwall.net [193.110.157.125]) by inbox.vuxu.org (Postfix) with SMTP id 0B7C92BF5D for ; Wed, 21 Feb 2024 22:13:39 +0100 (CET) Received: (qmail 28071 invoked by uid 550); 21 Feb 2024 21:10:16 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 28043 invoked from network); 21 Feb 2024 21:10:16 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708550005; x=1709154805; darn=lists.openwall.com; 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=oOe8CQ1Fe+hIMHxzKX7XWlTimkc/iuaovpymvDphgj4=; b=b1vgNu+i2NXttsIwX08uYVGNslhGs2Jfk/hQb1Yhh7QwFt93jL32/uYIJ1fBUa8AGE zlW6RXuqq5ocHThxv9uRZP18c1Ekc++Olblxl+09jg8sxdoCrN3kKNm6jtc876MsNToC oS+PlK//3cfpsCYJYDcQbwf5kZ2Kn6pvaGjkDE49oCicksPL06BC5J0mW51nKqRnP2nb H40BZFtnWtZUPuotKIijl1eMazeX0xbl1fXg1EtxGVvUj3MITOCY6EyU5fdcGYsU5ipW pY2Romiaww5aaR4B/3iJg65NpMcRt1hLI1ITg9SGYYgGTi54pz+5IcAM825VC8KaPfWG nxNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708550005; x=1709154805; 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=oOe8CQ1Fe+hIMHxzKX7XWlTimkc/iuaovpymvDphgj4=; b=UYJ7xXCmt16TieJqjbLoq3MDpGkGs7/3a8HSfbUnRRt03ZNfaSz/gu3SMXTZqQHS1I g/qrg3IOVQERJaVca37wpeARIUtQUk9TIjHAfdUZoJA200i5vOv/uPiHCREj3NoobJ3c Jm/SS8ikUWURcCWUoSuVpekrVcxkBaJgNCotqIBF4lVT9FD1rL/MJ94du5auNnj56x/Z mPfBUETk+OKQJuHDdWFB2m3WkcKYiCdYtCxjp1k2I9AgCf0clhy26+MfQIjCUBcwb9Tq 6g6ywKN47Rx/nNM0gtBVpgMryWoVJgc3wFR/lIaDkp63ZRnMSVMmbQVbvoyrUF/JSZ5G 70eA== X-Forwarded-Encrypted: i=1; AJvYcCWk0ysV3xqwjCURMhodjXHo3cO2ZBs4F3otM9ZK8pBxyiLab/kY5WHzCM9AIzjW56wUhK6BzsqtcMRJ4S9AnESHIDx2IDx42Q== X-Gm-Message-State: AOJu0YyKZl8dU1CYlR1bUmUpFhJnpO1aywkUrZRR2J1tMyoAcio2FxnB ic44MYl6nFT5QxFsUW4vag6KB5WfmyBYSXx72ieX6UK85Rky9NnDEEO8wNMudLvd9uXyUSrJY1L ZkcyV5uz2IY3lBngldkQPr792M7k= X-Google-Smtp-Source: AGHT+IGhaBTSHgXe8Ob108OXBWpnIgIuyMFeVcBje1ELrXkN/4PqTmNclSgXiBJchbcFk4tPPGc/HanP+MFeXILDTxM= X-Received: by 2002:a17:90a:d911:b0:299:e9d1:fc52 with SMTP id c17-20020a17090ad91100b00299e9d1fc52mr6242900pjv.0.1708550004870; Wed, 21 Feb 2024 13:13:24 -0800 (PST) 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 13:12:47 -0800 Message-ID: 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 Subject: Re: [musl] Re: [PATCH v8 00/38] arm64/gcs: Provide support for GCS in userspace On Wed, Feb 21, 2024 at 12:25=E2=80=AFPM H.J. Lu wrot= e: > > On Wed, Feb 21, 2024 at 12:18=E2=80=AFPM H.J. Lu wr= ote: > > > > 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 suffic= e. > > > > An interrupted operation using the lock could be arbitrarily delaye= d, > > > > 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 le= ft > > > > in the target register. > > > > > > We can't intercept RDSSP, but it becomes a NOP by default. (disclaime= r > > > 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. H= ow > > > 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. If SHSTK is disabled by kernel, not by glibc, there can be 2 issues: 1. Glibc and kernel may be out of sync on SHSTK. 2. When kernel disables SHSTK, glibc may be in the middle of reading shadow stack in longjmp, searching for a restore token. > > > 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 to= o > > > much. Apps could call dlopen() on a known unsupported DSO before doin= g > > > ROP. I don't know if you have any musl users with specific shadow sta= ck > > > use cases to ask about this. > > > > > > > > -- > > H.J. > > > > -- > H.J. --=20 H.J.