[PATCH 0/2] MR4535: ntdll: Don't perform ASLR on XP and earlier
ASLR is supported only on Windows Vista and later -- https://gitlab.winehq.org/wine/wine/-/merge_requests/4535
From: Brendan McGrath <bmcgrath(a)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)) { -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/4535
From: Brendan McGrath <bmcgrath(a)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; -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/4535
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. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/4535#note_54303
This merge request was closed by Brendan McGrath. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/4535
Thanks Alexandre. I will close this MR and raise a new one when I've implemented the use of a registry key. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/4535#note_54520
participants (3)
-
Alexandre Julliard (@julliard) -
Brendan McGrath -
Brendan McGrath (@redmcg)