loader: fix reservation of DOS memory area on OS X for ASLR.

Yiduo David Wang planetbeing at gmail.com
Tue Aug 5 14:56:38 CDT 2014


Should fix bug 37034 and bug 36367. This bug is particular to OS X and
results from compiling wine with ASLR enabled, which it is by default.
Tested on 10.9.4 compiling with clang.

---
 loader/main.c | 2 ++
 1 file changed, 2 insertions(+)
-------------- next part --------------
From 4c9e6b0cd1acdd16db1bd1ad2c69a6860b8c3611 Mon Sep 17 00:00:00 2001
From: David Wang <planetbeing at gmail.com>
Date: Tue, 5 Aug 2014 13:44:43 -0600
Subject: loader: fix reservation of DOS memory area on OS X for ASLR.

---
 loader/main.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/loader/main.c b/loader/main.c
index ac67290..85122ae 100644
--- a/loader/main.c
+++ b/loader/main.c
@@ -42,6 +42,7 @@
 #include "main.h"
 
 #ifdef __APPLE__
+#include <mach-o/dyld.h>
 
 #ifndef __clang__
 __asm__(".zerofill WINE_DOS, WINE_DOS, ___wine_dos, 0x40000000");
@@ -63,6 +64,7 @@ static const struct wine_preload_info wine_main_preload_info[] =
 
 static inline void reserve_area( void *addr, size_t size )
 {
+    addr = (void *)((uintptr_t)addr - _dyld_get_image_vmaddr_slide( 0 ));
     wine_anon_mmap( addr, size, PROT_NONE, MAP_FIXED | MAP_NORESERVE );
     wine_mmap_add_reserved_area( addr, size );
 }
-- 
1.8.5.2 (Apple Git-48)



More information about the wine-patches mailing list