mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2024-09-13 09:17:20 -07:00
Added patch to fix holes in ELF mappings.
This commit is contained in:
parent
8881e4710a
commit
ee5545a45f
@ -0,0 +1,66 @@
|
||||
From e0fb74b49f8004fb6d6f027c09f4adb4212c5644 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
|
||||
Date: Thu, 1 Jun 2017 06:04:53 +0200
|
||||
Subject: ntdll: Fix holes in ELF mappings.
|
||||
|
||||
Based on a patch by Andrew Wesie.
|
||||
---
|
||||
dlls/ntdll/virtual.c | 6 ++++++
|
||||
dlls/psapi/tests/psapi_main.c | 14 +++++++++++++-
|
||||
2 files changed, 19 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c
|
||||
index 3a280a4b0d8..bd1c53247b9 100644
|
||||
--- a/dlls/ntdll/virtual.c
|
||||
+++ b/dlls/ntdll/virtual.c
|
||||
@@ -1598,6 +1598,12 @@ NTSTATUS virtual_handle_fault( LPCVOID addr, DWORD err, BOOL on_signal_stack )
|
||||
/* ignore fault if page is readable now */
|
||||
if (VIRTUAL_GetUnixProt( *vprot ) & PROT_READ) ret = STATUS_SUCCESS;
|
||||
}
|
||||
+ else if ((view->protect & VPROT_SYSTEM) && (VIRTUAL_GetUnixProt( *vprot ) & PROT_READ))
|
||||
+ {
|
||||
+ /* ignore fault if page can be made readable */
|
||||
+ if (VIRTUAL_SetProt( view, page, page_size, *vprot )) ret = STATUS_SUCCESS;
|
||||
+ else *vprot &= ~VPROT_READ; /* don't bother to call VIRTUAL_SetProt again */
|
||||
+ }
|
||||
if (!on_signal_stack && (*vprot & VPROT_GUARD))
|
||||
{
|
||||
VIRTUAL_SetProt( view, page, page_size, *vprot & ~VPROT_GUARD );
|
||||
diff --git a/dlls/psapi/tests/psapi_main.c b/dlls/psapi/tests/psapi_main.c
|
||||
index dd592a9ab21..8704123642e 100644
|
||||
--- a/dlls/psapi/tests/psapi_main.c
|
||||
+++ b/dlls/psapi/tests/psapi_main.c
|
||||
@@ -152,6 +152,7 @@ static void test_EnumProcessModules(void)
|
||||
static void test_GetModuleInformation(void)
|
||||
{
|
||||
HMODULE hMod = GetModuleHandleA(NULL);
|
||||
+ DWORD *tmp, counter = 0;
|
||||
MODULEINFO info;
|
||||
DWORD ret;
|
||||
|
||||
@@ -171,10 +172,21 @@ static void test_GetModuleInformation(void)
|
||||
pGetModuleInformation(hpQV, hMod, &info, sizeof(info)-1);
|
||||
ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "expected error=ERROR_INSUFFICIENT_BUFFER but got %d\n", GetLastError());
|
||||
|
||||
- SetLastError(0xdeadbeef);
|
||||
ret = pGetModuleInformation(hpQV, hMod, &info, sizeof(info));
|
||||
ok(ret == 1, "failed with %d\n", GetLastError());
|
||||
ok(info.lpBaseOfDll == hMod, "lpBaseOfDll=%p hMod=%p\n", info.lpBaseOfDll, hMod);
|
||||
+
|
||||
+ hMod = LoadLibraryA("shell32.dll");
|
||||
+ ok(hMod != NULL, "Failed to load shell32.dll, error: %u\n", GetLastError());
|
||||
+
|
||||
+ ret = pGetModuleInformation(hpQV, hMod, &info, sizeof(info));
|
||||
+ ok(ret == 1, "failed with %d\n", GetLastError());
|
||||
+ info.SizeOfImage /= sizeof(DWORD);
|
||||
+ for (tmp = (DWORD *)hMod; info.SizeOfImage; info.SizeOfImage--)
|
||||
+ counter ^= *tmp++;
|
||||
+ trace("xor of shell32: %08x\n", counter);
|
||||
+
|
||||
+ FreeLibrary(hMod);
|
||||
}
|
||||
|
||||
static BOOL check_with_margin(SIZE_T perf, SIZE_T sysperf, int margin)
|
||||
--
|
||||
2.13.1
|
||||
|
2
patches/ntdll-Builtin_Prot/definition
Normal file
2
patches/ntdll-Builtin_Prot/definition
Normal file
@ -0,0 +1,2 @@
|
||||
Fixes: Fix holes in ELF mappings
|
||||
Depends: ntdll-User_Shared_Data
|
@ -223,6 +223,7 @@ patch_enable_all ()
|
||||
enable_ntdll_ApiSetMap="$1"
|
||||
enable_ntdll_ApiSetQueryApiSetPresence="$1"
|
||||
enable_ntdll_Attach_Process_DLLs="$1"
|
||||
enable_ntdll_Builtin_Prot="$1"
|
||||
enable_ntdll_CLI_Images="$1"
|
||||
enable_ntdll_DOS_Attributes="$1"
|
||||
enable_ntdll_Dealloc_Thread_Stack="$1"
|
||||
@ -910,6 +911,9 @@ patch_enable ()
|
||||
ntdll-Attach_Process_DLLs)
|
||||
enable_ntdll_Attach_Process_DLLs="$2"
|
||||
;;
|
||||
ntdll-Builtin_Prot)
|
||||
enable_ntdll_Builtin_Prot="$2"
|
||||
;;
|
||||
ntdll-CLI_Images)
|
||||
enable_ntdll_CLI_Images="$2"
|
||||
;;
|
||||
@ -2343,13 +2347,6 @@ if test "$enable_ntdll_WRITECOPY" -eq 1; then
|
||||
enable_ws2_32_WriteWatches=1
|
||||
fi
|
||||
|
||||
if test "$enable_ntdll_User_Shared_Data" -eq 1; then
|
||||
if test "$enable_ntdll_Hide_Wine_Exports" -gt 1; then
|
||||
abort "Patchset ntdll-Hide_Wine_Exports disabled, but ntdll-User_Shared_Data depends on that."
|
||||
fi
|
||||
enable_ntdll_Hide_Wine_Exports=1
|
||||
fi
|
||||
|
||||
if test "$enable_ntdll_SystemRoot_Symlink" -eq 1; then
|
||||
if test "$enable_ntdll_Exception" -gt 1; then
|
||||
abort "Patchset ntdll-Exception disabled, but ntdll-SystemRoot_Symlink depends on that."
|
||||
@ -2413,17 +2410,6 @@ if test "$enable_ntdll_NtQueryEaFile" -eq 1; then
|
||||
enable_kernel32_SetFileCompletionNotificationModes=1
|
||||
fi
|
||||
|
||||
if test "$enable_ntdll_Hide_Wine_Exports" -eq 1; then
|
||||
if test "$enable_ntdll_Attach_Process_DLLs" -gt 1; then
|
||||
abort "Patchset ntdll-Attach_Process_DLLs disabled, but ntdll-Hide_Wine_Exports depends on that."
|
||||
fi
|
||||
if test "$enable_ntdll_ThreadTime" -gt 1; then
|
||||
abort "Patchset ntdll-ThreadTime disabled, but ntdll-Hide_Wine_Exports depends on that."
|
||||
fi
|
||||
enable_ntdll_Attach_Process_DLLs=1
|
||||
enable_ntdll_ThreadTime=1
|
||||
fi
|
||||
|
||||
if test "$enable_ntdll_HashLinks" -eq 1; then
|
||||
if test "$enable_ntdll_CLI_Images" -gt 1; then
|
||||
abort "Patchset ntdll-CLI_Images disabled, but ntdll-HashLinks depends on that."
|
||||
@ -2457,6 +2443,31 @@ if test "$enable_ntdll_CLI_Images" -eq 1; then
|
||||
enable_mscoree_CorValidateImage=1
|
||||
fi
|
||||
|
||||
if test "$enable_ntdll_Builtin_Prot" -eq 1; then
|
||||
if test "$enable_ntdll_User_Shared_Data" -gt 1; then
|
||||
abort "Patchset ntdll-User_Shared_Data disabled, but ntdll-Builtin_Prot depends on that."
|
||||
fi
|
||||
enable_ntdll_User_Shared_Data=1
|
||||
fi
|
||||
|
||||
if test "$enable_ntdll_User_Shared_Data" -eq 1; then
|
||||
if test "$enable_ntdll_Hide_Wine_Exports" -gt 1; then
|
||||
abort "Patchset ntdll-Hide_Wine_Exports disabled, but ntdll-User_Shared_Data depends on that."
|
||||
fi
|
||||
enable_ntdll_Hide_Wine_Exports=1
|
||||
fi
|
||||
|
||||
if test "$enable_ntdll_Hide_Wine_Exports" -eq 1; then
|
||||
if test "$enable_ntdll_Attach_Process_DLLs" -gt 1; then
|
||||
abort "Patchset ntdll-Attach_Process_DLLs disabled, but ntdll-Hide_Wine_Exports depends on that."
|
||||
fi
|
||||
if test "$enable_ntdll_ThreadTime" -gt 1; then
|
||||
abort "Patchset ntdll-ThreadTime disabled, but ntdll-Hide_Wine_Exports depends on that."
|
||||
fi
|
||||
enable_ntdll_Attach_Process_DLLs=1
|
||||
enable_ntdll_ThreadTime=1
|
||||
fi
|
||||
|
||||
if test "$enable_ntdll_ApiSetMap" -eq 1; then
|
||||
if test "$enable_ntdll_ThreadTime" -gt 1; then
|
||||
abort "Patchset ntdll-ThreadTime disabled, but ntdll-ApiSetMap depends on that."
|
||||
@ -5606,6 +5617,64 @@ if test "$enable_ntdll_Attach_Process_DLLs" -eq 1; then
|
||||
) >> "$patchlist"
|
||||
fi
|
||||
|
||||
# Patchset ntdll-Hide_Wine_Exports
|
||||
# |
|
||||
# | This patchset has the following (direct or indirect) dependencies:
|
||||
# | * ntdll-Attach_Process_DLLs, ntdll-ThreadTime
|
||||
# |
|
||||
# | This patchset fixes the following Wine bugs:
|
||||
# | * [#38656] Add support for hiding wine version information from applications
|
||||
# |
|
||||
# | Modified files:
|
||||
# | * dlls/ntdll/loader.c, dlls/ntdll/ntdll_misc.h
|
||||
# |
|
||||
if test "$enable_ntdll_Hide_Wine_Exports" -eq 1; then
|
||||
patch_apply ntdll-Hide_Wine_Exports/0001-ntdll-Add-support-for-hiding-wine-version-informatio.patch
|
||||
(
|
||||
printf '%s\n' '+ { "Sebastian Lackner", "ntdll: Add support for hiding wine version information from applications.", 1 },';
|
||||
) >> "$patchlist"
|
||||
fi
|
||||
|
||||
# Patchset ntdll-User_Shared_Data
|
||||
# |
|
||||
# | This patchset has the following (direct or indirect) dependencies:
|
||||
# | * ntdll-Attach_Process_DLLs, ntdll-ThreadTime, ntdll-Hide_Wine_Exports
|
||||
# |
|
||||
# | This patchset fixes the following Wine bugs:
|
||||
# | * [#29168] Update user shared data at realtime
|
||||
# |
|
||||
# | Modified files:
|
||||
# | * dlls/kernel32/cpu.c, dlls/ntdll/loader.c, dlls/ntdll/ntdll.spec, dlls/ntdll/ntdll_misc.h, dlls/ntdll/tests/time.c,
|
||||
# | dlls/ntdll/thread.c, dlls/ntdll/virtual.c, dlls/ntoskrnl.exe/instr.c
|
||||
# |
|
||||
if test "$enable_ntdll_User_Shared_Data" -eq 1; then
|
||||
patch_apply ntdll-User_Shared_Data/0001-ntdll-Move-code-to-update-user-shared-data-into-a-se.patch
|
||||
patch_apply ntdll-User_Shared_Data/0002-ntoskrnl-Update-USER_SHARED_DATA-before-accessing-me.patch
|
||||
patch_apply ntdll-User_Shared_Data/0003-ntdll-Create-thread-to-update-user_shared_data-time-.patch
|
||||
patch_apply ntdll-User_Shared_Data/0004-ntdll-tests-Test-updating-TickCount-in-user_shared_d.patch
|
||||
(
|
||||
printf '%s\n' '+ { "Sebastian Lackner", "ntdll: Move code to update user shared data into a separate function.", 1 },';
|
||||
printf '%s\n' '+ { "Sebastian Lackner", "ntoskrnl: Update USER_SHARED_DATA before accessing memory.", 1 },';
|
||||
printf '%s\n' '+ { "Michael Müller", "ntdll: Create thread to update user_shared_data time values when necessary.", 1 },';
|
||||
printf '%s\n' '+ { "Andrew Wesie", "ntdll/tests: Test updating TickCount in user_shared_data.", 1 },';
|
||||
) >> "$patchlist"
|
||||
fi
|
||||
|
||||
# Patchset ntdll-Builtin_Prot
|
||||
# |
|
||||
# | This patchset has the following (direct or indirect) dependencies:
|
||||
# | * ntdll-Attach_Process_DLLs, ntdll-ThreadTime, ntdll-Hide_Wine_Exports, ntdll-User_Shared_Data
|
||||
# |
|
||||
# | Modified files:
|
||||
# | * dlls/ntdll/virtual.c, dlls/psapi/tests/psapi_main.c
|
||||
# |
|
||||
if test "$enable_ntdll_Builtin_Prot" -eq 1; then
|
||||
patch_apply ntdll-Builtin_Prot/0001-ntdll-Fix-holes-in-ELF-mappings.patch
|
||||
(
|
||||
printf '%s\n' '+ { "Michael Müller", "ntdll: Fix holes in ELF mappings.", 1 },';
|
||||
) >> "$patchlist"
|
||||
fi
|
||||
|
||||
# Patchset ntdll-CLI_Images
|
||||
# |
|
||||
# | This patchset has the following (direct or indirect) dependencies:
|
||||
@ -5814,24 +5883,6 @@ if test "$enable_ntdll_Heap_FreeLists" -eq 1; then
|
||||
) >> "$patchlist"
|
||||
fi
|
||||
|
||||
# Patchset ntdll-Hide_Wine_Exports
|
||||
# |
|
||||
# | This patchset has the following (direct or indirect) dependencies:
|
||||
# | * ntdll-Attach_Process_DLLs, ntdll-ThreadTime
|
||||
# |
|
||||
# | This patchset fixes the following Wine bugs:
|
||||
# | * [#38656] Add support for hiding wine version information from applications
|
||||
# |
|
||||
# | Modified files:
|
||||
# | * dlls/ntdll/loader.c, dlls/ntdll/ntdll_misc.h
|
||||
# |
|
||||
if test "$enable_ntdll_Hide_Wine_Exports" -eq 1; then
|
||||
patch_apply ntdll-Hide_Wine_Exports/0001-ntdll-Add-support-for-hiding-wine-version-informatio.patch
|
||||
(
|
||||
printf '%s\n' '+ { "Sebastian Lackner", "ntdll: Add support for hiding wine version information from applications.", 1 },';
|
||||
) >> "$patchlist"
|
||||
fi
|
||||
|
||||
# Patchset ntdll-Interrupt-0x2e
|
||||
# |
|
||||
# | This patchset fixes the following Wine bugs:
|
||||
@ -6337,31 +6388,6 @@ if test "$enable_ntdll_TokenLogonSid" -eq 1; then
|
||||
) >> "$patchlist"
|
||||
fi
|
||||
|
||||
# Patchset ntdll-User_Shared_Data
|
||||
# |
|
||||
# | This patchset has the following (direct or indirect) dependencies:
|
||||
# | * ntdll-Attach_Process_DLLs, ntdll-ThreadTime, ntdll-Hide_Wine_Exports
|
||||
# |
|
||||
# | This patchset fixes the following Wine bugs:
|
||||
# | * [#29168] Update user shared data at realtime
|
||||
# |
|
||||
# | Modified files:
|
||||
# | * dlls/kernel32/cpu.c, dlls/ntdll/loader.c, dlls/ntdll/ntdll.spec, dlls/ntdll/ntdll_misc.h, dlls/ntdll/tests/time.c,
|
||||
# | dlls/ntdll/thread.c, dlls/ntdll/virtual.c, dlls/ntoskrnl.exe/instr.c
|
||||
# |
|
||||
if test "$enable_ntdll_User_Shared_Data" -eq 1; then
|
||||
patch_apply ntdll-User_Shared_Data/0001-ntdll-Move-code-to-update-user-shared-data-into-a-se.patch
|
||||
patch_apply ntdll-User_Shared_Data/0002-ntoskrnl-Update-USER_SHARED_DATA-before-accessing-me.patch
|
||||
patch_apply ntdll-User_Shared_Data/0003-ntdll-Create-thread-to-update-user_shared_data-time-.patch
|
||||
patch_apply ntdll-User_Shared_Data/0004-ntdll-tests-Test-updating-TickCount-in-user_shared_d.patch
|
||||
(
|
||||
printf '%s\n' '+ { "Sebastian Lackner", "ntdll: Move code to update user shared data into a separate function.", 1 },';
|
||||
printf '%s\n' '+ { "Sebastian Lackner", "ntoskrnl: Update USER_SHARED_DATA before accessing memory.", 1 },';
|
||||
printf '%s\n' '+ { "Michael Müller", "ntdll: Create thread to update user_shared_data time values when necessary.", 1 },';
|
||||
printf '%s\n' '+ { "Andrew Wesie", "ntdll/tests: Test updating TickCount in user_shared_data.", 1 },';
|
||||
) >> "$patchlist"
|
||||
fi
|
||||
|
||||
# Patchset ws2_32-WriteWatches
|
||||
# |
|
||||
# | Modified files:
|
||||
|
Loading…
Reference in New Issue
Block a user