Quantcast

[PATCH] FAST_CWD: adjust the initial search scope

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[PATCH] FAST_CWD: adjust the initial search scope

Johannes Schindelin
A *very* recent Windows build adds more code to the preamble of
RtlGetCurrentDirectory_U() so that the previous heuristic failed to find
the call to the locking routine.

This only affects the 64-bit version of ntdll, where the 0xe8 byte is
now found at offset 40, not the 32-bit version. However, let's just
double the area we search for said byte for good measure.

Signed-off-by: Johannes Schindelin <[hidden email]>
---
Published-As: https://github.com/dscho/msys2-runtime/releases/tag/fast-cwd-v1
Fetch-It-Via: git fetch https://github.com/dscho/msys2-runtime fast-cwd-v1

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

diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
index c3b304ab5..ee7636dbf 100644
--- a/winsup/cygwin/path.cc
+++ b/winsup/cygwin/path.cc
@@ -4034,7 +4034,7 @@ find_fast_cwd_pointer ()
   if (!get_dir || !ent_crit)
     return NULL;
   /* Search first relative call instruction in RtlGetCurrentDirectory_U. */
-  const uint8_t *rcall = (const uint8_t *) memchr (get_dir, 0xe8, 40);
+  const uint8_t *rcall = (const uint8_t *) memchr (get_dir, 0xe8, 80);
   if (!rcall)
     return NULL;
   /* Fetch offset from instruction and compute address of called function.
@@ -4133,7 +4133,7 @@ find_fast_cwd_pointer ()
   if (!get_dir || !ent_crit)
     return NULL;
   /* Search first relative call instruction in RtlGetCurrentDirectory_U. */
-  const uint8_t *rcall = (const uint8_t *) memchr (get_dir, 0xe8, 32);
+  const uint8_t *rcall = (const uint8_t *) memchr (get_dir, 0xe8, 64);
   if (!rcall)
     return NULL;
   /* Fetch offset from instruction and compute address of called function.

base-commit: e0477b4a0ba2b842d4f81350f7fa9a03b1f3d27b
--
2.11.0.310.g4ee6bc8b50
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [PATCH] FAST_CWD: adjust the initial search scope

Corinna Vinschen-2
Hi Johannes,

On Jan 11 14:21, Johannes Schindelin wrote:
> A *very* recent Windows build adds more code to the preamble of
> RtlGetCurrentDirectory_U() so that the previous heuristic failed to find
> the call to the locking routine.
>
> This only affects the 64-bit version of ntdll, where the 0xe8 byte is
> now found at offset 40, not the 32-bit version. However, let's just
> double the area we search for said byte for good measure.

any chance to convince the powers that be to open up access to this
datastructures without such hacky means?


Thanks,
Corinna

--
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

signature.asc (836 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [PATCH] FAST_CWD: adjust the initial search scope

Johannes Schindelin
Hi Corinna,

On Wed, 11 Jan 2017, Corinna Vinschen wrote:

> On Jan 11 14:21, Johannes Schindelin wrote:
> > A *very* recent Windows build adds more code to the preamble of
> > RtlGetCurrentDirectory_U() so that the previous heuristic failed to
> > find the call to the locking routine.
> >
> > This only affects the 64-bit version of ntdll, where the 0xe8 byte is
> > now found at offset 40, not the 32-bit version. However, let's just
> > double the area we search for said byte for good measure.
>
> any chance to convince the powers that be to open up access to this
> datastructures without such hacky means?

I try my best.

Ciao,
Johannes
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [PATCH] FAST_CWD: adjust the initial search scope

Corinna Vinschen-2
On Jan 11 20:48, Johannes Schindelin wrote:

> Hi Corinna,
>
> On Wed, 11 Jan 2017, Corinna Vinschen wrote:
>
> > On Jan 11 14:21, Johannes Schindelin wrote:
> > > A *very* recent Windows build adds more code to the preamble of
> > > RtlGetCurrentDirectory_U() so that the previous heuristic failed to
> > > find the call to the locking routine.
> > >
> > > This only affects the 64-bit version of ntdll, where the 0xe8 byte is
> > > now found at offset 40, not the 32-bit version. However, let's just
> > > double the area we search for said byte for good measure.
> >
> > any chance to convince the powers that be to open up access to this
> > datastructures without such hacky means?
>
> I try my best.
Thanks!  Patch pushed.


Corinna

--
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

signature.asc (836 bytes) Download Attachment
Loading...