summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--winsup/cygwin/ChangeLog5
-rw-r--r--winsup/cygwin/path.cc9
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,5 +1,10 @@
2011-10-13 Corinna Vinschen <corinna@vinschen.de>
+ * 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 <corinna@vinschen.de>
+
* path.cc (copy_cwd_str): Move up in file to be accessible from
class fcwd_access_t.
(class fcwd_access_t): New class to consolidate and hide the details
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. */