diff options
| author | ptitSeb <sebastien.chev@gmail.com> | 2025-01-17 12:24:10 +0100 |
|---|---|---|
| committer | ptitSeb <sebastien.chev@gmail.com> | 2025-01-17 12:24:10 +0100 |
| commit | 21c0a2e7d762c4b42f80f8ee87a43bb99f510e0a (patch) | |
| tree | 87fc6ca9a2785f6b1d160320d0870d7258c1380b /src/emu | |
| parent | 03204f709e4586ae0a9950f3e6a7e1158b4a3f66 (diff) | |
| download | box64-21c0a2e7d762c4b42f80f8ee87a43bb99f510e0a.tar.gz box64-21c0a2e7d762c4b42f80f8ee87a43bb99f510e0a.zip | |
Added some hack to simulate seccomp/bpf Windows syscalls handling in proton
Diffstat (limited to 'src/emu')
| -rw-r--r-- | src/emu/x64syscall.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/emu/x64syscall.c b/src/emu/x64syscall.c index ee3e7a8c..a912afcb 100644 --- a/src/emu/x64syscall.c +++ b/src/emu/x64syscall.c @@ -34,6 +34,7 @@ #include "callback.h" #include "signals.h" #include "x64tls.h" +#include "elfloader.h" typedef struct x64_sigaction_s x64_sigaction_t; typedef struct x64_stack_s x64_stack_t; @@ -294,6 +295,7 @@ static const scwrap_t syscallwrap[] = { //[317] = {__NR_seccomp, 3}, [318] = {__NR_getrandom, 3}, [319] = {__NR_memfd_create, 2}, + //[323] = {__NR_userfaultfd, 1}, //disable for now [324] = {__NR_membarrier, 2}, #ifdef __NR_copy_file_range // TODO: call back if unavailable? @@ -432,6 +434,16 @@ void EXPORT x64Syscall(x64emu_t *emu) { RESET_FLAGS(emu); uint32_t s = R_EAX; // EAX? (syscalls only go up to 547 anyways) + // check if it's a wine process, then filter the syscall (simulate SECCMP) + if(box64_wine && !box64_is32bits) { + //64bits only here... + uintptr_t ret_addr = R_RIP-2; + if(ret_addr<0x700000000000LL && (my_context->signals[SIGSYS]>2) && !FindElfAddress(my_context, ret_addr)) { + // not a linux elf, not a syscall to setup x86_64 arch. Signal SIGSYS + emit_signal(emu, SIGSYS, (void*)ret_addr, R_EAX&0xffff); // what are the parameters? + return; + } + } int log = 0; char t_buff[256] = "\0"; char t_buffret[128] = "\0"; |