newlib/winsup
Corinna Vinschen 3a72edc124 Cygwin: Fix the address of myself
Introducing an independent Cygwin PID introduced a regression:

The expectation is that the myself pinfo pointer always points to a
specific address right in front of the loaded Cygwin DLL.

However, the independent Cygwin PID changes broke this.  To create
myself at the right address requires to call init with h0 set to
INVALID_HANDLE_VALUE or an existing address:

void
pinfo::init (pid_t n, DWORD flag, HANDLE h0)
{
  [...]
  if (!h0 || myself.h)
    [...]
  else
    {
      shloc = SH_MYSELF;
      if (h0 == INVALID_HANDLE_VALUE)       <-- !!!
        h0 = NULL;
    }

The aforementioned commits changed that so h0 was always NULL, this way
creating myself at an arbitrary address.

This patch makes sure to set the handle to INVALID_HANDLE_VALUE again
when creating a new process, so init knows that myself has to be created
in the right spot.  While at it, fix a potential uninitialized handle
value in child_info_spawn::handle_spawn.

Fixes: b5e1003722 ("Cygwin: processes: use dedicated Cygwin PID rather than Windows PID")
Fixes: 88605243a1 ("Cygwin: fix child getting another pid after spawnve")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-07-25 10:45:52 +02:00
..
CVSChangeLogs.old
cygserver Cygwin: fix GCC 8.3 'local external declaration' errors 2019-07-17 11:08:20 -04:00
cygwin Cygwin: Fix the address of myself 2019-07-25 10:45:52 +02:00
doc Cygwin: Export newlib ndbm functions 2019-07-24 22:32:48 +02:00
lsaauth
testsuite
utils Cygwin: suppress GCC 8.3 errors with -Warray-bounds 2019-07-16 13:19:33 -04:00
CONTRIBUTORS Cygwin: Add J.H. van de Water to CONTRIBUTORS 2018-08-15 18:02:22 +02:00
COPYING
COPYING.LIB
CYGWIN_LICENSE
Makefile.common
Makefile.in
README
acinclude.m4
aclocal.m4
autogen.sh
c++wrap
ccwrap
config.guess
config.sub
configure Cygwin: seteuid: disable unused funcs and lsaauth subdir 2019-01-28 10:24:18 +01:00
configure.ac Cygwin: seteuid: disable unused funcs and lsaauth subdir 2019-01-28 10:24:18 +01:00
configure.cygwin
install-sh

README

THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESSED OR
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.

Cygwin documentation is available on the net at https://cygwin.com
You might especially be interested in

https://cygwin.com/faq/faq.html#faq.programming.building-cygwin