On Thu, 31 Jul 2025, Corinna Vinschen wrote:

> On Jul 31 12:05, Jeremy Drake via Cygwin-patches wrote:
> > I noticed that dll_crt0_1 calls check_sanity_and_sync which performs some
> > checking on the per_process struct from the application, including if the
> > application's api_major is greater than the dll's.  However, this is after
> > _cygwin_crt0_common already runs.  I tested by downgrading to
> > 3.7.0-0.266 and running an executable that I had built with 267 (but not
> > using the new wrappers).  It didn't crash during startup, but it did seem
> > to crash after forking (it was doing a posix_spawn).  So maybe the
> > api_major check could catch this after the fact but before the corruption
> > caused any more issues.
>
> How so?  That would be in the DLL, but you're running an old DLL which
> you can't change retroactively.  OTOH, _cygwin_crt0_common already
> overwrites memory.

Yes, this check happens after _cygwin_crt0_common has overwitten the
bounds of the __cygwin_cxx_malloc struct, but in my testing this isn't
immediately fatal, and the api_major check would abend the program with a
suitable message.  I should test this with MSYS2, to make sure the memory
layout of the dll isn't different, and also because it's easier to get
older DLL versions (I only tried with the snapshot of 3.7.0 before the new
wrappers were added, but I can try with 3.6 3.5 3.4 and 3.3 there
pretty easily).

Reply via email to