From 74bd582aa49d7c2df08afa48c9580e6f2c4258f7 Mon Sep 17 00:00:00 2001 From: Christoph Reiter Date: Tue, 3 Jun 2025 10:30:37 +0200 Subject: [PATCH] msys2-runtime: Update to 3.6.2 (#5434) --- ...ieve-AzureAD-users-information-again.patch | 73 +++++++++++++++++++ msys2-runtime/PKGBUILD | 13 ++-- msys2-runtime/msys2-runtime.commit | 2 +- 3 files changed, 82 insertions(+), 6 deletions(-) create mode 100644 msys2-runtime/0040-Cygwin-do-retrieve-AzureAD-users-information-again.patch diff --git a/msys2-runtime/0040-Cygwin-do-retrieve-AzureAD-users-information-again.patch b/msys2-runtime/0040-Cygwin-do-retrieve-AzureAD-users-information-again.patch new file mode 100644 index 00000000..f4598c5d --- /dev/null +++ b/msys2-runtime/0040-Cygwin-do-retrieve-AzureAD-users-information-again.patch @@ -0,0 +1,73 @@ +From a9cfe9f52b91f0a6a3b14477b0c35f8f2ab8db3a Mon Sep 17 00:00:00 2001 +From: Johannes Schindelin +Date: Tue, 3 Jun 2025 08:53:57 +0200 +Subject: [PATCH 40/N] Cygwin: do retrieve AzureAD users' information again + +In 48e7d63268 (Cygwin: fetch_account_from_windows: skip LookupAccountSid +for SIDs known to fail, 2025-04-10), several SIDs acquired a shortcut +where a potentially expensive `LookupAccountSid()` call is avoided for +SIDs that "cannot be resolved". + +However, as reported by Robert Fensterman (and independently discovered +by myself), some of the SIDs that received this special shortcut _do_ +get resolved by `LookupAccountSid()` calls: AzureAD users' SIDs. + +With those SIDs, that newly-introduced shortcut actually does more harm +than good because there is no other way to retrieve the desired +information, resulting in permission problems. + +One symptom of this is that `mintty` can no longer access `/dev/ptmx` +and simply errors out with "Error: Could not fork child process: There +are no available terminals (-1)". + +Another symptom is that `tmux` is no longer able to create new sessions. +Yet another symptom is new files are unintentionally written with +restricted permissions (copying an `.exe` file, for example, disallows +the copied version to be executed). + +The most likely reason why AzureAD SIDs were included in above-mentioned +commit is that special AzureAD _group_ SIDs are not recognized by +`LookupAccountSid()`, as per the code comment for the `azure_grp_sid` +variable. It is plausible that this fact was mistaken to extend to all +AzureAD SIDs, a notion disproved by the counter example of my personal +experience with my own AzureAD user account. Unfortunately, the only way +to find out whether `LookupAccountSid()` works with a given AzureAD SID +or not is to call that function. + +To make regular AzureAD user accounts work again, let's just drop the +AzureAD part from that special shortcut. + +My understanding of the other SIDs handled by that shortcut (Capability +SIDs, IIS APPPOOL and Samba user/group SIDs) is insufficient to +determine whether they, too, can be resolved by `LookupAccountSid()` in +some cases (and would therefore equally need to be excluded from that +shortcut). At least as far as the Capability SIDs go, I am rather +confident from reading the context (the commit's message, as well as the +report that led to that commit) that the shortcut is safe, and I could +imagine that the same is true for IIS APPPOOL and Samba SIDs. Absent any +further insight, I therefore decided to leave the rest of 48e7d63268 +(Cygwin: fetch_account_from_windows: skip LookupAccountSid for SIDs +known to fail, 2025-04-10) intact. + +Reported-by: Robert Fensterman +Fixes: 48e7d63268 (Cygwin: fetch_account_from_windows: skip LookupAccountSid for SIDs known to fail, 2025-04-10) +Signed-off-by: Johannes Schindelin +--- + winsup/cygwin/uinfo.cc | 4 ---- + 1 file changed, 4 deletions(-) + +diff --git a/winsup/cygwin/uinfo.cc b/winsup/cygwin/uinfo.cc +index 7c2581d..4323cb1 100644 +--- a/winsup/cygwin/uinfo.cc ++++ b/winsup/cygwin/uinfo.cc +@@ -1996,10 +1996,6 @@ pwdgrp::fetch_account_from_windows (fetch_user_arg_t &arg, cyg_ldap *pldap) + if (sid_id_auth (sid) == 5 /* SECURITY_NT_AUTHORITY */ + && sid_sub_auth (sid, 0) == SECURITY_APPPOOL_ID_BASE_RID) + break; +- /* AzureAD SIDs */ +- if (sid_id_auth (sid) == 12 /* AzureAD ID */ +- && sid_sub_auth (sid, 0) == 1 /* Azure ID base RID */) +- break; + /* Samba user/group SIDs */ + if (sid_id_auth (sid) == 22) + break; diff --git a/msys2-runtime/PKGBUILD b/msys2-runtime/PKGBUILD index 62f171c1..5c93e0a4 100644 --- a/msys2-runtime/PKGBUILD +++ b/msys2-runtime/PKGBUILD @@ -4,7 +4,7 @@ pkgbase=msys2-runtime pkgname=('msys2-runtime' 'msys2-runtime-devel') pkgver=3.6.2 -pkgrel=1 +pkgrel=2 pkgdesc="Cygwin POSIX emulation engine" arch=('x86_64') url="https://www.cygwin.com/" @@ -68,9 +68,10 @@ source=('msys2-runtime'::git://sourceware.org/git/newlib-cygwin.git#tag=cygwin-$ 0036-Revert-Cygwin-Enable-dynamicbase-on-the-Cygwin-DLL-b.patch 0037-Avoid-sharing-cygheaps-across-Cygwin-versions.patch 0038-uname-report-msys2-runtime-commit-hash-too.patch - 0039-Cygwin-Adjust-CWD-magic-to-accommodate-for-the-lates.patch) + 0039-Cygwin-Adjust-CWD-magic-to-accommodate-for-the-lates.patch + 0040-Cygwin-do-retrieve-AzureAD-users-information-again.patch) sha256sums=('91198341c33343cd6e37594dbb77b2e30e4d5f84a74c7a51a00392c11d137a8e' - '4ebc9e2fff832a05c73d9abc21962543b7342e4c69be03607b3971ab5d22e229' + '96895f25bf9fb2e49493ed7ee3d71fec33a24505ad19752880f3aee2d7a03bab' 'e4082aff332507d6d5fefa5b7da2fcbbaa8b593ca158dbb1fe026a26b0e09d91' '1cd177791994917d0c4df391fdc96993c3275eddd2b5f475532c0f478b2be8eb' '81d0f97d558b413c1b6fc592c7c0c7cac0b8f1c650e6fb13c01f4ee25b049fce' @@ -109,7 +110,8 @@ sha256sums=('91198341c33343cd6e37594dbb77b2e30e4d5f84a74c7a51a00392c11d137a8e' '3062f2d69088411c08c8f17fd82fe475dcdfb13acbe0d29ec6d2bfb15062a472' 'cac365f158c05feccfcf52557adb6e5de62a269a0b673b16eb2046e7c574be8e' 'fc982bdf206d2412dc999ea6042653841c3aa1bd062d8cef6e5ac3dae4ae5837' - '29d8d963f58295de6ceedb8be5f7c9f21c4fd14912e3ca06672ff26c51acdb66') + '29d8d963f58295de6ceedb8be5f7c9f21c4fd14912e3ca06672ff26c51acdb66' + '24efc2f585417740cec4b3797c6004eafd0b760f6ae59f04f75f2797bb9efcef') # Helper macros to help make tasks easier # apply_patch_with_msg() { @@ -186,7 +188,8 @@ prepare() { 0036-Revert-Cygwin-Enable-dynamicbase-on-the-Cygwin-DLL-b.patch \ 0037-Avoid-sharing-cygheaps-across-Cygwin-versions.patch \ 0038-uname-report-msys2-runtime-commit-hash-too.patch \ - 0039-Cygwin-Adjust-CWD-magic-to-accommodate-for-the-lates.patch + 0039-Cygwin-Adjust-CWD-magic-to-accommodate-for-the-lates.patch \ + 0040-Cygwin-do-retrieve-AzureAD-users-information-again.patch } build() { diff --git a/msys2-runtime/msys2-runtime.commit b/msys2-runtime/msys2-runtime.commit index 1b388421..5b97e2a9 100644 --- a/msys2-runtime/msys2-runtime.commit +++ b/msys2-runtime/msys2-runtime.commit @@ -1 +1 @@ -24ff97bf040632306e7b99d86b55dd2e2374d7f0 +a9cfe9f52b91f0a6a3b14477b0c35f8f2ab8db3a