-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rebase (incl. upstream 'fshack'); refine fsync opts again; sign release packages
- Loading branch information
Showing
33 changed files
with
1,266 additions
and
1,049 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
From 15b196ca5869c5734b26882f47d333d7b8bbc5f8 Mon Sep 17 00:00:00 2001 | ||
From 09d95bb505ff8ea4b893fc9364b9ea8b7ee9cd23 Mon Sep 17 00:00:00 2001 | ||
From: Paul Gofman <[email protected]> | ||
Date: Mon, 23 Sep 2024 21:09:39 -0600 | ||
Subject: [PATCH] ntdll/tests: Add tests for NtSetInformationProcess( | ||
|
@@ -10,10 +10,10 @@ Subject: [PATCH] ntdll/tests: Add tests for NtSetInformationProcess( | |
2 files changed, 309 insertions(+) | ||
|
||
diff --git a/dlls/ntdll/tests/info.c b/dlls/ntdll/tests/info.c | ||
index b2a373ce1b3..d379ad5c152 100644 | ||
index 7741293d815..12b785dbc22 100644 | ||
--- a/dlls/ntdll/tests/info.c | ||
+++ b/dlls/ntdll/tests/info.c | ||
@@ -4080,6 +4080,279 @@ static void test_processor_idle_cycle_time(void) | ||
@@ -4087,6 +4087,279 @@ static void test_processor_idle_cycle_time(void) | ||
ok( size == cpu_count * sizeof(*buffer), "got %#lx.\n", size ); | ||
} | ||
|
||
|
@@ -293,17 +293,17 @@ index b2a373ce1b3..d379ad5c152 100644 | |
START_TEST(info) | ||
{ | ||
char **argv; | ||
@@ -4160,4 +4433,5 @@ START_TEST(info) | ||
@@ -4167,4 +4440,5 @@ START_TEST(info) | ||
test_process_token(argc, argv); | ||
test_process_id(); | ||
test_processor_idle_cycle_time(); | ||
+ test_set_process_tls_info(); | ||
} | ||
diff --git a/include/winternl.h b/include/winternl.h | ||
index 4f24a921bb1..0f3abe1ccfb 100644 | ||
index bc3ef12bc0d..d3496157783 100644 | ||
--- a/include/winternl.h | ||
+++ b/include/winternl.h | ||
@@ -2653,6 +2653,41 @@ typedef struct _PROCESS_CYCLE_TIME_INFORMATION { | ||
@@ -2668,6 +2668,41 @@ typedef struct _PROCESS_CYCLE_TIME_INFORMATION { | ||
ULONGLONG CurrentCycleCount; | ||
} PROCESS_CYCLE_TIME_INFORMATION, *PPROCESS_CYCLE_TIME_INFORMATION; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
From 345b3433ccab0f54c769a72f53cc419ea15be6fb Mon Sep 17 00:00:00 2001 | ||
From 4e851a71c70ed4af0ec8200bd221b3a29e5873cf Mon Sep 17 00:00:00 2001 | ||
From: Paul Gofman <[email protected]> | ||
Date: Tue, 17 Sep 2024 15:01:54 -0600 | ||
Subject: [PATCH] ntdll: Implement NtSetInformationProcess( | ||
|
@@ -14,10 +14,10 @@ Subject: [PATCH] ntdll: Implement NtSetInformationProcess( | |
6 files changed, 181 insertions(+), 5 deletions(-) | ||
|
||
diff --git a/dlls/ntdll/tests/info.c b/dlls/ntdll/tests/info.c | ||
index d379ad5c152..1a3c866980f 100644 | ||
index 12b785dbc22..c3971d13b7e 100644 | ||
--- a/dlls/ntdll/tests/info.c | ||
+++ b/dlls/ntdll/tests/info.c | ||
@@ -4132,19 +4132,18 @@ static void test_set_process_tls_info(void) | ||
@@ -4139,19 +4139,18 @@ static void test_set_process_tls_info(void) | ||
offsetof(PROCESS_TLS_INFORMATION, ThreadData[tlsinfo->ThreadDataCount])); | ||
if (wow) | ||
{ | ||
|
@@ -42,10 +42,10 @@ index d379ad5c152..1a3c866980f 100644 | |
/* Other PROCESS_TLS_INFORMATION flags are invalid. STATUS_INFO_LENGTH_MISMATCH is weird but that's for any flag | ||
* besides 1. */ | ||
diff --git a/dlls/ntdll/unix/process.c b/dlls/ntdll/unix/process.c | ||
index f5c230e9dc1..d8ef0dde6bb 100644 | ||
index ec585fe2d6c..8b14140b1da 100644 | ||
--- a/dlls/ntdll/unix/process.c | ||
+++ b/dlls/ntdll/unix/process.c | ||
@@ -1649,6 +1649,33 @@ NTSTATUS WINAPI NtSetInformationProcess( HANDLE handle, PROCESSINFOCLASS class, | ||
@@ -1711,6 +1711,33 @@ NTSTATUS WINAPI NtSetInformationProcess( HANDLE handle, PROCESSINFOCLASS class, | ||
process_error_mode = *(UINT *)info; | ||
break; | ||
|
||
|
@@ -92,10 +92,10 @@ index 8815f174de9..dc41804ee03 100644 | |
SIZE_T reserve_size, SIZE_T commit_size, BOOL guard_page ); | ||
extern void virtual_map_user_shared_data(void); | ||
diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c | ||
index e168eed8c37..320a4e08f70 100644 | ||
index 684a58a724b..93d71b2030c 100644 | ||
--- a/dlls/ntdll/unix/virtual.c | ||
+++ b/dlls/ntdll/unix/virtual.c | ||
@@ -3870,6 +3870,98 @@ NTSTATUS virtual_clear_tls_index( ULONG index ) | ||
@@ -3874,6 +3874,98 @@ NTSTATUS virtual_clear_tls_index( ULONG index ) | ||
} | ||
|
||
|
||
|
@@ -195,10 +195,10 @@ index e168eed8c37..320a4e08f70 100644 | |
* virtual_alloc_thread_stack | ||
*/ | ||
diff --git a/dlls/wow64/process.c b/dlls/wow64/process.c | ||
index 653422a5013..3af4c3a5267 100644 | ||
index 0153dba3433..fb21e2dabc9 100644 | ||
--- a/dlls/wow64/process.c | ||
+++ b/dlls/wow64/process.c | ||
@@ -893,6 +893,39 @@ NTSTATUS WINAPI wow64_NtSetInformationProcess( UINT *args ) | ||
@@ -894,6 +894,39 @@ NTSTATUS WINAPI wow64_NtSetInformationProcess( UINT *args ) | ||
} | ||
else return STATUS_INVALID_PARAMETER; | ||
|
||
|
@@ -236,7 +236,7 @@ index 653422a5013..3af4c3a5267 100644 | |
+ } | ||
+ | ||
case ProcessInstrumentationCallback: /* PROCESS_INSTRUMENTATION_CALLBACK_INFORMATION */ | ||
if (len >= sizeof(void *)) | ||
if (len >= sizeof(ULONG)) | ||
{ | ||
diff --git a/dlls/wow64/struct32.h b/dlls/wow64/struct32.h | ||
index fe2bbc758ee..c8588bd4f4a 100644 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
From b113938572c9c15d32d62e3a579ced0496b69eab Mon Sep 17 00:00:00 2001 | ||
From b2573ee1a2258924bfa040cf826cacc6f66ff7d2 Mon Sep 17 00:00:00 2001 | ||
From: Paul Gofman <[email protected]> | ||
Date: Mon, 23 Sep 2024 19:38:54 -0600 | ||
Subject: [PATCH] ntdll: Use NtSetInformationProcess( ProcessTlsInformation ) | ||
|
@@ -9,18 +9,18 @@ Subject: [PATCH] ntdll: Use NtSetInformationProcess( ProcessTlsInformation ) | |
1 file changed, 55 insertions(+), 43 deletions(-) | ||
|
||
diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c | ||
index 0ed37ad390c..aa3ac83cbb5 100644 | ||
index 38516115b38..617b0143b6d 100644 | ||
--- a/dlls/ntdll/loader.c | ||
+++ b/dlls/ntdll/loader.c | ||
@@ -139,6 +139,7 @@ typedef struct _wine_modref | ||
@@ -142,6 +142,7 @@ typedef struct _wine_modref | ||
|
||
static UINT tls_module_count = 32; /* number of modules with TLS directory */ | ||
static IMAGE_TLS_DIRECTORY *tls_dirs; /* array of TLS directories */ | ||
+static ULONG tls_thread_count; /* number of threads for which ThreadLocalStoragePointer is allocated in TEB. */ | ||
|
||
static RTL_CRITICAL_SECTION loader_section; | ||
static RTL_CRITICAL_SECTION_DEBUG critsect_debug = | ||
@@ -1332,10 +1333,10 @@ static BOOL is_dll_native_subsystem( LDR_DATA_TABLE_ENTRY *mod, const IMAGE_NT_H | ||
@@ -1341,10 +1342,10 @@ static BOOL is_dll_native_subsystem( LDR_DATA_TABLE_ENTRY *mod, const IMAGE_NT_H | ||
static BOOL alloc_tls_slot( LDR_DATA_TABLE_ENTRY *mod ) | ||
{ | ||
const IMAGE_TLS_DIRECTORY *dir; | ||
|
@@ -33,7 +33,7 @@ index 0ed37ad390c..aa3ac83cbb5 100644 | |
|
||
if (!(dir = RtlImageDirectoryEntryToData( mod->DllBase, TRUE, IMAGE_DIRECTORY_ENTRY_TLS, &size ))) | ||
return FALSE; | ||
@@ -1364,57 +1365,66 @@ static BOOL alloc_tls_slot( LDR_DATA_TABLE_ENTRY *mod ) | ||
@@ -1373,57 +1374,66 @@ static BOOL alloc_tls_slot( LDR_DATA_TABLE_ENTRY *mod ) | ||
tls_dirs = new_ptr; | ||
tls_module_count = new_count; | ||
} | ||
|
@@ -141,15 +141,15 @@ index 0ed37ad390c..aa3ac83cbb5 100644 | |
return TRUE; | ||
} | ||
|
||
@@ -1646,6 +1656,7 @@ static NTSTATUS alloc_thread_tls(void) | ||
@@ -1656,6 +1666,7 @@ static NTSTATUS alloc_thread_tls(void) | ||
|
||
TRACE( "slot %u: %u/%lu bytes at %p\n", i, size, dir->SizeOfZeroFill, pointers[i] ); | ||
} | ||
+ ++tls_thread_count; | ||
NtCurrentTeb()->ThreadLocalStoragePointer = pointers; | ||
#ifdef __x86_64__ /* macOS-specific hack */ | ||
if (NtCurrentTeb()->Instrumentation[0]) | ||
@@ -3930,6 +3941,7 @@ void WINAPI LdrShutdownThread(void) | ||
@@ -3947,6 +3958,7 @@ void WINAPI LdrShutdownThread(void) | ||
if ((pointers = NtCurrentTeb()->ThreadLocalStoragePointer)) | ||
{ | ||
NtCurrentTeb()->ThreadLocalStoragePointer = NULL; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,19 @@ | ||
From 40c541416374161e9825fb265ad2cd60d04cccef Mon Sep 17 00:00:00 2001 | ||
From 466786a1fb3715caee11a0499f2d4bb2e0219c51 Mon Sep 17 00:00:00 2001 | ||
From: Paul Gofman <[email protected]> | ||
Date: Mon, 23 Sep 2024 20:51:44 -0600 | ||
Subject: [PATCH] ntdll: Match memory allocation layout for | ||
ThreadLocalStoragePointer. | ||
|
||
--- | ||
dlls/kernel32/tests/module.c | 73 +++++++++++++++++++++++++----------- | ||
dlls/ntdll/loader.c | 51 +++++++++++++++++++------ | ||
2 files changed, 92 insertions(+), 32 deletions(-) | ||
dlls/kernel32/tests/module.c | 23 ++++++++++++++++ | ||
dlls/ntdll/loader.c | 51 ++++++++++++++++++++++++++++-------- | ||
2 files changed, 63 insertions(+), 11 deletions(-) | ||
|
||
diff --git a/dlls/kernel32/tests/module.c b/dlls/kernel32/tests/module.c | ||
index 4b4269c821b..93878a9bd22 100644 | ||
index 0619ce5f747..3d6e195e23c 100644 | ||
--- a/dlls/kernel32/tests/module.c | ||
+++ b/dlls/kernel32/tests/module.c | ||
@@ -141,6 +141,34 @@ static void create_test_dll( const char *name ) | ||
CloseHandle( handle ); | ||
} | ||
|
||
+static BOOL is_old_loader_struct(void) | ||
+{ | ||
+ LDR_DATA_TABLE_ENTRY *mod, *mod2; | ||
+ LDR_DDAG_NODE *ddag_node; | ||
+ NTSTATUS status; | ||
+ HMODULE hexe; | ||
+ | ||
+ /* Check for old LDR data strcuture. */ | ||
+ hexe = GetModuleHandleW( NULL ); | ||
+ ok( !!hexe, "Got NULL exe handle.\n" ); | ||
+ status = LdrFindEntryForAddress( hexe, &mod ); | ||
+ ok( !status, "got %#lx.\n", status ); | ||
+ if (!(ddag_node = mod->DdagNode)) | ||
+ { | ||
+ win_skip( "DdagNode is NULL, skipping tests.\n" ); | ||
+ return TRUE; | ||
+ } | ||
+ ok( !!ddag_node->Modules.Flink, "Got NULL module link.\n" ); | ||
+ mod2 = CONTAINING_RECORD(ddag_node->Modules.Flink, LDR_DATA_TABLE_ENTRY, NodeModuleLink); | ||
+ ok( mod2 == mod || broken( (void **)mod2 == (void **)mod - 1 ), "got %p, expected %p.\n", mod2, mod ); | ||
+ if (mod2 != mod) | ||
+ { | ||
+ win_skip( "Old LDR_DATA_TABLE_ENTRY structure, skipping tests.\n" ); | ||
+ return TRUE; | ||
+ } | ||
+ return FALSE; | ||
+} | ||
+ | ||
static void testGetModuleFileName(const char* name) | ||
{ | ||
HMODULE hMod; | ||
@@ -1641,7 +1669,10 @@ static void test_tls_links(void) | ||
@@ -1708,7 +1708,10 @@ static void test_tls_links(void) | ||
TEB *teb = NtCurrentTeb(), *thread_teb; | ||
THREAD_BASIC_INFORMATION tbi; | ||
NTSTATUS status; | ||
|
@@ -59,7 +24,7 @@ index 4b4269c821b..93878a9bd22 100644 | |
|
||
ok(!!teb->ThreadLocalStoragePointer, "got NULL.\n"); | ||
|
||
@@ -1661,6 +1692,26 @@ static void test_tls_links(void) | ||
@@ -1728,6 +1731,26 @@ static void test_tls_links(void) | ||
ResumeThread(thread); | ||
WaitForSingleObject(test_tls_links_started, INFINITE); | ||
|
||
|
@@ -86,42 +51,11 @@ index 4b4269c821b..93878a9bd22 100644 | |
ok(!!thread_teb->ThreadLocalStoragePointer, "got NULL.\n"); | ||
ok(!teb->TlsLinks.Flink, "got %p.\n", teb->TlsLinks.Flink); | ||
ok(!teb->TlsLinks.Blink, "got %p.\n", teb->TlsLinks.Blink); | ||
@@ -1714,29 +1765,9 @@ static void test_base_address_index_tree(void) | ||
unsigned int tree_count, list_count = 0; | ||
LDR_DATA_TABLE_ENTRY *mod, *mod2; | ||
RTL_BALANCED_NODE *root, *node; | ||
- LDR_DDAG_NODE *ddag_node; | ||
- NTSTATUS status; | ||
- HMODULE hexe; | ||
char *base; | ||
|
||
- /* Check for old LDR data strcuture. */ | ||
- hexe = GetModuleHandleW( NULL ); | ||
- ok( !!hexe, "Got NULL exe handle.\n" ); | ||
- status = LdrFindEntryForAddress( hexe, &mod ); | ||
- ok( !status, "got %#lx.\n", status ); | ||
- if (!(ddag_node = mod->DdagNode)) | ||
- { | ||
- win_skip( "DdagNode is NULL, skipping tests.\n" ); | ||
- return; | ||
- } | ||
- ok( !!ddag_node->Modules.Flink, "Got NULL module link.\n" ); | ||
- mod2 = CONTAINING_RECORD(ddag_node->Modules.Flink, LDR_DATA_TABLE_ENTRY, NodeModuleLink); | ||
- ok( mod2 == mod || broken( (void **)mod2 == (void **)mod - 1 ), "got %p, expected %p.\n", mod2, mod ); | ||
- if (mod2 != mod) | ||
- { | ||
- win_skip( "Old LDR_DATA_TABLE_ENTRY structure, skipping tests.\n" ); | ||
- return; | ||
- } | ||
+ if (is_old_loader_struct()) return; | ||
|
||
mod = CONTAINING_RECORD(first->Flink, LDR_DATA_TABLE_ENTRY, InLoadOrderLinks); | ||
ok( mod->BaseAddressIndexNode.ParentValue || mod->BaseAddressIndexNode.Left || mod->BaseAddressIndexNode.Right, | ||
diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c | ||
index aa3ac83cbb5..6322aff1711 100644 | ||
index 617b0143b6d..5c9c9e4e923 100644 | ||
--- a/dlls/ntdll/loader.c | ||
+++ b/dlls/ntdll/loader.c | ||
@@ -1324,6 +1324,36 @@ static BOOL is_dll_native_subsystem( LDR_DATA_TABLE_ENTRY *mod, const IMAGE_NT_H | ||
@@ -1333,6 +1333,36 @@ static BOOL is_dll_native_subsystem( LDR_DATA_TABLE_ENTRY *mod, const IMAGE_NT_H | ||
return TRUE; | ||
} | ||
|
||
|
@@ -158,7 +92,7 @@ index aa3ac83cbb5..6322aff1711 100644 | |
/************************************************************************* | ||
* alloc_tls_slot | ||
* | ||
@@ -1390,13 +1420,13 @@ static BOOL alloc_tls_slot( LDR_DATA_TABLE_ENTRY *mod ) | ||
@@ -1399,13 +1429,13 @@ static BOOL alloc_tls_slot( LDR_DATA_TABLE_ENTRY *mod ) | ||
|
||
t->ThreadData[j].Flags = 0; | ||
|
||
|
@@ -174,7 +108,7 @@ index aa3ac83cbb5..6322aff1711 100644 | |
if (!vector) return FALSE; | ||
t->ThreadData[j].TlsVector = vector; | ||
vector[i] = new_ptr; | ||
@@ -1416,12 +1446,12 @@ static BOOL alloc_tls_slot( LDR_DATA_TABLE_ENTRY *mod ) | ||
@@ -1425,12 +1455,12 @@ static BOOL alloc_tls_slot( LDR_DATA_TABLE_ENTRY *mod ) | ||
{ | ||
/* There could be fewer active threads than we counted here due to force terminated threads, first | ||
* free extra TLS directory data set in the new TLS vector. */ | ||
|
@@ -189,7 +123,7 @@ index aa3ac83cbb5..6322aff1711 100644 | |
} | ||
} | ||
RtlFreeHeap( GetProcessHeap(), 0, t ); | ||
@@ -1633,8 +1663,7 @@ static NTSTATUS alloc_thread_tls(void) | ||
@@ -1643,8 +1673,7 @@ static NTSTATUS alloc_thread_tls(void) | ||
void **pointers; | ||
UINT i, size; | ||
|
||
|
@@ -199,7 +133,7 @@ index aa3ac83cbb5..6322aff1711 100644 | |
return STATUS_NO_MEMORY; | ||
|
||
for (i = 0; i < tls_module_count; i++) | ||
@@ -1645,10 +1674,10 @@ static NTSTATUS alloc_thread_tls(void) | ||
@@ -1655,10 +1684,10 @@ static NTSTATUS alloc_thread_tls(void) | ||
size = dir->EndAddressOfRawData - dir->StartAddressOfRawData; | ||
if (!size && !dir->SizeOfZeroFill) continue; | ||
|
||
|
@@ -213,7 +147,7 @@ index aa3ac83cbb5..6322aff1711 100644 | |
return STATUS_NO_MEMORY; | ||
} | ||
memcpy( pointers[i], (void *)dir->StartAddressOfRawData, size ); | ||
@@ -3946,8 +3975,8 @@ void WINAPI LdrShutdownThread(void) | ||
@@ -3963,8 +3992,8 @@ void WINAPI LdrShutdownThread(void) | ||
if (NtCurrentTeb()->Instrumentation[0]) | ||
((TEB *)NtCurrentTeb()->Instrumentation[0])->ThreadLocalStoragePointer = NULL; | ||
#endif | ||
|
Oops, something went wrong.