From 1785a5693497cbe43f4dae11252386d8d324872b Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Wed, 29 Apr 2020 17:16:09 +0300 Subject: [PATCH] Updated ntdll-NtSetLdtEntries patchset. Fixed a test failure. --- ...0001-ntdll-Implement-NtSetLdtEntries.patch | 22 +++++++++++++++---- ...Allow-to-modify-reserved-LDT-entries.patch | 18 +++++++-------- 2 files changed, 27 insertions(+), 13 deletions(-) diff --git a/patches/ntdll-NtSetLdtEntries/0001-ntdll-Implement-NtSetLdtEntries.patch b/patches/ntdll-NtSetLdtEntries/0001-ntdll-Implement-NtSetLdtEntries.patch index 0684b996..611b5ea6 100644 --- a/patches/ntdll-NtSetLdtEntries/0001-ntdll-Implement-NtSetLdtEntries.patch +++ b/patches/ntdll-NtSetLdtEntries/0001-ntdll-Implement-NtSetLdtEntries.patch @@ -1,14 +1,15 @@ -From 43e419ddc34cac7cf7754aed353fcbfb0bd9619e Mon Sep 17 00:00:00 2001 +From 8abf5d134499aaf9dc87daa657cfe87586ad8ded Mon Sep 17 00:00:00 2001 From: Dmitry Timoshkov Date: Thu, 28 Apr 2016 18:14:36 +0800 Subject: [PATCH] ntdll: Implement NtSetLdtEntries. --- dlls/kernel32/tests/thread.c | 79 ++++++++++++++++++++++++++++++++++++ - 1 file changed, 79 insertions(+) + dlls/ntdll/signal_i386.c | 2 +- + 2 files changed, 80 insertions(+), 1 deletion(-) diff --git a/dlls/kernel32/tests/thread.c b/dlls/kernel32/tests/thread.c -index e068797ff57..8c5148d4a92 100644 +index 2dd274e0c10..ae67a9aa0a0 100644 --- a/dlls/kernel32/tests/thread.c +++ b/dlls/kernel32/tests/thread.c @@ -99,6 +99,7 @@ static BOOL (WINAPI *pSetThreadGroupAffinity)(HANDLE,const GROUP_AFFINITY*,GROUP @@ -110,7 +111,7 @@ index e068797ff57..8c5148d4a92 100644 } #undef X } -@@ -2394,6 +2472,7 @@ START_TEST(thread) +@@ -2393,6 +2471,7 @@ START_TEST(thread) test_SetThreadContext(); test_GetThreadSelectorEntry(); test_GetThreadContext(); @@ -118,6 +119,19 @@ index e068797ff57..8c5148d4a92 100644 #endif test_QueueUserWorkItem(); test_RegisterWaitForSingleObject(); +diff --git a/dlls/ntdll/signal_i386.c b/dlls/ntdll/signal_i386.c +index 441ef579609..eb28d668279 100644 +--- a/dlls/ntdll/signal_i386.c ++++ b/dlls/ntdll/signal_i386.c +@@ -2533,7 +2533,7 @@ NTSTATUS get_thread_ldt_entry( HANDLE handle, void *data, ULONG len, ULONG *ret_ + if (reply->flags) + info->Entry = ldt_make_entry( (void *)reply->base, reply->limit, reply->flags ); + else +- status = STATUS_UNSUCCESSFUL; ++ status = STATUS_ACCESS_VIOLATION; + } + } + SERVER_END_REQ; -- 2.26.2 diff --git a/patches/ntdll-NtSetLdtEntries/0002-libs-wine-Allow-to-modify-reserved-LDT-entries.patch b/patches/ntdll-NtSetLdtEntries/0002-libs-wine-Allow-to-modify-reserved-LDT-entries.patch index 087781f9..90ee9995 100644 --- a/patches/ntdll-NtSetLdtEntries/0002-libs-wine-Allow-to-modify-reserved-LDT-entries.patch +++ b/patches/ntdll-NtSetLdtEntries/0002-libs-wine-Allow-to-modify-reserved-LDT-entries.patch @@ -1,4 +1,4 @@ -From 338f514f1468d77ae19ac9bbe7ba7d2b018ec83c Mon Sep 17 00:00:00 2001 +From c7ec3f3bd55bbe998a09097ad0dfbcc6df3392db Mon Sep 17 00:00:00 2001 From: Dmitry Timoshkov Date: Thu, 28 Apr 2016 17:01:16 +0200 Subject: [PATCH] libs/wine: Allow to modify reserved LDT entries. @@ -22,10 +22,10 @@ fails. 3 files changed, 1 insertion(+), 9 deletions(-) diff --git a/dlls/kernel32/tests/thread.c b/dlls/kernel32/tests/thread.c -index 70b22367e18..a454bf118cc 100644 +index ae67a9aa0a0..6149be8cf4a 100644 --- a/dlls/kernel32/tests/thread.c +++ b/dlls/kernel32/tests/thread.c -@@ -1325,16 +1325,12 @@ static void test_NtSetLdtEntries(void) +@@ -1339,16 +1339,12 @@ static void test_NtSetLdtEntries(void) { memset(&sel.entry, 0x9a, sizeof(sel.entry)); ret = GetThreadSelectorEntry(GetCurrentThread(), 0x000f, &sel.entry); @@ -43,10 +43,10 @@ index 70b22367e18..a454bf118cc 100644 } } diff --git a/dlls/ntdll/signal_i386.c b/dlls/ntdll/signal_i386.c -index 2db76f0e250..fd1a764dacf 100644 +index eb28d668279..9c629469843 100644 --- a/dlls/ntdll/signal_i386.c +++ b/dlls/ntdll/signal_i386.c -@@ -2614,8 +2614,6 @@ NTSTATUS get_thread_ldt_entry( HANDLE handle, void *data, ULONG len, ULONG *ret_ +@@ -2553,8 +2553,6 @@ NTSTATUS get_thread_ldt_entry( HANDLE handle, void *data, ULONG len, ULONG *ret_ NTSTATUS WINAPI NtSetLdtEntries( ULONG sel1, LDT_ENTRY entry1, ULONG sel2, LDT_ENTRY entry2 ) { if (sel1 >> 16 || sel2 >> 16) return STATUS_INVALID_LDT_DESCRIPTOR; @@ -56,10 +56,10 @@ index 2db76f0e250..fd1a764dacf 100644 ldt_lock(); if (sel1) ldt_set_entry( sel1, entry1 ); diff --git a/libs/wine/ldt.c b/libs/wine/ldt.c -index a8f4925019b..5e85c1137c8 100644 +index 18b0b9be9bf..30d9b945f73 100644 --- a/libs/wine/ldt.c +++ b/libs/wine/ldt.c -@@ -225,8 +225,6 @@ static int internal_set_entry( unsigned short sel, const LDT_ENTRY *entry ) +@@ -200,8 +200,6 @@ static int internal_set_entry( unsigned short sel, const LDT_ENTRY *entry ) { int ret = 0, index = sel >> 3; @@ -68,7 +68,7 @@ index a8f4925019b..5e85c1137c8 100644 #ifdef linux { struct modify_ldt_s ldt_info; -@@ -278,7 +276,7 @@ static int internal_set_entry( unsigned short sel, const LDT_ENTRY *entry ) +@@ -253,7 +251,7 @@ static int internal_set_entry( unsigned short sel, const LDT_ENTRY *entry ) wine_ldt_copy_obsolete.limit[index] = wine_ldt_get_limit(entry); wine_ldt_copy_obsolete.flags[index] = (entry->HighWord.Bits.Type | (entry->HighWord.Bits.Default_Big ? WINE_LDT_FLAGS_32BIT : 0) | @@ -78,5 +78,5 @@ index a8f4925019b..5e85c1137c8 100644 return ret; } -- -2.25.1 +2.26.2