From 76173acf28058262b31e129cb90fa7f478413e34 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Thu, 13 Oct 2011 16:47:32 +0000 Subject: [PATCH] * path.cc (find_fast_cwd_pointer): Allow 'push crit-sect-addr' instead of 'mov edi, crit-sect-addr; push edi' and set rcall accordingly. --- winsup/cygwin/ChangeLog | 5 +++++ winsup/cygwin/path.cc | 9 ++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 7d502bcef..afd6fdebb 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,8 @@ +2011-10-13 Corinna Vinschen + + * path.cc (find_fast_cwd_pointer): Allow 'push crit-sect-addr' instead + of 'mov edi, crit-sect-addr; push edi' and set rcall accordingly. + 2011-10-13 Corinna Vinschen * path.cc (copy_cwd_str): Move up in file to be accessible from diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc index f9ed0dc06..45583fb76 100644 --- a/winsup/cygwin/path.cc +++ b/winsup/cygwin/path.cc @@ -3665,9 +3665,13 @@ find_fast_cwd_pointer () /* Find first "push edi" instruction. */ const uint8_t *pushedi = (const uint8_t *) memchr (use_cwd, 0x57, 32); /* ...which should be followed by "mov edi, crit-sect-addr" then - "push edi". */ + "push edi", or by just a single "push crit-sect-addr". */ const uint8_t *movedi = pushedi + 1; - if (movedi[0] != 0xbf || movedi[5] != 0x57) + if (movedi[0] == 0xbf && movedi[5] == 0x57) + rcall = movedi + 6; + else if (movedi[0] == 0x68) + rcall = movedi + 5; + else return NULL; /* Compare the address used for the critical section with the known PEB lock as stored in the PEB. */ @@ -3676,7 +3680,6 @@ find_fast_cwd_pointer () return NULL; /* To check we are seeing the right code, we check our expectation that the next instruction is a relative call into RtlEnterCriticalSection. */ - rcall = movedi + 6; if (rcall[0] != 0xe8) return NULL; /* Check that this is a relative call to RtlEnterCriticalSection. */ -- 2.43.5