https://bugs.winehq.org/show_bug.cgi?id=43217
Bug ID: 43217 Summary: Wine cannot execute position-independent (PIE) host executables via CreateProcess() Product: Wine Version: unspecified Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: kernel32 Assignee: wine-bugs@winehq.org Reporter: osmanx@problemloesungsmaschine.de Distribution: ---
Created attachment 58504 --> https://bugs.winehq.org/attachment.cgi?id=58504 script.sh: Test script to reproduce the problem; test.c: Windows program; hello.c: Host/Linux program
The problem arises from the fact that `create_process_impl()` in `dlls/kernel32/process.c` ultimately calls `MODULE_get_binary_info()` in `dlls/kernel32/module.c` which detects PIE exectuables as ELF shared objects and thus sets `info->type = BINARY_UNIX_LIB;` instead of `info->type = BINARY_UNIX_EXE;`. I do not have enough knowledge about the precise way that Winelib apps are implemented or supposed to work, but the fact that PIE executables are in fact ELF shared objects and not ELF executables according to the ELF header, causes Wine to detect these as Winelib apps and ultimately invoke the wrong process creation path.
The problem especially manifests on the just released Debian 9 Stretch because Debian 9 now uses PIE executables throughout the distribution and these cannot be started any more from within programs running on Wine. Tested with winehq-devel packages 2.10 as well as Debian 9 packaged Wine 1.8.7 and 2.0. Looking at Wine git master, the relevant code paths have not changed at all for quite some time, thus this very likely also applies to all other Wine versions as well. Non-PIE executables work fine.
Test script (script.sh) to reproduce the problem as well as output of the test script attached.