public inbox for cygwin-patches@cygwin.com
 help / color / mirror / Atom feed
* [PATCH] Adjust CWD magic to accommodate for the latest Windows previews
@ 2023-05-22 11:36 Johannes Schindelin
  2023-05-24 19:51 ` Jon Turney
  0 siblings, 1 reply; 2+ messages in thread
From: Johannes Schindelin @ 2023-05-22 11:36 UTC (permalink / raw)
  To: cygwin-patches

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.

This fixes https://github.com/git-for-windows/git/issues/4429

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
Published-As: https://github.com/dscho/msys2-runtime/releases/tag/adjust-cygwin-cwd-magic-to-newest-windows-v1
Fetch-It-Via: git fetch https://github.com/dscho/msys2-runtime adjust-cygwin-cwd-magic-to-newest-windows-v1

 winsup/cygwin/path.cc | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
index 582238d150..fd09e5dc78 100644
--- a/winsup/cygwin/path.cc
+++ b/winsup/cygwin/path.cc
@@ -4514,10 +4514,24 @@ find_fast_cwd_pointer ()
 	     or, then `mov %r12,%rcx', then `callq RtlEnterCriticalSection'. */
 	  lock = (const uint8_t *) memmem ((const char *) use_cwd, 80,
 					   "\x4c\x8d\x25", 3);
-	  if (!lock)
-	    return NULL;
 	  call_rtl_offset = 14;
 	}
+
+      if (!lock)
+	{
+	  /* A recent Windows Preview calls `lea rel(rip),%r13' then
+	     some unrelated instructions, then `callq RtlEnterCriticalSection'.
+	     */
+	  lock = (const uint8_t *) memmem ((const char *) use_cwd, 80,
+					   "\x4c\x8d\x2d", 3);
+	  call_rtl_offset = 24;
+	}
+
+      if (!lock)
+	{
+	  return NULL;
+	}
+
       PRTL_CRITICAL_SECTION lockaddr =
         (PRTL_CRITICAL_SECTION) (lock + 7 + peek32 (lock + 3));
       /* Test if lock address is FastPebLock. */

base-commit: e7858c0a585e29c48a4109933423a0de362fc62d
--
2.41.0.rc0.windows.1

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Adjust CWD magic to accommodate for the latest Windows previews
  2023-05-22 11:36 [PATCH] Adjust CWD magic to accommodate for the latest Windows previews Johannes Schindelin
@ 2023-05-24 19:51 ` Jon Turney
  0 siblings, 0 replies; 2+ messages in thread
From: Jon Turney @ 2023-05-24 19:51 UTC (permalink / raw)
  To: Johannes Schindelin, Cygwin Patches

On 22/05/2023 12:36, Johannes Schindelin wrote:
> 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.
> 
> This fixes https://github.com/git-for-windows/git/issues/4429
> 
> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>

Applied. Thanks.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-05-24 19:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-22 11:36 [PATCH] Adjust CWD magic to accommodate for the latest Windows previews Johannes Schindelin
2023-05-24 19:51 ` Jon Turney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).