]> sourceware.org Git - newlib-cygwin.git/commitdiff
Cygwin: drop Vista WOW64 specific child process handle bug
authorCorinna Vinschen <corinna@vinschen.de>
Fri, 29 Oct 2021 12:52:58 +0000 (14:52 +0200)
committerCorinna Vinschen <corinna@vinschen.de>
Fri, 29 Oct 2021 12:52:58 +0000 (14:52 +0200)
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
winsup/cygwin/child_info.h
winsup/cygwin/sigproc.cc
winsup/cygwin/wincap.cc
winsup/cygwin/wincap.h

index 505eaef235c1a5cf991fa96b7a1013b2f888b36e..7a67a1b5144d633e48e47fec5e924b056a0e3a89 100644 (file)
@@ -52,7 +52,7 @@ struct cchildren
 class child_info
 {
 public:
-  DWORD msv_count;     // set to pseudo-count on Vista WOW64, zeroed otherwise
+  DWORD msv_count;     // set to 0
   DWORD cb;            // size of this record
   DWORD intro;         // improbable string
   DWORD magic;         // magic number unique to child_info
index 47352c213633cab5a5ef47b2a713a6625ee27b72..8e70a9329dc635303bff2c6afe217ef68ff2d640 100644 (file)
@@ -809,31 +809,11 @@ int child_info::retry_count = 0;
    by fork/spawn/exec. */
 child_info::child_info (unsigned in_cb, child_info_types chtype,
                        bool need_subproc_ready):
-  cb (in_cb), intro (PROC_MAGIC_GENERIC), magic (CHILD_INFO_MAGIC),
-  type (chtype), cygheap (::cygheap), cygheap_max (::cygheap_max),
-  flag (0), retry (child_info::retry_count), rd_proc_pipe (NULL),
-  wr_proc_pipe (NULL)
+  msv_count (0), cb (in_cb), intro (PROC_MAGIC_GENERIC),
+  magic (CHILD_INFO_MAGIC), type (chtype), cygheap (::cygheap),
+  cygheap_max (::cygheap_max), flag (0), retry (child_info::retry_count),
+  rd_proc_pipe (NULL), wr_proc_pipe (NULL)
 {
-  /* It appears that when running under WOW64 on Vista 64, the first DWORD
-     value in the datastructure lpReserved2 is pointing to (msv_count in
-     Cygwin), has to reflect the size of that datastructure as used in the
-     Microsoft C runtime (a count value, counting the number of elements in
-     two subsequent arrays, BYTE[count and HANDLE[count]), even though the C
-     runtime isn't used.  Otherwise, if msv_count is 0 or too small, the
-     datastructure gets overwritten.
-
-     This seems to be a bug in Vista's WOW64, which apparently copies the
-     lpReserved2 datastructure not using the cbReserved2 size information,
-     but using the information given in the first DWORD within lpReserved2
-     instead.  However, it's not clear if a non-0 count doesn't result in
-     trying to evaluate the content, so we do this really only for Vista 64.
-
-     The value is sizeof (child_info_*) / 5 which results in a count which
-     covers the full datastructure, plus not more than 4 extra bytes.  This
-     is ok as long as the child_info structure is cosily stored within a bigger
-     datastructure. */
-  msv_count = wincap.needs_count_in_si_lpres2 () ? in_cb / 5 : 0;
-
   fhandler_union_cb = sizeof (fhandler_union);
   user_h = cygwin_user_h;
   if (strace.active ())
index 6c79d87101833ac4fe024d418005efc2a81572a7..dbf36272b59dc3468fe98354ce84b487bdcf2d65 100644 (file)
@@ -23,7 +23,6 @@ wincaps wincap_vista __attribute__((section (".cygwin_dll_common"), shared)) = {
   mmap_storage_high:0x070000000000LL,
   {
     is_server:false,
-    needs_count_in_si_lpres2:true,
     needs_query_information:true,
     has_gaa_largeaddress_bug:true,
     has_broken_alloc_console:false,
@@ -59,7 +58,6 @@ wincaps wincap_7 __attribute__((section (".cygwin_dll_common"), shared)) = {
   mmap_storage_high:0x070000000000LL,
   {
     is_server:false,
-    needs_count_in_si_lpres2:false,
     needs_query_information:true,
     has_gaa_largeaddress_bug:true,
     has_broken_alloc_console:true,
@@ -95,7 +93,6 @@ wincaps wincap_8 __attribute__((section (".cygwin_dll_common"), shared)) = {
   mmap_storage_high:0x070000000000LL,
   {
     is_server:false,
-    needs_count_in_si_lpres2:false,
     needs_query_information:true,
     has_gaa_largeaddress_bug:false,
     has_broken_alloc_console:true,
@@ -131,7 +128,6 @@ wincaps wincap_8_1 __attribute__((section (".cygwin_dll_common"), shared)) = {
   mmap_storage_high:0x700000000000LL,
   {
     is_server:false,
-    needs_count_in_si_lpres2:false,
     needs_query_information:false,
     has_gaa_largeaddress_bug:false,
     has_broken_alloc_console:true,
@@ -167,7 +163,6 @@ wincaps  wincap_10_1507 __attribute__((section (".cygwin_dll_common"), shared))
   mmap_storage_high:0x700000000000LL,
   {
     is_server:false,
-    needs_count_in_si_lpres2:false,
     needs_query_information:false,
     has_gaa_largeaddress_bug:false,
     has_broken_alloc_console:true,
@@ -203,7 +198,6 @@ wincaps  wincap_10_1607 __attribute__((section (".cygwin_dll_common"), shared))
   mmap_storage_high:0x700000000000LL,
   {
     is_server:false,
-    needs_count_in_si_lpres2:false,
     needs_query_information:false,
     has_gaa_largeaddress_bug:false,
     has_broken_alloc_console:true,
@@ -239,7 +233,6 @@ wincaps wincap_10_1703 __attribute__((section (".cygwin_dll_common"), shared)) =
   mmap_storage_high:0x700000000000LL,
   {
     is_server:false,
-    needs_count_in_si_lpres2:false,
     needs_query_information:false,
     has_gaa_largeaddress_bug:false,
     has_broken_alloc_console:true,
@@ -275,7 +268,6 @@ wincaps wincap_10_1709 __attribute__((section (".cygwin_dll_common"), shared)) =
   mmap_storage_high:0x700000000000LL,
   {
     is_server:false,
-    needs_count_in_si_lpres2:false,
     needs_query_information:false,
     has_gaa_largeaddress_bug:false,
     has_broken_alloc_console:true,
@@ -311,7 +303,6 @@ wincaps wincap_10_1803 __attribute__((section (".cygwin_dll_common"), shared)) =
   mmap_storage_high:0x700000000000LL,
   {
     is_server:false,
-    needs_count_in_si_lpres2:false,
     needs_query_information:false,
     has_gaa_largeaddress_bug:false,
     has_broken_alloc_console:true,
@@ -347,7 +338,6 @@ wincaps wincap_10_1809 __attribute__((section (".cygwin_dll_common"), shared)) =
   mmap_storage_high:0x700000000000LL,
   {
     is_server:false,
-    needs_count_in_si_lpres2:false,
     needs_query_information:false,
     has_gaa_largeaddress_bug:false,
     has_broken_alloc_console:true,
@@ -383,7 +373,6 @@ wincaps wincap_10_1903 __attribute__((section (".cygwin_dll_common"), shared)) =
   mmap_storage_high:0x700000000000LL,
   {
     is_server:false,
-    needs_count_in_si_lpres2:false,
     needs_query_information:false,
     has_gaa_largeaddress_bug:false,
     has_broken_alloc_console:true,
@@ -482,7 +471,6 @@ wincapc::init ()
       && !wow64)
 #endif
     {
-      ((wincaps *)caps)->needs_count_in_si_lpres2 = false;
       ((wincaps *)caps)->has_gaa_largeaddress_bug = false;
       ((wincaps *)caps)->has_broken_prefetchvm = false;
       ((wincaps *)caps)->no_msv1_0_s4u_logon_in_wow64 = false;
index 7249b951875911f8ef5b1a6619a636584479faee..150ad253be12a2c486e33e0dcf08560547ca021e 100644 (file)
@@ -17,7 +17,6 @@ struct wincaps
      ops generated by gcc are off by 4 bytes. */
   struct  __attribute__ ((aligned (8))) {
     unsigned is_server                                         : 1;
-    unsigned needs_count_in_si_lpres2                          : 1;
     unsigned needs_query_information                           : 1;
     unsigned has_gaa_largeaddress_bug                          : 1;
     unsigned has_broken_alloc_console                          : 1;
@@ -85,7 +84,6 @@ public:
   intptr_t IMPLEMENT (mmap_storage_high)
 #endif
   bool  IMPLEMENT (is_server)
-  bool IMPLEMENT (needs_count_in_si_lpres2)
   bool IMPLEMENT (needs_query_information)
   bool IMPLEMENT (has_gaa_largeaddress_bug)
   bool IMPLEMENT (has_broken_alloc_console)
This page took 0.038611 seconds and 5 git commands to generate.