diff options
| author | ptitSeb <sebastien.chev@gmail.com> | 2022-12-30 15:51:57 +0100 |
|---|---|---|
| committer | ptitSeb <sebastien.chev@gmail.com> | 2022-12-30 15:51:57 +0100 |
| commit | c821fd938c26348165844653868b986ca37c1c2a (patch) | |
| tree | e56436c10187f909d7235cd980cf482f8d2ac627 /src | |
| parent | 977caba4cac60f40edf867f0f353ce78625d83e2 (diff) | |
| download | box64-c821fd938c26348165844653868b986ca37c1c2a.tar.gz box64-c821fd938c26348165844653868b986ca37c1c2a.zip | |
Disable SECCOMP and added a bunch of wrapped function (partially fixed Heroic launcher)
Diffstat (limited to 'src')
| -rwxr-xr-x | src/dynarec/dynarec.c | 7 | ||||
| -rwxr-xr-x | src/emu/x64syscall.c | 7 | ||||
| -rw-r--r-- | src/wrapped/generated/functions_list.txt | 20 | ||||
| -rw-r--r-- | src/wrapped/generated/wrappedlibctypes.h | 3 | ||||
| -rw-r--r-- | src/wrapped/generated/wrappedlzmatypes.h | 12 | ||||
| -rw-r--r-- | src/wrapped/generated/wrapper.c | 12 | ||||
| -rw-r--r-- | src/wrapped/generated/wrapper.h | 5 | ||||
| -rwxr-xr-x | src/wrapped/wrappedlibc.c | 10 | ||||
| -rwxr-xr-x | src/wrapped/wrappedlibc_private.h | 27 | ||||
| -rwxr-xr-x | src/wrapped/wrappedlibpthread_private.h | 3 | ||||
| -rwxr-xr-x | src/wrapped/wrappedlibxcb_private.h | 2 | ||||
| -rwxr-xr-x | src/wrapped/wrappedlzma.c | 56 | ||||
| -rwxr-xr-x | src/wrapped/wrappedlzma_private.h | 24 |
13 files changed, 160 insertions, 28 deletions
diff --git a/src/dynarec/dynarec.c b/src/dynarec/dynarec.c index 920bfaa8..24d1d1b3 100755 --- a/src/dynarec/dynarec.c +++ b/src/dynarec/dynarec.c @@ -22,6 +22,9 @@ #include "bridge.h" #include "dynarec_next.h" #endif +#ifdef HAVE_TRACE +#include "elfloader.h" +#endif #ifdef DYNAREC uintptr_t getX64Address(dynablock_t* db, uintptr_t arm_addr); @@ -40,6 +43,7 @@ void* LinkNext(x64emu_t* emu, uintptr_t addr, void* x2, uintptr_t* x3) // no block, let link table as is... if(hasAlternate((void*)addr)) { printf_log(LOG_DEBUG, "Jmp address has alternate: %p", (void*)addr); + if(box64_log<LOG_DEBUG) dynarec_log(LOG_INFO, "Jmp address has alternate: %p", (void*)addr); addr = (uintptr_t)getAlternate((void*)addr); // set new address R_RIP = addr; // but also new RIP! *x3 = addr; // and the RIP in x27 register @@ -49,7 +53,8 @@ void* LinkNext(x64emu_t* emu, uintptr_t addr, void* x2, uintptr_t* x3) if(!block) { #ifdef HAVE_TRACE dynablock_t* db = FindDynablockFromNativeAddress(x2-4); - dynarec_log(LOG_INFO, "Warning, jumping to a no-block address %p from %p (db=%p, x64addr=%p)\n", (void*)addr, x2-4, db, db?(void*)getX64Address(db, (uintptr_t)x2-4):NULL); + elfheader_t* h = FindElfAddress(my_context, (uintptr_t)x2-4); + dynarec_log(LOG_INFO, "Warning, jumping to a no-block address %p from %p (db=%p, x64addr=%p(elf=%s))\n", (void*)addr, x2-4, db, db?(void*)getX64Address(db, (uintptr_t)x2-4):NULL, h?ElfName(h):"(none)"); #endif //tableupdate(native_epilog, addr, table); return native_epilog; diff --git a/src/emu/x64syscall.c b/src/emu/x64syscall.c index 65e30bbe..9ef54b46 100755 --- a/src/emu/x64syscall.c +++ b/src/emu/x64syscall.c @@ -235,7 +235,7 @@ scwrap_t syscallwrap[] = { { 302, __NR_prlimit64, 4}, { 309, __NR_getcpu, 3}, // need wrapping? { 315, __NR_sched_getattr, 4}, - { 317, __NR_seccomp, 3}, + //{ 317, __NR_seccomp, 3}, { 318, __NR_getrandom, 3}, { 319, __NR_memfd_create, 2}, { 324, __NR_membarrier, 2}, @@ -697,6 +697,9 @@ void EXPORT x64Syscall(x64emu_t *emu) R_RAX = (uint64_t)-errno; break; #endif + case 317: // sys_seccomp + R_RAX = 0; // ignoring call + break; case 334: // It is helpeful to run static binary R_RAX = -ENOSYS; break; @@ -941,6 +944,8 @@ uintptr_t EXPORT my_syscall(x64emu_t *emu) return (uint64_t)(int64_t)my_epoll_pwait(emu, (int)R_ESI, (void*)R_RDX, (int)R_ECX, (int)R_R8d, (void*)R_R9); break; #endif + case 317: // sys_seccomp + return 0; // ignoring call #ifndef __NR_fchmodat4 case 434: return (int)fchmodat((int)R_ESI, (void*)R_RDX, (mode_t)R_RCX, (int)R_R8d); diff --git a/src/wrapped/generated/functions_list.txt b/src/wrapped/generated/functions_list.txt index 5be9252d..e5032981 100644 --- a/src/wrapped/generated/functions_list.txt +++ b/src/wrapped/generated/functions_list.txt @@ -356,6 +356,7 @@ #() iFEUU #() iFELp #() iFEpi +#() iFEpU #() iFEpL #() iFEpp #() iFEpV @@ -728,6 +729,7 @@ #() iFEpip #() iFEpiV #() iFEpiA +#() iFEpui #() iFEpup #() iFEpUi #() iFEpUp @@ -760,6 +762,7 @@ #() iFipii #() iFipip #() iFipui +#() iFipuu #() iFipup #() iFipLi #() iFipLu @@ -1165,6 +1168,7 @@ #() iFEppiA #() iFEpplp #() iFEpppi +#() iFEpppL #() iFEpppp #() iFEpppV #() iFiiipu @@ -1199,6 +1203,7 @@ #() iFpiuwp #() iFpiUUU #() iFpipii +#() iFpipiu #() iFpipiL #() iFpipip #() iFpippi @@ -2996,8 +3001,10 @@ wrappedlibc: - execv - execvp - lstat + - lstat64 - sigaltstack - stat + - stat64 - swapcontext - iFpV: - __isoc99_scanf @@ -3110,6 +3117,7 @@ wrappedlibc: - epoll_wait - iFippi: - fstatat + - fstatat64 - iFippL: - readlinkat - iFpipp: @@ -3606,8 +3614,20 @@ wrappedlibz: wrappedlzma: - vFpp: - lzma_index_end +- iFpU: + - lzma_alone_decoder +- iFpp: + - lzma_alone_encoder + - lzma_raw_decoder + - lzma_raw_encoder +- iFpui: + - lzma_easy_encoder - iFpUi: - lzma_stream_decoder +- iFppi: + - lzma_stream_encoder +- iFpppL: + - lzma_properties_decode - iFpppppL: - lzma_index_buffer_decode - iFpupppLppL: diff --git a/src/wrapped/generated/wrappedlibctypes.h b/src/wrapped/generated/wrappedlibctypes.h index d27b57b8..37b2fb8b 100644 --- a/src/wrapped/generated/wrappedlibctypes.h +++ b/src/wrapped/generated/wrappedlibctypes.h @@ -132,8 +132,10 @@ typedef int64_t (*iFppipppp_t)(void*, void*, int64_t, void*, void*, void*, void* GO(execv, iFpp_t) \ GO(execvp, iFpp_t) \ GO(lstat, iFpp_t) \ + GO(lstat64, iFpp_t) \ GO(sigaltstack, iFpp_t) \ GO(stat, iFpp_t) \ + GO(stat64, iFpp_t) \ GO(swapcontext, iFpp_t) \ GO(__isoc99_scanf, iFpV_t) \ GO(execl, iFpV_t) \ @@ -214,6 +216,7 @@ typedef int64_t (*iFppipppp_t)(void*, void*, int64_t, void*, void*, void*, void* GO(semctl, iFiiiN_t) \ GO(epoll_wait, iFipii_t) \ GO(fstatat, iFippi_t) \ + GO(fstatat64, iFippi_t) \ GO(readlinkat, iFippL_t) \ GO(__vasprintf_chk, iFpipp_t) \ GO(glob, iFpipp_t) \ diff --git a/src/wrapped/generated/wrappedlzmatypes.h b/src/wrapped/generated/wrappedlzmatypes.h index b2e0af77..b61a5bf9 100644 --- a/src/wrapped/generated/wrappedlzmatypes.h +++ b/src/wrapped/generated/wrappedlzmatypes.h @@ -12,13 +12,25 @@ #endif typedef void (*vFpp_t)(void*, void*); +typedef int64_t (*iFpU_t)(void*, uint64_t); +typedef int64_t (*iFpp_t)(void*, void*); +typedef int64_t (*iFpui_t)(void*, uint64_t, int64_t); typedef int64_t (*iFpUi_t)(void*, uint64_t, int64_t); +typedef int64_t (*iFppi_t)(void*, void*, int64_t); +typedef int64_t (*iFpppL_t)(void*, void*, void*, uintptr_t); typedef int64_t (*iFpppppL_t)(void*, void*, void*, void*, void*, uintptr_t); typedef int64_t (*iFpupppLppL_t)(void*, uint64_t, void*, void*, void*, uintptr_t, void*, void*, uintptr_t); #define SUPER() ADDED_FUNCTIONS() \ GO(lzma_index_end, vFpp_t) \ + GO(lzma_alone_decoder, iFpU_t) \ + GO(lzma_alone_encoder, iFpp_t) \ + GO(lzma_raw_decoder, iFpp_t) \ + GO(lzma_raw_encoder, iFpp_t) \ + GO(lzma_easy_encoder, iFpui_t) \ GO(lzma_stream_decoder, iFpUi_t) \ + GO(lzma_stream_encoder, iFppi_t) \ + GO(lzma_properties_decode, iFpppL_t) \ GO(lzma_index_buffer_decode, iFpppppL_t) \ GO(lzma_stream_buffer_decode, iFpupppLppL_t) diff --git a/src/wrapped/generated/wrapper.c b/src/wrapped/generated/wrapper.c index 89e285b8..3bc9d90c 100644 --- a/src/wrapped/generated/wrapper.c +++ b/src/wrapped/generated/wrapper.c @@ -390,6 +390,7 @@ typedef int64_t (*iFEup_t)(x64emu_t*, uint64_t, void*); typedef int64_t (*iFEUU_t)(x64emu_t*, uint64_t, uint64_t); typedef int64_t (*iFELp_t)(x64emu_t*, uintptr_t, void*); typedef int64_t (*iFEpi_t)(x64emu_t*, void*, int64_t); +typedef int64_t (*iFEpU_t)(x64emu_t*, void*, uint64_t); typedef int64_t (*iFEpL_t)(x64emu_t*, void*, uintptr_t); typedef int64_t (*iFEpp_t)(x64emu_t*, void*, void*); typedef int64_t (*iFEpV_t)(x64emu_t*, void*, void*); @@ -762,6 +763,7 @@ typedef int64_t (*iFEpii_t)(x64emu_t*, void*, int64_t, int64_t); typedef int64_t (*iFEpip_t)(x64emu_t*, void*, int64_t, void*); typedef int64_t (*iFEpiV_t)(x64emu_t*, void*, int64_t, void*); typedef int64_t (*iFEpiA_t)(x64emu_t*, void*, int64_t, void*); +typedef int64_t (*iFEpui_t)(x64emu_t*, void*, uint64_t, int64_t); typedef int64_t (*iFEpup_t)(x64emu_t*, void*, uint64_t, void*); typedef int64_t (*iFEpUi_t)(x64emu_t*, void*, uint64_t, int64_t); typedef int64_t (*iFEpUp_t)(x64emu_t*, void*, uint64_t, void*); @@ -794,6 +796,7 @@ typedef int64_t (*iFillu_t)(int64_t, intptr_t, intptr_t, uint64_t); typedef int64_t (*iFipii_t)(int64_t, void*, int64_t, int64_t); typedef int64_t (*iFipip_t)(int64_t, void*, int64_t, void*); typedef int64_t (*iFipui_t)(int64_t, void*, uint64_t, int64_t); +typedef int64_t (*iFipuu_t)(int64_t, void*, uint64_t, uint64_t); typedef int64_t (*iFipup_t)(int64_t, void*, uint64_t, void*); typedef int64_t (*iFipLi_t)(int64_t, void*, uintptr_t, int64_t); typedef int64_t (*iFipLu_t)(int64_t, void*, uintptr_t, uint64_t); @@ -1199,6 +1202,7 @@ typedef int64_t (*iFEppiV_t)(x64emu_t*, void*, void*, int64_t, void*); typedef int64_t (*iFEppiA_t)(x64emu_t*, void*, void*, int64_t, void*); typedef int64_t (*iFEpplp_t)(x64emu_t*, void*, void*, intptr_t, void*); typedef int64_t (*iFEpppi_t)(x64emu_t*, void*, void*, void*, int64_t); +typedef int64_t (*iFEpppL_t)(x64emu_t*, void*, void*, void*, uintptr_t); typedef int64_t (*iFEpppp_t)(x64emu_t*, void*, void*, void*, void*); typedef int64_t (*iFEpppV_t)(x64emu_t*, void*, void*, void*, void*); typedef int64_t (*iFiiipu_t)(int64_t, int64_t, int64_t, void*, uint64_t); @@ -1233,6 +1237,7 @@ typedef int64_t (*iFpiIip_t)(void*, int64_t, int64_t, int64_t, void*); typedef int64_t (*iFpiuwp_t)(void*, int64_t, uint64_t, int16_t, void*); typedef int64_t (*iFpiUUU_t)(void*, int64_t, uint64_t, uint64_t, uint64_t); typedef int64_t (*iFpipii_t)(void*, int64_t, void*, int64_t, int64_t); +typedef int64_t (*iFpipiu_t)(void*, int64_t, void*, int64_t, uint64_t); typedef int64_t (*iFpipiL_t)(void*, int64_t, void*, int64_t, uintptr_t); typedef int64_t (*iFpipip_t)(void*, int64_t, void*, int64_t, void*); typedef int64_t (*iFpippi_t)(void*, int64_t, void*, void*, int64_t); @@ -2655,6 +2660,7 @@ void iFEup(x64emu_t *emu, uintptr_t fcn) { iFEup_t fn = (iFEup_t)fcn; R_RAX=(int void iFEUU(x64emu_t *emu, uintptr_t fcn) { iFEUU_t fn = (iFEUU_t)fcn; R_RAX=(int64_t)fn(emu, (uint64_t)R_RDI, (uint64_t)R_RSI); } void iFELp(x64emu_t *emu, uintptr_t fcn) { iFELp_t fn = (iFELp_t)fcn; R_RAX=(int64_t)fn(emu, (uintptr_t)R_RDI, (void*)R_RSI); } void iFEpi(x64emu_t *emu, uintptr_t fcn) { iFEpi_t fn = (iFEpi_t)fcn; R_RAX=(int64_t)fn(emu, (void*)R_RDI, (int64_t)R_RSI); } +void iFEpU(x64emu_t *emu, uintptr_t fcn) { iFEpU_t fn = (iFEpU_t)fcn; R_RAX=(int64_t)fn(emu, (void*)R_RDI, (uint64_t)R_RSI); } void iFEpL(x64emu_t *emu, uintptr_t fcn) { iFEpL_t fn = (iFEpL_t)fcn; R_RAX=(int64_t)fn(emu, (void*)R_RDI, (uintptr_t)R_RSI); } void iFEpp(x64emu_t *emu, uintptr_t fcn) { iFEpp_t fn = (iFEpp_t)fcn; R_RAX=(int64_t)fn(emu, (void*)R_RDI, (void*)R_RSI); } void iFEpV(x64emu_t *emu, uintptr_t fcn) { iFEpV_t fn = (iFEpV_t)fcn; R_RAX=(int64_t)fn(emu, (void*)R_RDI, (void*)(R_RSP + 8)); } @@ -3027,6 +3033,7 @@ void iFEpii(x64emu_t *emu, uintptr_t fcn) { iFEpii_t fn = (iFEpii_t)fcn; R_RAX=( void iFEpip(x64emu_t *emu, uintptr_t fcn) { iFEpip_t fn = (iFEpip_t)fcn; R_RAX=(int64_t)fn(emu, (void*)R_RDI, (int64_t)R_RSI, (void*)R_RDX); } void iFEpiV(x64emu_t *emu, uintptr_t fcn) { iFEpiV_t fn = (iFEpiV_t)fcn; R_RAX=(int64_t)fn(emu, (void*)R_RDI, (int64_t)R_RSI, (void*)(R_RSP + 8)); } void iFEpiA(x64emu_t *emu, uintptr_t fcn) { iFEpiA_t fn = (iFEpiA_t)fcn; R_RAX=(int64_t)fn(emu, (void*)R_RDI, (int64_t)R_RSI, (void*)R_RDX); } +void iFEpui(x64emu_t *emu, uintptr_t fcn) { iFEpui_t fn = (iFEpui_t)fcn; R_RAX=(int64_t)fn(emu, (void*)R_RDI, (uint64_t)R_RSI, (int64_t)R_RDX); } void iFEpup(x64emu_t *emu, uintptr_t fcn) { iFEpup_t fn = (iFEpup_t)fcn; R_RAX=(int64_t)fn(emu, (void*)R_RDI, (uint64_t)R_RSI, (void*)R_RDX); } void iFEpUi(x64emu_t *emu, uintptr_t fcn) { iFEpUi_t fn = (iFEpUi_t)fcn; R_RAX=(int64_t)fn(emu, (void*)R_RDI, (uint64_t)R_RSI, (int64_t)R_RDX); } void iFEpUp(x64emu_t *emu, uintptr_t fcn) { iFEpUp_t fn = (iFEpUp_t)fcn; R_RAX=(int64_t)fn(emu, (void*)R_RDI, (uint64_t)R_RSI, (void*)R_RDX); } @@ -3059,6 +3066,7 @@ void iFillu(x64emu_t *emu, uintptr_t fcn) { iFillu_t fn = (iFillu_t)fcn; R_RAX=( void iFipii(x64emu_t *emu, uintptr_t fcn) { iFipii_t fn = (iFipii_t)fcn; R_RAX=(int64_t)fn((int64_t)R_RDI, (void*)R_RSI, (int64_t)R_RDX, (int64_t)R_RCX); } void iFipip(x64emu_t *emu, uintptr_t fcn) { iFipip_t fn = (iFipip_t)fcn; R_RAX=(int64_t)fn((int64_t)R_RDI, (void*)R_RSI, (int64_t)R_RDX, (void*)R_RCX); } void iFipui(x64emu_t *emu, uintptr_t fcn) { iFipui_t fn = (iFipui_t)fcn; R_RAX=(int64_t)fn((int64_t)R_RDI, (void*)R_RSI, (uint64_t)R_RDX, (int64_t)R_RCX); } +void iFipuu(x64emu_t *emu, uintptr_t fcn) { iFipuu_t fn = (iFipuu_t)fcn; R_RAX=(int64_t)fn((int64_t)R_RDI, (void*)R_RSI, (uint64_t)R_RDX, (uint64_t)R_RCX); } void iFipup(x64emu_t *emu, uintptr_t fcn) { iFipup_t fn = (iFipup_t)fcn; R_RAX=(int64_t)fn((int64_t)R_RDI, (void*)R_RSI, (uint64_t)R_RDX, (void*)R_RCX); } void iFipLi(x64emu_t *emu, uintptr_t fcn) { iFipLi_t fn = (iFipLi_t)fcn; R_RAX=(int64_t)fn((int64_t)R_RDI, (void*)R_RSI, (uintptr_t)R_RDX, (int64_t)R_RCX); } void iFipLu(x64emu_t *emu, uintptr_t fcn) { iFipLu_t fn = (iFipLu_t)fcn; R_RAX=(int64_t)fn((int64_t)R_RDI, (void*)R_RSI, (uintptr_t)R_RDX, (uint64_t)R_RCX); } @@ -3464,6 +3472,7 @@ void iFEppiV(x64emu_t *emu, uintptr_t fcn) { iFEppiV_t fn = (iFEppiV_t)fcn; R_RA void iFEppiA(x64emu_t *emu, uintptr_t fcn) { iFEppiA_t fn = (iFEppiA_t)fcn; R_RAX=(int64_t)fn(emu, (void*)R_RDI, (void*)R_RSI, (int64_t)R_RDX, (void*)R_RCX); } void iFEpplp(x64emu_t *emu, uintptr_t fcn) { iFEpplp_t fn = (iFEpplp_t)fcn; R_RAX=(int64_t)fn(emu, (void*)R_RDI, (void*)R_RSI, (intptr_t)R_RDX, (void*)R_RCX); } void iFEpppi(x64emu_t *emu, uintptr_t fcn) { iFEpppi_t fn = (iFEpppi_t)fcn; R_RAX=(int64_t)fn(emu, (void*)R_RDI, (void*)R_RSI, (void*)R_RDX, (int64_t)R_RCX); } +void iFEpppL(x64emu_t *emu, uintptr_t fcn) { iFEpppL_t fn = (iFEpppL_t)fcn; R_RAX=(int64_t)fn(emu, (void*)R_RDI, (void*)R_RSI, (void*)R_RDX, (uintptr_t)R_RCX); } void iFEpppp(x64emu_t *emu, uintptr_t fcn) { iFEpppp_t fn = (iFEpppp_t)fcn; R_RAX=(int64_t)fn(emu, (void*)R_RDI, (void*)R_RSI, (void*)R_RDX, (void*)R_RCX); } void iFEpppV(x64emu_t *emu, uintptr_t fcn) { iFEpppV_t fn = (iFEpppV_t)fcn; R_RAX=(int64_t)fn(emu, (void*)R_RDI, (void*)R_RSI, (void*)R_RDX, (void*)(R_RSP + 8)); } void iFiiipu(x64emu_t *emu, uintptr_t fcn) { iFiiipu_t fn = (iFiiipu_t)fcn; R_RAX=(int64_t)fn((int64_t)R_RDI, (int64_t)R_RSI, (int64_t)R_RDX, (void*)R_RCX, (uint64_t)R_R8); } @@ -3498,6 +3507,7 @@ void iFpiIip(x64emu_t *emu, uintptr_t fcn) { iFpiIip_t fn = (iFpiIip_t)fcn; R_RA void iFpiuwp(x64emu_t *emu, uintptr_t fcn) { iFpiuwp_t fn = (iFpiuwp_t)fcn; R_RAX=(int64_t)fn((void*)R_RDI, (int64_t)R_RSI, (uint64_t)R_RDX, (int16_t)R_RCX, (void*)R_R8); } void iFpiUUU(x64emu_t *emu, uintptr_t fcn) { iFpiUUU_t fn = (iFpiUUU_t)fcn; R_RAX=(int64_t)fn((void*)R_RDI, (int64_t)R_RSI, (uint64_t)R_RDX, (uint64_t)R_RCX, (uint64_t)R_R8); } void iFpipii(x64emu_t *emu, uintptr_t fcn) { iFpipii_t fn = (iFpipii_t)fcn; R_RAX=(int64_t)fn((void*)R_RDI, (int64_t)R_RSI, (void*)R_RDX, (int64_t)R_RCX, (int64_t)R_R8); } +void iFpipiu(x64emu_t *emu, uintptr_t fcn) { iFpipiu_t fn = (iFpipiu_t)fcn; R_RAX=(int64_t)fn((void*)R_RDI, (int64_t)R_RSI, (void*)R_RDX, (int64_t)R_RCX, (uint64_t)R_R8); } void iFpipiL(x64emu_t *emu, uintptr_t fcn) { iFpipiL_t fn = (iFpipiL_t)fcn; R_RAX=(int64_t)fn((void*)R_RDI, (int64_t)R_RSI, (void*)R_RDX, (int64_t)R_RCX, (uintptr_t)R_R8); } void iFpipip(x64emu_t *emu, uintptr_t fcn) { iFpipip_t fn = (iFpipip_t)fcn; R_RAX=(int64_t)fn((void*)R_RDI, (int64_t)R_RSI, (void*)R_RDX, (int64_t)R_RCX, (void*)R_R8); } void iFpippi(x64emu_t *emu, uintptr_t fcn) { iFpippi_t fn = (iFpippi_t)fcn; R_RAX=(int64_t)fn((void*)R_RDI, (int64_t)R_RSI, (void*)R_RDX, (void*)R_RCX, (int64_t)R_R8); } @@ -5214,6 +5224,7 @@ int isSimpleWrapper(wrapper_t fun) { if (fun == &iFipii) return 1; if (fun == &iFipip) return 1; if (fun == &iFipui) return 1; + if (fun == &iFipuu) return 1; if (fun == &iFipup) return 1; if (fun == &iFipLi) return 1; if (fun == &iFipLu) return 1; @@ -5589,6 +5600,7 @@ int isSimpleWrapper(wrapper_t fun) { if (fun == &iFpiuwp) return 1; if (fun == &iFpiUUU) return 1; if (fun == &iFpipii) return 1; + if (fun == &iFpipiu) return 1; if (fun == &iFpipiL) return 1; if (fun == &iFpipip) return 1; if (fun == &iFpippi) return 1; diff --git a/src/wrapped/generated/wrapper.h b/src/wrapped/generated/wrapper.h index 140ea38e..2d7e15f1 100644 --- a/src/wrapped/generated/wrapper.h +++ b/src/wrapped/generated/wrapper.h @@ -389,6 +389,7 @@ void iFEup(x64emu_t *emu, uintptr_t fnc); void iFEUU(x64emu_t *emu, uintptr_t fnc); void iFELp(x64emu_t *emu, uintptr_t fnc); void iFEpi(x64emu_t *emu, uintptr_t fnc); +void iFEpU(x64emu_t *emu, uintptr_t fnc); void iFEpL(x64emu_t *emu, uintptr_t fnc); void iFEpp(x64emu_t *emu, uintptr_t fnc); void iFEpV(x64emu_t *emu, uintptr_t fnc); @@ -761,6 +762,7 @@ void iFEpii(x64emu_t *emu, uintptr_t fnc); void iFEpip(x64emu_t *emu, uintptr_t fnc); void iFEpiV(x64emu_t *emu, uintptr_t fnc); void iFEpiA(x64emu_t *emu, uintptr_t fnc); +void iFEpui(x64emu_t *emu, uintptr_t fnc); void iFEpup(x64emu_t *emu, uintptr_t fnc); void iFEpUi(x64emu_t *emu, uintptr_t fnc); void iFEpUp(x64emu_t *emu, uintptr_t fnc); @@ -793,6 +795,7 @@ void iFillu(x64emu_t *emu, uintptr_t fnc); void iFipii(x64emu_t *emu, uintptr_t fnc); void iFipip(x64emu_t *emu, uintptr_t fnc); void iFipui(x64emu_t *emu, uintptr_t fnc); +void iFipuu(x64emu_t *emu, uintptr_t fnc); void iFipup(x64emu_t *emu, uintptr_t fnc); void iFipLi(x64emu_t *emu, uintptr_t fnc); void iFipLu(x64emu_t *emu, uintptr_t fnc); @@ -1198,6 +1201,7 @@ void iFEppiV(x64emu_t *emu, uintptr_t fnc); void iFEppiA(x64emu_t *emu, uintptr_t fnc); void iFEpplp(x64emu_t *emu, uintptr_t fnc); void iFEpppi(x64emu_t *emu, uintptr_t fnc); +void iFEpppL(x64emu_t *emu, uintptr_t fnc); void iFEpppp(x64emu_t *emu, uintptr_t fnc); void iFEpppV(x64emu_t *emu, uintptr_t fnc); void iFiiipu(x64emu_t *emu, uintptr_t fnc); @@ -1232,6 +1236,7 @@ void iFpiIip(x64emu_t *emu, uintptr_t fnc); void iFpiuwp(x64emu_t *emu, uintptr_t fnc); void iFpiUUU(x64emu_t *emu, uintptr_t fnc); void iFpipii(x64emu_t *emu, uintptr_t fnc); +void iFpipiu(x64emu_t *emu, uintptr_t fnc); void iFpipiL(x64emu_t *emu, uintptr_t fnc); void iFpipip(x64emu_t *emu, uintptr_t fnc); void iFpippi(x64emu_t *emu, uintptr_t fnc); diff --git a/src/wrapped/wrappedlibc.c b/src/wrapped/wrappedlibc.c index 0e3f3c93..7a8f9c32 100755 --- a/src/wrapped/wrappedlibc.c +++ b/src/wrapped/wrappedlibc.c @@ -1091,6 +1091,7 @@ EXPORT int my_stat(x64emu_t *emu, void* filename, void* buf) UnalignStat64(&st, buf); return r; } +EXPORT int my_stat64(x64emu_t *emu, void* filename, void* buf) __attribute__((alias("my_stat"))); EXPORT int my_lstat(x64emu_t *emu, void* filename, void* buf) { @@ -1100,6 +1101,7 @@ EXPORT int my_lstat(x64emu_t *emu, void* filename, void* buf) UnalignStat64(&st, buf); return r; } +EXPORT int my_lstat64(x64emu_t *emu, void* filename, void* buf) __attribute__((alias("my_lstat"))); EXPORT int my_fstat(x64emu_t *emu, int fd, void* buf) { @@ -1119,6 +1121,7 @@ EXPORT int my_fstatat(x64emu_t *emu, int fd, const char* path, void* buf, int fl UnalignStat64(&st, buf); return r; } +EXPORT int my_fstatat64(x64emu_t *emu, int fd, const char* path, void* buf, int flags) __attribute__((alias("my_fstatat"))); EXPORT int my__IO_file_stat(x64emu_t* emu, void* f, void* buf) { @@ -2971,6 +2974,10 @@ EXPORT int my_prctl(x64emu_t* emu, int option, unsigned long arg2, unsigned long printf_log(LOG_DEBUG, "BOX64: set process name to \"%s\"\n", (char*)arg2); ApplyParams((char*)arg2); } + if(option==PR_SET_SECCOMP) { + printf_log(LOG_INFO, "BOX64: ignoring prctl(PR_SET_SECCOMP, ...)\n"); + return 0; + } return prctl(option, arg2, arg3, arg4, arg5); } @@ -3007,9 +3014,10 @@ EXPORT char my___libc_single_threaded = 0; "libutil.so.1", \ "librt.so.1"); \ else \ - setNeededLibs(lib, 3, \ + setNeededLibs(lib, 4, \ "ld-linux-x86-64.so.2", \ "libpthread.so.0", \ + "libutil.so.1", \ "librt.so.1"); #define CUSTOM_FINI \ diff --git a/src/wrapped/wrappedlibc_private.h b/src/wrapped/wrappedlibc_private.h index 6c5dcdd3..f9306267 100755 --- a/src/wrapped/wrappedlibc_private.h +++ b/src/wrapped/wrappedlibc_private.h @@ -304,7 +304,7 @@ GOM(_exit, vFEi) GOM(exit, vFEi) GOW(_Exit, vFi) GO(explicit_bzero, vFpL) -//GO(__explicit_bzero_chk, +GO(__explicit_bzero_chk, vFpLL) GO(faccessat, iFipii) GOW(fallocate, iFiill) GO(fallocate64, iFiill) @@ -431,6 +431,7 @@ GO(fsetxattr, iFippLi) GOM(fstat, iFEip) GOM(fstat64, iFEip) GOM(fstatat, iFEippi) +GOM(fstatat64, iFEippi) GOW(fstatfs, iFip) GOW(fstatfs64, iFip) GOW(fstatvfs, iFip) @@ -524,7 +525,7 @@ GO(getgrnam, pFp) GO(getgrnam_r, iFpppLp) GO(getgrouplist, iFpupp) GOW(getgroups, iFip) -//GO(__getgroups_chk, +GO(__getgroups_chk, iFipL) GO(gethostbyaddr, pFpui) GO(gethostbyaddr_r, iFpuippLpp) GO(gethostbyname, pFp) @@ -1091,9 +1092,9 @@ GO(llistxattr, lFppL) //DATAB(loc2, GO(localeconv, pFv) GO(localtime, pFp) -GO(localtime64, pFp) +GO2(localtime64, pFp, localtime) GOW(localtime_r, pFpp) -GOW(localtime64_r, pFpp) +GO2(localtime64_r, pFpp, localtime_r) //Weak GO(lockf, iFiil) GOW(lockf64, iFiil) //DATAB(locs, @@ -1109,6 +1110,7 @@ GOW(lseek, lFili) GOW(lseek64, lFili) GO(lsetxattr, iFpppLi) GOM(lstat, iFEpp) +GOM(lstat64, iFEpp) GO(lutimes, iFpp) GOM(__lxstat, iFEipp) GOM(__lxstat64, iFEipp) @@ -1171,6 +1173,8 @@ GO(mkdirat, iFipu) GO(mkdtemp, pFp) GO(mkfifo, iFpu) GO(mkfifoat, iFipu) +GO(mknod, iFpuu) +GO(mknodat, iFipuu) GO(mkostemp, iFpi) GOW(mkostemp64, iFpi) GO(mkostemps, iFpii) @@ -1336,23 +1340,23 @@ GOW(posix_openpt, iFi) GOM(posix_spawn, iFEpppppp) GOW(posix_spawnattr_destroy, iFp) GO(posix_spawnattr_getflags, iFpp) -//GO(posix_spawnattr_getpgroup, iF!p) +GO(posix_spawnattr_getpgroup, iFpp) //GO(posix_spawnattr_getschedparam, iF!!) //GO(posix_spawnattr_getschedpolicy, iF!p) GO(posix_spawnattr_getsigdefault, iFpp) GO(posix_spawnattr_getsigmask, iFpp) GOW(posix_spawnattr_init, iFp) GOW(posix_spawnattr_setflags, iFpw) -//GO(posix_spawnattr_setpgroup, iF!i) -//GO(posix_spawnattr_setschedparam, iF!!) -//GO(posix_spawnattr_setschedpolicy, iF!i) +GO(posix_spawnattr_setpgroup, iFpi) +GO(posix_spawnattr_setschedparam, iFpp) +GO(posix_spawnattr_setschedpolicy, iFpi) GOW(posix_spawnattr_setsigdefault, iFpp) GOW(posix_spawnattr_setsigmask, iFpp) GO(posix_spawn_file_actions_addchdir_np, iFpp) GOW(posix_spawn_file_actions_addclose, iFpi) GOW(posix_spawn_file_actions_adddup2, iFpii) -//GO(posix_spawn_file_actions_addfchdir_np, iF!i) -//GOW(posix_spawn_file_actions_addopen, iF!ipiu) +GO(posix_spawn_file_actions_addfchdir_np, iFpi) +GOW(posix_spawn_file_actions_addopen, iFpipiu) GOW(posix_spawn_file_actions_destroy, iFp) GOW(posix_spawn_file_actions_init, iFp) GOM(posix_spawnp, iFEpppppp) @@ -1580,7 +1584,7 @@ GOW(sched_get_priority_min, iFi) GOW(sched_getscheduler, iFi) GOW(sched_rr_get_interval, iFip) GO(sched_setaffinity, iFiLp) -//GOW(sched_setparam, iFi!) +GOW(sched_setparam, iFip) //GO(__sched_setscheduler, iFiip) GOW(sched_setscheduler, iFiip) GO(__sched_yield, iFv) @@ -1739,6 +1743,7 @@ GOM(sscanf, iFEppV) //GO(sstk, GOM(__stack_chk_fail, vFEv) GOM(stat, iFEpp) +GOM(stat64, iFEpp) //GO(__statfs, GOW(statfs, iFpp) GOW(statfs64, iFpp) diff --git a/src/wrapped/wrappedlibpthread_private.h b/src/wrapped/wrappedlibpthread_private.h index 5c017f93..2c16c02d 100755 --- a/src/wrapped/wrappedlibpthread_private.h +++ b/src/wrapped/wrappedlibpthread_private.h @@ -129,7 +129,7 @@ GOM(pthread_getattr_default_np, iFEp) GOM(pthread_setattr_default_np, iFEp) #endif //GO(pthread_getconcurrency, iFv) -//GO(pthread_getcpuclockid, iFup) +GO(pthread_getcpuclockid, iFLp) GO(pthread_getschedparam, iFLpp) GO(__pthread_getspecific, pFL) GO(pthread_getspecific, pFL) @@ -263,6 +263,7 @@ GO(pthread_yield, iFv) // raise // __res_state GO(sem_close, iFp) +GO(sem_clockwait, iFppp) GO(sem_destroy, iFp) GO(sem_getvalue, iFpp) GO(sem_init, iFpiu) diff --git a/src/wrapped/wrappedlibxcb_private.h b/src/wrapped/wrappedlibxcb_private.h index 3ba495bb..1e9c7698 100755 --- a/src/wrapped/wrappedlibxcb_private.h +++ b/src/wrapped/wrappedlibxcb_private.h @@ -394,7 +394,7 @@ GO(xcb_open_font_checked, pFpuWp) //GO(xcb_open_font_name_end, //GO(xcb_open_font_name_length, //GO(xcb_open_font_sizeof, -//GO(xcb_parse_display, +GO(xcb_parse_display, iFpppp) //GO(xcb_pixmap_end, //GO(xcb_pixmap_next, //GO(xcb_point_end, diff --git a/src/wrapped/wrappedlzma.c b/src/wrapped/wrappedlzma.c index 541ea600..638a38dc 100755 --- a/src/wrapped/wrappedlzma.c +++ b/src/wrapped/wrappedlzma.c @@ -144,6 +144,62 @@ EXPORT int my_lzma_stream_decoder(x64emu_t* emu, lzma_stream_t* stream, uint64_t return my->lzma_stream_decoder(stream, memlimit, flags); } +EXPORT int my_lzma_stream_encoder(x64emu_t* emu, lzma_stream_t* stream, void* filters, int check) +{ + // not restoring the allocator after, so lzma_code and lzma_end can be used without "GOM" wrapping + if(stream->allocator) + wrap_alloc_struct(stream->allocator, stream->allocator); + return my->lzma_stream_encoder(stream, filters, check); +} + + +EXPORT int my_lzma_easy_encoder(x64emu_t* emu, lzma_stream_t* stream, uint32_t precheck, uint32_t check) +{ + // not restoring the allocator after, so lzma_code and lzma_end can be used without "GOM" wrapping + if(stream->allocator) + wrap_alloc_struct(stream->allocator, stream->allocator); + return my->lzma_easy_encoder(stream, precheck, check); +} + +EXPORT int my_lzma_raw_encoder(x64emu_t* emu, lzma_stream_t* stream, void* filters) +{ + // not restoring the allocator after, so lzma_code and lzma_end can be used without "GOM" wrapping + if(stream->allocator) + wrap_alloc_struct(stream->allocator, stream->allocator); + return my->lzma_raw_encoder(stream, filters); +} + +EXPORT int my_lzma_raw_decoder(x64emu_t* emu, lzma_stream_t* stream, void* filters) +{ + // not restoring the allocator after, so lzma_code and lzma_end can be used without "GOM" wrapping + if(stream->allocator) + wrap_alloc_struct(stream->allocator, stream->allocator); + return my->lzma_raw_decoder(stream, filters); +} + +EXPORT int my_lzma_properties_decode(x64emu_t* emu, void* filters, lzma_allocator_t* allocator, void* props, size_t size) +{ + lzma_allocator_t alloc = {0}; + wrap_alloc_struct(&alloc, allocator); + return my->lzma_properties_decode(filters, &alloc, props, size); +} + +EXPORT int my_lzma_alone_decoder(x64emu_t* emu, lzma_stream_t* stream, uint64_t memlimit) +{ + // not restoring the allocator after, so lzma_code and lzma_end can be used without "GOM" wrapping + if(stream->allocator) + wrap_alloc_struct(stream->allocator, stream->allocator); + return my->lzma_alone_decoder(stream, memlimit); +} + +EXPORT int my_lzma_alone_encoder(x64emu_t* emu, lzma_stream_t* stream, void* options) +{ + // not restoring the allocator after, so lzma_code and lzma_end can be used without "GOM" wrapping + if(stream->allocator) + wrap_alloc_struct(stream->allocator, stream->allocator); + return my->lzma_alone_encoder(stream, options); +} + #define CUSTOM_INIT \ getMy(lib); diff --git a/src/wrapped/wrappedlzma_private.h b/src/wrapped/wrappedlzma_private.h index efc72c84..3b82a076 100755 --- a/src/wrapped/wrappedlzma_private.h +++ b/src/wrapped/wrappedlzma_private.h @@ -2,8 +2,8 @@ #error meh! #endif -//GO(lzma_alone_decoder, -//GO(lzma_alone_encoder, +GOM(lzma_alone_decoder, iFEpU) +GOM(lzma_alone_encoder, iFEpp) GO(lzma_auto_decoder, iFpUu) //GO(lzma_block_buffer_bound, //GO(lzma_block_buffer_decode, @@ -17,7 +17,7 @@ GO(lzma_auto_decoder, iFpUu) //GO(lzma_block_total_size, //GO(lzma_block_uncomp_encode, //GO(lzma_block_unpadded_size, -//GO(lzma_check_is_supported, +GO(lzma_check_is_supported, iFi) //GO(lzma_check_size, GO(lzma_code, iFpi) //GO(lzma_cputhreads, @@ -25,7 +25,7 @@ GO(lzma_code, iFpi) //GO(lzma_crc64, //GO(lzma_easy_buffer_encode, //GO(lzma_easy_decoder_memusage, -//GO(lzma_easy_encoder, +GOM(lzma_easy_encoder, iFEpui) //GO(lzma_easy_encoder_memusage, GO(lzma_end, vFp) //GO(lzma_filter_decoder_is_supported, @@ -35,7 +35,7 @@ GO(lzma_end, vFp) //GO(lzma_filter_flags_size, //GO(lzma_filters_copy, //GO(lzma_filters_update, -//GO(lzma_get_check, +GO(lzma_get_check, iFp) //GO(lzma_get_progress, //GO(lzma_index_append, //GO(lzma_index_block_count, @@ -67,27 +67,27 @@ GO(lzma_index_size, UFp) //GO(lzma_index_stream_size, //GO(lzma_index_total_size, GO(lzma_index_uncompressed_size, UFp) -//GO(lzma_lzma_preset, +GO(lzma_lzma_preset, iFpu) //GO(lzma_memlimit_get, //GO(lzma_memlimit_set, //GO(lzma_memusage, //GO(lzma_mf_is_supported, //GO(lzma_mode_is_supported, //GO(lzma_physmem, -//GO(lzma_properties_decode, -//GO(lzma_properties_encode, -//GO(lzma_properties_size, +GOM(lzma_properties_decode, iFEpppL) +GO(lzma_properties_encode, iFpp) +GO(lzma_properties_size, iFpp) //GO(lzma_raw_buffer_decode, //GO(lzma_raw_buffer_encode, -//GO(lzma_raw_decoder, +GOM(lzma_raw_decoder, iFEpp) //GO(lzma_raw_decoder_memusage, -//GO(lzma_raw_encoder, +GOM(lzma_raw_encoder, iFEpp) //GO(lzma_raw_encoder_memusage, //GO(lzma_stream_buffer_bound, GOM(lzma_stream_buffer_decode, iFEpupppLppL) //GO(lzma_stream_buffer_encode, GOM(lzma_stream_decoder, iFEpUi) -//GO(lzma_stream_encoder, +GOM(lzma_stream_encoder, iFEppi) //GO(lzma_stream_encoder_mt, //GO(lzma_stream_encoder_mt_memusage, //GO(lzma_stream_flags_compare, |