Update and reenable ntdll-Syscall_Emulation patchset.

This commit is contained in:
Paul Gofman 2021-08-27 12:57:53 +03:00
parent 6f3825b11f
commit 66c0fdc159
3 changed files with 38 additions and 11 deletions

View File

@ -1,19 +1,19 @@
From 39a48f5e0d94090a9461705feeb30759b366fc4d Mon Sep 17 00:00:00 2001
From 30a823033f450475796b7d24a757ef3b00be46fa Mon Sep 17 00:00:00 2001
From: Paul Gofman <pgofman@codeweavers.com>
Date: Tue, 14 Jul 2020 15:00:34 +0300
Subject: [PATCH] ntdll: Support x86_64 syscall emulation.
---
configure.ac | 1 +
dlls/ntdll/unix/signal_x86_64.c | 117 ++++++++++++++++++++++++++++++++
dlls/ntdll/unix/signal_x86_64.c | 122 ++++++++++++++++++++++++++++++++
tools/winebuild/import.c | 3 +-
3 files changed, 119 insertions(+), 2 deletions(-)
3 files changed, 124 insertions(+), 2 deletions(-)
diff --git a/configure.ac b/configure.ac
index ffd92c988ac..58d95ff6df3 100644
index 4b03c869d5e0..477266b8ba80 100644
--- a/configure.ac
+++ b/configure.ac
@@ -481,6 +481,7 @@ AC_CHECK_HEADERS(\
@@ -487,6 +487,7 @@ AC_CHECK_HEADERS(\
linux/joystick.h \
linux/major.h \
linux/param.h \
@ -22,7 +22,7 @@ index ffd92c988ac..58d95ff6df3 100644
linux/types.h \
linux/ucdrom.h \
diff --git a/dlls/ntdll/unix/signal_x86_64.c b/dlls/ntdll/unix/signal_x86_64.c
index da548eb1a49..82e07eb25cf 100644
index da548eb1a492..2fb3eab73594 100644
--- a/dlls/ntdll/unix/signal_x86_64.c
+++ b/dlls/ntdll/unix/signal_x86_64.c
@@ -28,6 +28,7 @@
@ -47,7 +47,7 @@ index da548eb1a49..82e07eb25cf 100644
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
#include "ntstatus.h"
@@ -2426,6 +2434,114 @@ static inline DWORD is_privileged_instr( CONTEXT *context )
@@ -2426,6 +2434,118 @@ static inline DWORD is_privileged_instr( CONTEXT *context )
return 0;
}
@ -123,12 +123,16 @@ index da548eb1a49..82e07eb25cf 100644
+ BPF_STMT(BPF_RET | BPF_K, SECCOMP_RET_TRAP),
+ BPF_STMT(BPF_RET | BPF_K, SECCOMP_RET_ALLOW),
+ };
+ struct syscall_frame *frame = amd64_thread_data()->syscall_frame;
+ struct sock_fprog prog;
+ NTSTATUS status;
+
+ sig_act->sa_sigaction = sigsys_handler;
+ sigaction(SIGSYS, sig_act, NULL);
+
+ frame->syscall_flags = syscall_flags;
+ frame->syscall_table = KeServiceDescriptorTable;
+
+ if ((status = syscall(0xffff)) == STATUS_INVALID_PARAMETER)
+ {
+ TRACE("Seccomp filters already installed.\n");
@ -162,7 +166,7 @@ index da548eb1a49..82e07eb25cf 100644
/***********************************************************************
* handle_interrupt
@@ -3004,6 +3120,7 @@ void signal_init_process(void)
@@ -3004,6 +3124,7 @@ void signal_init_process(void)
if (sigaction( SIGSEGV, &sig_act, NULL ) == -1) goto error;
if (sigaction( SIGILL, &sig_act, NULL ) == -1) goto error;
if (sigaction( SIGBUS, &sig_act, NULL ) == -1) goto error;
@ -170,8 +174,16 @@ index da548eb1a49..82e07eb25cf 100644
return;
error:
@@ -3222,6 +3343,7 @@ __ASM_GLOBAL_FUNC( __wine_syscall_dispatcher,
"leaq 0x28(%rsp),%rsi\n\t" /* first argument */
"movq %rcx,%rsp\n\t"
"movq 0x00(%rcx),%rax\n\t"
+ "subq $0xf000,%rax\n\t"
"movq 0x18(%rcx),%rdx\n\t"
"movl %eax,%ebx\n\t"
"shrl $8,%ebx\n\t"
diff --git a/tools/winebuild/import.c b/tools/winebuild/import.c
index 6a158578143..dc04a321474 100644
index 6a1585781431..dc04a3214749 100644
--- a/tools/winebuild/import.c
+++ b/tools/winebuild/import.c
@@ -1419,7 +1419,6 @@ static int cmp_link_name( const void *e1, const void *e2 )
@ -192,5 +204,5 @@ index 6a158578143..dc04a321474 100644
output( "\t.byte 0x75,0x03\n" ); /* jne 1f */
output( "\t.byte 0x0f,0x05\n" ); /* syscall */
--
2.32.0
2.31.1

View File

@ -1,2 +1 @@
Fixes: [48291] Detroit: Become Human crashes on launch
Disabled: True

View File

@ -166,6 +166,7 @@ patch_enable_all ()
enable_ntdll_RtlFirstFreeAce="$1"
enable_ntdll_RtlQueryPackageIdentity="$1"
enable_ntdll_Serial_Port_Detection="$1"
enable_ntdll_Syscall_Emulation="$1"
enable_ntdll_WRITECOPY="$1"
enable_ntdll_Zero_mod_name="$1"
enable_ntdll_ext4_case_folder="$1"
@ -537,6 +538,9 @@ patch_enable ()
ntdll-Serial_Port_Detection)
enable_ntdll_Serial_Port_Detection="$2"
;;
ntdll-Syscall_Emulation)
enable_ntdll_Syscall_Emulation="$2"
;;
ntdll-WRITECOPY)
enable_ntdll_WRITECOPY="$2"
;;
@ -2759,6 +2763,18 @@ if test "$enable_ntdll_Serial_Port_Detection" -eq 1; then
patch_apply ntdll-Serial_Port_Detection/0001-ntdll-Do-a-device-check-before-returning-a-default-s.patch
fi
# Patchset ntdll-Syscall_Emulation
# |
# | This patchset fixes the following Wine bugs:
# | * [#48291] Detroit: Become Human crashes on launch
# |
# | Modified files:
# | * configure.ac, dlls/ntdll/unix/signal_x86_64.c, tools/winebuild/import.c
# |
if test "$enable_ntdll_Syscall_Emulation" -eq 1; then
patch_apply ntdll-Syscall_Emulation/0001-ntdll-Support-x86_64-syscall-emulation.patch
fi
# Patchset ntdll-Zero_mod_name
# |
# | Modified files: