Don't use LoadLibraryEx(..., LOAD_LIBRARY_SEARCH_SYSTEM32). It hangs
Observed running hexchat under X. For some reason the call to LoadLibraryEx(..., LOAD_LIBRARY_SEARCH_SYSTEM32) in dll_load hangs when trying to autoload MsgWaitForMultipleObjectsEx in select.cc after hexchat forks to run DNS calls. Dropping the call and just using full paths as in 2.3.1 fixes the issue. * autoload.cc (dll_load): Drop call to LoadLibraryEx with LOAD_LIBRARY_SEARCH_SYSTEM32 flag. * wincap.h (wincaps::has_load_lib_search_flags): Remove. * wincap.cc (wincaps::has_load_lib_search_flags): Drop handling this flag. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
		| @@ -332,7 +332,6 @@ union retchain | |||||||
|   two_addr_t ll; |   two_addr_t ll; | ||||||
| }; | }; | ||||||
|  |  | ||||||
|  |  | ||||||
| /* This function handles the problem described here: | /* This function handles the problem described here: | ||||||
|  |  | ||||||
|   http://www.microsoft.com/technet/security/advisory/2269637.mspx |   http://www.microsoft.com/technet/security/advisory/2269637.mspx | ||||||
| @@ -349,13 +348,6 @@ static __inline bool | |||||||
| dll_load (HANDLE& handle, PWCHAR name) | dll_load (HANDLE& handle, PWCHAR name) | ||||||
| { | { | ||||||
|   HANDLE h = NULL; |   HANDLE h = NULL; | ||||||
|  |  | ||||||
|   /* On systems supporting LOAD_LIBRARY_SEARCH flags, try to load |  | ||||||
|      explicitely from the system dir first. */ |  | ||||||
|   if (wincap.has_load_lib_search_flags ()) |  | ||||||
|     h = LoadLibraryExW (name, NULL, LOAD_LIBRARY_SEARCH_SYSTEM32); |  | ||||||
|   if (!h) |  | ||||||
|     { |  | ||||||
|   WCHAR dll_path[MAX_PATH]; |   WCHAR dll_path[MAX_PATH]; | ||||||
|  |  | ||||||
|   /* If that failed, try loading with full path, which sometimes |   /* If that failed, try loading with full path, which sometimes | ||||||
| @@ -370,7 +362,6 @@ dll_load (HANDLE& handle, PWCHAR name) | |||||||
|   /* Last resort: Try loading just by name. */ |   /* Last resort: Try loading just by name. */ | ||||||
|   if (!h) |   if (!h) | ||||||
|     h = LoadLibraryW (name); |     h = LoadLibraryW (name); | ||||||
|     } |  | ||||||
|   if (!h) |   if (!h) | ||||||
|     return false; |     return false; | ||||||
|   handle = h; |   handle = h; | ||||||
|   | |||||||
| @@ -52,7 +52,6 @@ wincaps wincap_xpsp2 __attribute__((section (".cygwin_dll_common"), shared)) = { | |||||||
|   has_processor_groups:false, |   has_processor_groups:false, | ||||||
|   has_broken_prefetchvm:false, |   has_broken_prefetchvm:false, | ||||||
|   has_new_pebteb_region:false, |   has_new_pebteb_region:false, | ||||||
|   has_load_lib_search_flags:false, |  | ||||||
| }; | }; | ||||||
|  |  | ||||||
| wincaps wincap_2003 __attribute__((section (".cygwin_dll_common"), shared)) = { | wincaps wincap_2003 __attribute__((section (".cygwin_dll_common"), shared)) = { | ||||||
| @@ -87,7 +86,6 @@ wincaps wincap_2003 __attribute__((section (".cygwin_dll_common"), shared)) = { | |||||||
|   has_processor_groups:false, |   has_processor_groups:false, | ||||||
|   has_broken_prefetchvm:false, |   has_broken_prefetchvm:false, | ||||||
|   has_new_pebteb_region:false, |   has_new_pebteb_region:false, | ||||||
|   has_load_lib_search_flags:false, |  | ||||||
| }; | }; | ||||||
|  |  | ||||||
| wincaps wincap_vista __attribute__((section (".cygwin_dll_common"), shared)) = { | wincaps wincap_vista __attribute__((section (".cygwin_dll_common"), shared)) = { | ||||||
| @@ -122,7 +120,6 @@ wincaps wincap_vista __attribute__((section (".cygwin_dll_common"), shared)) = { | |||||||
|   has_processor_groups:false, |   has_processor_groups:false, | ||||||
|   has_broken_prefetchvm:false, |   has_broken_prefetchvm:false, | ||||||
|   has_new_pebteb_region:false, |   has_new_pebteb_region:false, | ||||||
|   has_load_lib_search_flags:true, |  | ||||||
| }; | }; | ||||||
|  |  | ||||||
| wincaps wincap_7 __attribute__((section (".cygwin_dll_common"), shared)) = { | wincaps wincap_7 __attribute__((section (".cygwin_dll_common"), shared)) = { | ||||||
| @@ -157,7 +154,6 @@ wincaps wincap_7 __attribute__((section (".cygwin_dll_common"), shared)) = { | |||||||
|   has_processor_groups:true, |   has_processor_groups:true, | ||||||
|   has_broken_prefetchvm:false, |   has_broken_prefetchvm:false, | ||||||
|   has_new_pebteb_region:false, |   has_new_pebteb_region:false, | ||||||
|   has_load_lib_search_flags:true, |  | ||||||
| }; | }; | ||||||
|  |  | ||||||
| wincaps wincap_8 __attribute__((section (".cygwin_dll_common"), shared)) = { | wincaps wincap_8 __attribute__((section (".cygwin_dll_common"), shared)) = { | ||||||
| @@ -192,7 +188,6 @@ wincaps wincap_8 __attribute__((section (".cygwin_dll_common"), shared)) = { | |||||||
|   has_processor_groups:true, |   has_processor_groups:true, | ||||||
|   has_broken_prefetchvm:false, |   has_broken_prefetchvm:false, | ||||||
|   has_new_pebteb_region:false, |   has_new_pebteb_region:false, | ||||||
|   has_load_lib_search_flags:true, |  | ||||||
| }; | }; | ||||||
|  |  | ||||||
| wincaps wincap_10 __attribute__((section (".cygwin_dll_common"), shared)) = { | wincaps wincap_10 __attribute__((section (".cygwin_dll_common"), shared)) = { | ||||||
| @@ -227,7 +222,6 @@ wincaps wincap_10 __attribute__((section (".cygwin_dll_common"), shared)) = { | |||||||
|   has_processor_groups:true, |   has_processor_groups:true, | ||||||
|   has_broken_prefetchvm:true, |   has_broken_prefetchvm:true, | ||||||
|   has_new_pebteb_region:false, |   has_new_pebteb_region:false, | ||||||
|   has_load_lib_search_flags:true, |  | ||||||
| }; | }; | ||||||
|  |  | ||||||
| wincaps wincap_10_1511 __attribute__((section (".cygwin_dll_common"), shared)) = { | wincaps wincap_10_1511 __attribute__((section (".cygwin_dll_common"), shared)) = { | ||||||
| @@ -262,7 +256,6 @@ wincaps wincap_10_1511 __attribute__((section (".cygwin_dll_common"), shared)) = | |||||||
|   has_processor_groups:true, |   has_processor_groups:true, | ||||||
|   has_broken_prefetchvm:false, |   has_broken_prefetchvm:false, | ||||||
|   has_new_pebteb_region:true, |   has_new_pebteb_region:true, | ||||||
|   has_load_lib_search_flags:true, |  | ||||||
| }; | }; | ||||||
|  |  | ||||||
| wincapc wincap __attribute__((section (".cygwin_dll_common"), shared)); | wincapc wincap __attribute__((section (".cygwin_dll_common"), shared)); | ||||||
|   | |||||||
| @@ -45,7 +45,6 @@ struct wincaps | |||||||
|   unsigned has_processor_groups				: 1; |   unsigned has_processor_groups				: 1; | ||||||
|   unsigned has_broken_prefetchvm			: 1; |   unsigned has_broken_prefetchvm			: 1; | ||||||
|   unsigned has_new_pebteb_region			: 1; |   unsigned has_new_pebteb_region			: 1; | ||||||
|   unsigned has_load_lib_search_flags			: 1; |  | ||||||
| }; | }; | ||||||
|  |  | ||||||
| class wincapc | class wincapc | ||||||
| @@ -105,7 +104,6 @@ public: | |||||||
|   bool	IMPLEMENT (has_processor_groups) |   bool	IMPLEMENT (has_processor_groups) | ||||||
|   bool	IMPLEMENT (has_broken_prefetchvm) |   bool	IMPLEMENT (has_broken_prefetchvm) | ||||||
|   bool	IMPLEMENT (has_new_pebteb_region) |   bool	IMPLEMENT (has_new_pebteb_region) | ||||||
|   bool	IMPLEMENT (has_load_lib_search_flags) |  | ||||||
|  |  | ||||||
| #undef IMPLEMENT | #undef IMPLEMENT | ||||||
| }; | }; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user