Commit f558741fabc116534fa598aa890ffed683a7153b removes vDSO if it conflicts with reserved ranges:
Remove the AT_SYSINFO and AT_SYSINFO_EHDR values if the sysinfo page is in one of our reserved ranges.
However, missing vDSO leads to performance issues on some syscalls (e.g. clock_gettime, gettimeofday) and may even lead to crash when run with some ancient C libraries that does not supply a custom signal restorer.
vDSO pages can clash with reserved ranges especially in a 32-bit address space with address space layout randomization (ASLR) turned on.
Recent versions of the Linux kernel introduced support for mremap()-ping vDSO pages, partly in an effort to support checkpoint restore in userspace (CRIU). Special programs that require specific memory layout constraints (such as Wine preloader) can take advantage of this support to modify the address space to meet its requirements.
Changelog: - v3 -> v4: - address review comments - add more comments and documentation
The following test script has been used to test each changes (use with git rebase --exec=...):
set -e make -C ../wine64-build -j5 make -C ../wine32-build -j5
cd ../wine64-build export WINEPRELOADREMAPSTACK export WINEPRELOADREMAPVDSO for WINEPRELOADREMAPSTACK in skip never always force auto on-demand '' do for WINEPRELOADREMAPVDSO in skip never always force auto on-demand '' do ./loader/wine64 wineboot ./loader/wine wineboot done done
Jinoh Kang (10): loader: Refactor argv/envp/auxv management. loader: Refactor number parsing to own function. loader: Generalise is_addr_reserved to find overlapping address ranges. loader: Explicitly munmap() the preloader's ELF EHDR. loader: Don't clobber existing memory mappings when reserving addresses. loader: Fix return type of get_auxiliary(). loader: Relocate vDSO on conflict with reserved ranges. loader: Relocate sigpage on conflict with reserved ranges in ARM. loader: Switch stack if the old stack address is in reserved range. loader: Enable all remap logic by default.
loader/preloader.c | 1523 ++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 1407 insertions(+), 116 deletions(-)