From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2201) id D74AE3858D28; Wed, 24 May 2023 21:06:42 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D74AE3858D28 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1684962402; bh=9ABVe3mpe2YMa92VaZySjIeAX/ajYqXtJdZkueHV7dw=; h=From:To:Subject:Date:From; b=H93gJ3TntM8UPB4Jw/EpxQ4lWCaeDw2oy5lyLyFzbBV+tSurLoDtzQLaB1ZEZAmUw eYy8JpLp06O/PW8MdJYARQfSvpvxEcviKUygQA2WCtD89cAh8GExmRSCm+UbPj+B0y n4w1DCZjUEbKLBDoMBTCedvXqd5GyArNqsdfYDvE= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Jon Turney To: cygwin-cvs@sourceware.org Subject: [newlib-cygwin/cygwin-3_4-branch] Cygwin: Adjust CWD magic to accommodate for the latest Windows previews X-Act-Checkin: newlib-cygwin X-Git-Author: Johannes Schindelin X-Git-Refname: refs/heads/cygwin-3_4-branch X-Git-Oldrev: 1c63eaace825e32f2d03a3a228a40b1019b94c71 X-Git-Newrev: deca777a958cad67faa73d7457ecccd8c73ed943 Message-Id: <20230524210642.D74AE3858D28@sourceware.org> Date: Wed, 24 May 2023 21:06:42 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dnewlib-cygwin.git;h=3Ddeca777a958= cad67faa73d7457ecccd8c73ed943 commit deca777a958cad67faa73d7457ecccd8c73ed943 Author: Johannes Schindelin Date: Mon May 22 13:36:27 2023 +0200 Cygwin: Adjust CWD magic to accommodate for the latest Windows previews =20 Reportedly Windows 11 build 25*** from Insider changed the current working directory logic a bit, and Cygwin's "magic" (or: "technologically sufficiently advanced") code needs to be adjusted accordingly. =20 This fixes https://github.com/git-for-windows/git/issues/4429 =20 Signed-off-by: Johannes Schindelin (cherry picked from commit 4840a5632520c1a3c1598f73f9d1cdd37df371ba) Diff: --- winsup/cygwin/path.cc | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc index 5b3df20dd..e788c7d60 100644 --- a/winsup/cygwin/path.cc +++ b/winsup/cygwin/path.cc @@ -4578,13 +4578,27 @@ find_fast_cwd_pointer () if (!lock) { /* Windows 8.1 Preview calls `lea rel(rip),%r12' then some unrelated - or, then `mov %r12,%rcx', then `callq RtlEnterCriticalSection'. */ + ops, then `mov %r12,%rcx', then `callq RtlEnterCriticalSection'. */ lock =3D (const uint8_t *) memmem ((const char *) use_cwd, 80, "\x4c\x8d\x25", 3); - if (!lock) - return NULL; call_rtl_offset =3D 14; } + + if (!lock) + { + /* A recent Windows 11 Preview calls `lea rel(rip),%r13' then + some unrelated instructions, then `callq RtlEnterCriticalSection'. + */ + lock =3D (const uint8_t *) memmem ((const char *) use_cwd, 80, + "\x4c\x8d\x2d", 3); + call_rtl_offset =3D 24; + } + + if (!lock) + { + return NULL; + } + PRTL_CRITICAL_SECTION lockaddr =3D (PRTL_CRITICAL_SECTION) (lock + 7 + peek32 (lock + 3)); /* Test if lock address is FastPebLock. */