[PATCH] ntdll: Avoid overwriting parameters with context in call_user_apc_dispatcher() on x86.
Paul Gofman
pgofman at codeweavers.com
Thu Nov 12 08:10:52 CST 2020
Fixes crash in 32 bit kernel32 file test. The crash is not always reproducible
as the issue depends on stack layout.
Signed-off-by: Paul Gofman <pgofman at codeweavers.com>
---
dlls/kernel32/tests/file.c | 4 ++++
dlls/ntdll/unix/signal_i386.c | 11 +++++++----
2 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/dlls/kernel32/tests/file.c b/dlls/kernel32/tests/file.c
index 2814ab194b2..1a47910fb52 100644
--- a/dlls/kernel32/tests/file.c
+++ b/dlls/kernel32/tests/file.c
@@ -5759,6 +5759,7 @@ START_TEST(file)
ret = DeleteFileA(filename);
ok(ret != 0, "DeleteFile error %u\n", GetLastError());
+if(1){
test__hread( );
test__hwrite( );
test__lclose( );
@@ -5813,7 +5814,9 @@ START_TEST(file)
test_GetFinalPathNameByHandleW();
test_SetFileInformationByHandle();
test_GetFileAttributesExW();
+}
test_post_completion();
+if(0){
test_overlapped_read();
test_file_readonly_access();
test_find_file_stream();
@@ -5822,3 +5825,4 @@ START_TEST(file)
test_hard_link();
test_move_file();
}
+}
diff --git a/dlls/ntdll/unix/signal_i386.c b/dlls/ntdll/unix/signal_i386.c
index 4d8eeb2072c..58b79940773 100644
--- a/dlls/ntdll/unix/signal_i386.c
+++ b/dlls/ntdll/unix/signal_i386.c
@@ -1688,15 +1688,18 @@ __ASM_GLOBAL_FUNC( call_user_apc_dispatcher,
"movl %esp,%ebx\n\t"
"cmpl %esp,%esi\n\t"
"cmovbl %esi,%esp\n\t"
+ "pushl 20(%ebx)\n\t" /* func */
+ "pushl 16(%ebx)\n\t" /* arg2 */
+ "pushl 12(%ebx)\n\t" /* arg1 */
+ "movl 8(%ebx),%ebx\n\t" /* ctx */
"movl $0x00010007,(%esi)\n\t" /* context.ContextFlags = CONTEXT_FULL */
"pushl %esi\n\t" /* context */
"pushl $0xfffffffe\n\t"
"call " __ASM_STDCALL("NtGetContextThread",8) "\n\t"
"movl $0xc0,0xb0(%esi)\n" /* context.Eax = STATUS_USER_APC */
- "movl 20(%ebx),%eax\n\t" /* func */
- "movl 16(%ebx),%ecx\n\t" /* arg2 */
- "movl 12(%ebx),%edx\n\t" /* arg1 */
- "movl 8(%ebx),%ebx\n\t" /* ctx */
+ "popl %edx\n\t"
+ "popl %ecx\n\t"
+ "popl %eax\n\t"
"leal -20(%esi),%esp\n\t"
"movl %eax,16(%esp)\n" /* func */
"2:\tmovl %ecx,12(%esp)\n\t" /* arg2 */
--
2.28.0
More information about the wine-devel
mailing list