ASLR is supported only on Windows Vista and later
From: Brendan McGrath bmcgrath@codeweavers.com
ASLR is supported only on Windows Vista and later --- dlls/ntdll/unix/virtual.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c index 75e6319c007..83f90a50929 100644 --- a/dlls/ntdll/unix/virtual.c +++ b/dlls/ntdll/unix/virtual.c @@ -3039,7 +3039,8 @@ static NTSTATUS virtual_map_image( HANDLE mapping, void **addr_ptr, SIZE_T *size return status; }
- if (!image_info->map_addr && + if (peb->OSMajorVersion > 5 && /* ASLR is supported only on Windows Vista and later */ + !image_info->map_addr && (image_info->image_charact & IMAGE_FILE_DLL) && (image_info->image_flags & IMAGE_FLAGS_ImageDynamicallyRelocated)) {
From: Brendan McGrath bmcgrath@codeweavers.com
These tests can pass if the VirtualAlloc succeeds via the anon_mmap_alloc path (which is not within the tests control) --- dlls/ntdll/tests/info.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/dlls/ntdll/tests/info.c b/dlls/ntdll/tests/info.c index 3cedca0d6ef..5382f708f9e 100644 --- a/dlls/ntdll/tests/info.c +++ b/dlls/ntdll/tests/info.c @@ -1925,7 +1925,8 @@ static void test_query_process_vm(void) ok( pvi.PrivateUsage == pvi.PagefileUsage, "wrong value %Iu/%Iu\n", pvi.PrivateUsage, pvi.PagefileUsage ); if (winetest_debug > 1) dump_vm_counters("VM counters after VirtualAlloc", &pvi); - todo_wine ok( pvi.VirtualSize >= prev_size + alloc_size, + /* this test (and the one marked flaky below) can pass if the VirtualAlloc succeeds via anon_mmap_alloc */ + flaky todo_wine ok( pvi.VirtualSize >= prev_size + alloc_size, "Expected to be greater than %Iu, got %Iu\n", prev_size + alloc_size, pvi.VirtualSize); VirtualFree( ptr, 0, MEM_RELEASE);
@@ -1942,7 +1943,7 @@ static void test_query_process_vm(void) ok( pvi.PrivateUsage == pvi.PagefileUsage, "wrong value %Iu/%Iu\n", pvi.PrivateUsage, pvi.PagefileUsage ); if (winetest_debug > 1) dump_vm_counters("VM counters after VirtualAlloc(MEM_RESERVE)", &pvi); - todo_wine ok( pvi.VirtualSize >= prev_size + alloc_size, + flaky todo_wine ok( pvi.VirtualSize >= prev_size + alloc_size, "Expected to be greater than %Iu, got %Iu\n", prev_size + alloc_size, pvi.VirtualSize); prev_size = pvi.VirtualSize;
Alexandre Julliard (@julliard) commented about dlls/ntdll/unix/virtual.c:
return status; }
- if (!image_info->map_addr &&
- if (peb->OSMajorVersion > 5 && /* ASLR is supported only on Windows Vista and later */
!image_info->map_addr && (image_info->image_charact & IMAGE_FILE_DLL) && (image_info->image_flags & IMAGE_FLAGS_ImageDynamicallyRelocated))
We don't do that kind of version checks in Wine. If it's truly necessary to disable ASLR we can implement the corresponding registry key.
This merge request was closed by Brendan McGrath.
Thanks Alexandre. I will close this MR and raise a new one when I've implemented the use of a registry key.