From 6d4f5803c83218c863bf8b60d89db341e9b62ff9 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Sun, 29 Jan 2023 12:32:33 -0600 Subject: [PATCH] ntdll-Builtin_Prot: Remove patch set. Obviated by upstream commit 6b8cbfe3fd (and more generally full PE conversion finished in 60eeb92ae03). --- ...0001-ntdll-Fix-holes-in-ELF-mappings.patch | 90 ------------------- patches/ntdll-Builtin_Prot/definition | 2 - 2 files changed, 92 deletions(-) delete mode 100644 patches/ntdll-Builtin_Prot/0001-ntdll-Fix-holes-in-ELF-mappings.patch delete mode 100644 patches/ntdll-Builtin_Prot/definition diff --git a/patches/ntdll-Builtin_Prot/0001-ntdll-Fix-holes-in-ELF-mappings.patch b/patches/ntdll-Builtin_Prot/0001-ntdll-Fix-holes-in-ELF-mappings.patch deleted file mode 100644 index a6400660..00000000 --- a/patches/ntdll-Builtin_Prot/0001-ntdll-Fix-holes-in-ELF-mappings.patch +++ /dev/null @@ -1,90 +0,0 @@ -From 7acf9c0e6c7f4bf86b1946778366b529a42fa660 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Michael=20M=C3=BCller?= -Date: Thu, 1 Jun 2017 06:04:53 +0200 -Subject: [PATCH] ntdll: Fix holes in ELF mappings. (v2) - -Based on a patch by Andrew Wesie. ---- - dlls/ntdll/unix/virtual.c | 23 +++++++++++++++++++++++ - dlls/psapi/tests/psapi_main.c | 14 +++++++++++++- - 2 files changed, 36 insertions(+), 1 deletion(-) - -diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c -index 0c1c91750ea..c4fcf43543f 100644 ---- a/dlls/ntdll/unix/virtual.c -+++ b/dlls/ntdll/unix/virtual.c -@@ -1210,6 +1210,16 @@ static inline BOOL is_write_watch_range( const void *addr, size_t size ) - } - - -+/*********************************************************************** -+ * is_system_range -+ */ -+static inline BOOL is_system_range( const void *addr, size_t size ) -+{ -+ struct file_view *view = find_view( addr, size ); -+ return view && (view->protect & VPROT_SYSTEM); -+} -+ -+ - /*********************************************************************** - * find_view_range - * -@@ -3416,6 +3426,19 @@ NTSTATUS virtual_handle_fault( void *addr, DWORD err, void *stack ) - /* ignore fault if page is writable now */ - if (get_unix_prot( get_page_vprot( page ) ) & PROT_WRITE) ret = STATUS_SUCCESS; - } -+ else if (!err && (get_unix_prot( vprot ) & PROT_READ) && is_system_range( page, page_size )) -+ { -+ int unix_prot = get_unix_prot( vprot ); -+ unsigned char vec; -+ -+ mprotect_range( page, page_size, 0, 0 ); -+ if (!mincore( page, page_size, &vec ) && (vec & 1)) -+ ret = STATUS_SUCCESS; -+ else if (anon_mmap_fixed( page, page_size, unix_prot, 0 ) == page) -+ ret = STATUS_SUCCESS; -+ else -+ set_page_vprot_bits( page, page_size, 0, VPROT_READ | VPROT_EXEC ); -+ } - mutex_unlock( &virtual_mutex ); - return ret; - } -diff --git a/dlls/psapi/tests/psapi_main.c b/dlls/psapi/tests/psapi_main.c -index 519e39c3df0..c29168646e8 100644 ---- a/dlls/psapi/tests/psapi_main.c -+++ b/dlls/psapi/tests/psapi_main.c -@@ -194,6 +194,7 @@ static void test_EnumProcessModules(void) - static void test_GetModuleInformation(void) - { - HMODULE hMod = GetModuleHandleA(NULL); -+ DWORD *tmp, counter = 0; - MODULEINFO info; - DWORD ret; - -@@ -213,10 +214,21 @@ static void test_GetModuleInformation(void) - GetModuleInformation(hpQV, hMod, &info, sizeof(info)-1); - ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "expected error=ERROR_INSUFFICIENT_BUFFER but got %ld\n", GetLastError()); - -- SetLastError(0xdeadbeef); - ret = GetModuleInformation(hpQV, hMod, &info, sizeof(info)); - ok(ret == 1, "failed with %ld\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: %lu\n", GetLastError()); -+ -+ ret = GetModuleInformation(hpQV, hMod, &info, sizeof(info)); -+ ok(ret == 1, "failed with %lu\n", GetLastError()); -+ info.SizeOfImage /= sizeof(DWORD); -+ for (tmp = (DWORD *)hMod; info.SizeOfImage; info.SizeOfImage--) -+ counter ^= *tmp++; -+ trace("xor of shell32: %08lx\n", counter); -+ -+ FreeLibrary(hMod); - } - - static BOOL check_with_margin(SIZE_T perf, SIZE_T sysperf, int margin) --- -2.34.1 - diff --git a/patches/ntdll-Builtin_Prot/definition b/patches/ntdll-Builtin_Prot/definition deleted file mode 100644 index 226c297c..00000000 --- a/patches/ntdll-Builtin_Prot/definition +++ /dev/null @@ -1,2 +0,0 @@ -Fixes: [44650] Fix holes in ELF mappings -Depends: ntdll-WRITECOPY