Updated ntdll-Syscall_Emulation patchset.

This commit is contained in:
Paul Gofman 2020-12-16 12:08:17 +03:00
parent 53bbade133
commit 7dbce711de

View File

@ -1,4 +1,4 @@
From 6eace1f9bc0c49f8e38ff5ead9aa3aa0b83e0d87 Mon Sep 17 00:00:00 2001
From 375a86a401828569803cde23143b024c72eb9383 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.
@ -10,10 +10,10 @@ Subject: [PATCH] ntdll: Support x86_64 syscall emulation.
3 files changed, 120 insertions(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index fe8549784e2a..2168f9089f5c 100644
index 553b4c3df98e..d3b04ae90a04 100644
--- a/configure.ac
+++ b/configure.ac
@@ -467,6 +467,7 @@ AC_CHECK_HEADERS(\
@@ -465,6 +465,7 @@ AC_CHECK_HEADERS(\
linux/joystick.h \
linux/major.h \
linux/param.h \
@ -22,7 +22,7 @@ index fe8549784e2a..2168f9089f5c 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 cd386096cd41..c8071e7f4e20 100644
index 925de00545f7..6502a15592b6 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 cd386096cd41..c8071e7f4e20 100644
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
#include "ntstatus.h"
@@ -2224,6 +2232,114 @@ static inline DWORD is_privileged_instr( CONTEXT *context )
@@ -2238,6 +2246,114 @@ static inline DWORD is_privileged_instr( CONTEXT *context )
return 0;
}
@ -146,13 +146,13 @@ index cd386096cd41..c8071e7f4e20 100644
+
+ if (prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0))
+ {
+ perror("prctl(PR_SET_NO_NEW_PRIVS, ...)");
+ exit(1);
+ ERR("prctl(PR_SET_NO_NEW_PRIVS, ...): %s.\n", strerror(errno));
+ return;
+ }
+ if (sc_seccomp(SECCOMP_SET_MODE_FILTER, flags, &prog))
+ {
+ perror("prctl(PR_SET_SECCOMP, ...)");
+ exit(1);
+ ERR("prctl(PR_SET_SECCOMP, ...): %s.\n", strerror(errno));
+ return;
+ }
+ check_bpf_jit_enable();
+#else
@ -162,7 +162,7 @@ index cd386096cd41..c8071e7f4e20 100644
/***********************************************************************
* handle_interrupt
@@ -2711,6 +2827,7 @@ void signal_init_process(void)
@@ -2725,6 +2841,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;
@ -171,10 +171,10 @@ index cd386096cd41..c8071e7f4e20 100644
error:
diff --git a/tools/winebuild/import.c b/tools/winebuild/import.c
index 673141321585..86721d61f6bc 100644
index fb5c26da07f9..2c2606b21e56 100644
--- a/tools/winebuild/import.c
+++ b/tools/winebuild/import.c
@@ -1525,6 +1525,7 @@ void output_syscalls( DLLSPEC *spec )
@@ -1524,6 +1524,7 @@ void output_syscalls( DLLSPEC *spec )
/* Legends of Runeterra hooks the first system call return instruction, and
* depends on us returning to it. Adjust the return address accordingly. */
output( "\tsubq $0xb,0x8(%%rbp)\n" );
@ -182,7 +182,7 @@ index 673141321585..86721d61f6bc 100644
output( "\tmovq %%rsp,0x328(%%rcx)\n" ); /* amd64_thread_data()->syscall_frame */
output( "\tcmpq $%u,%%rax\n", count );
output( "\tjae 4f\n" );
@@ -1718,7 +1719,7 @@ void output_syscalls( DLLSPEC *spec )
@@ -1717,7 +1718,7 @@ void output_syscalls( DLLSPEC *spec )
* validate that instruction, we can just put a jmp there instead. */
output( "\t.byte 0x4c,0x8b,0xd1\n" ); /* movq %rcx,%r10 */
output( "\t.byte 0xb8\n" ); /* movl $i,%eax */
@ -192,5 +192,5 @@ index 673141321585..86721d61f6bc 100644
output( "\t.byte 0x75,0x03\n" ); /* jne 1f */
output( "\t.byte 0x0f,0x05\n" ); /* syscall */
--
2.28.0
2.29.2