Commit Graph

8 Commits

Author SHA1 Message Date
Alistair Leslie-Hughes
7622ec9450 Rebase against 65989f2ace1b06617638e31cb7ba56deb38fe690 2018-02-17 14:01:23 +11:00
Sebastian Lackner
866e79688c loader-OSX_Preloader: Add workaround for a SELinux warning. 2017-06-18 00:52:15 +02:00
Sebastian Lackner
907dc4eae6 loader-OSX_Preloader: Add PAGEZERO section for wine-preloader executable.
For wine64-preloader we already do that, but apparently there are also kernel
versions which enforce a PAGEZERO section for 32-bit executables.
2017-06-16 22:45:03 +02:00
Sebastian Lackner
f254a73e66 loader-OSX_Preloader: Fall back to MAP_FIXED if address hint is ignored.
This should get rid of preloader warnings on old versions of macOS.
Thanks to Gijs Vermeulen for help with debugging and testing this patch.

Ideally, we would like to use vm_allocate, but since the preloader runs
very early during the startup of the process, we don't have all required
libc functions available. Also, we don't want to reimplement it ourself,
which would be very unreliable in practice.

For now, lets just use mincore() to check if there are any other pages
mapped within the area, and then fallback to MAP_FIXED.
2017-06-15 15:10:14 +02:00
Sebastian Lackner
463f2b02c9 loader-OSX_Preloader: Temporarily map address ranges needed for Wine builtin DLLs. 2017-06-15 00:01:33 +02:00
Sebastian Lackner
e9daff5bc8 loader-OSX_Preloader: Allocate pagezero for main wine binary.
This change should fix compatibility with old versions of macOS.
Thanks to Gijs Vermeulen for help with debugging and testing this patch.

Old versions of libsystem_c.dylib crash while running initializers when
the application does not contain a PAGEZERO section. This is probably
caused by an incorrect comparison against NULL instead of (void *)-1.

Unfortunately, when we just add a PAGEZERO section, we trigger the next
bug - no matter if we actually use the page at address (void *)0 or not,
it will not be used because the relocation code tries to find a memory
hole of size (highAddr - lowAddr) ~ 2GB.

We might be able to workaround this issue by manually reordering the
sections in the main executable, but for now lets just drop the fixed
image base. Please note that this introduces a risk of conflicts with
builtin DLLs, which will be resolved in the next patch.
2017-06-14 23:17:23 +02:00
Sebastian Lackner
3fab2fbed2 loader-OSX_Preloader: Fix compile error with old SDK versions. 2017-06-13 22:45:55 +02:00
Sebastian Lackner
b5d451ae12 Added patch to implement preloader for Mac OS. 2017-06-12 00:50:05 +02:00