mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-22 14:26:00 +00:00
perf(fex): answer raw stat, readlink and statx syscalls through the proot fast path (#1757)
* perf(fex): answer raw stat, readlink and statx syscalls through the proot fast path FEX issues newfstatat, readlinkat and statx as raw syscall() calls, which skipped the libc wrappers the fast path hooks and fell through to ptrace. Route them through libblfastpath the same way raw openat already is, and keep the fast path's own /proc/self/exe lookup off the hooked syscall(). * test(fex): keep the raw lookup test passing on kernels without statx
This commit is contained in:
1 parent
8329033121
commit
e9e0186e66
3 files changed
+93
-7
No files matched your search
@@ -141,12 +141,14 @@ static int traced_by_match(const char *key) {
|
||||
return found;
|
||||
}
|
||||
|
||||
static long init_sys(long nr, long a, long b, long c) {
|
||||
static long init_sys4(long nr, long a, long b, long c, long d) {
|
||||
static long (*real_syscall)(long, ...);
|
||||
if (!real_syscall) real_syscall = (long (*)(long, ...))dlsym(RTLD_NEXT, "syscall");
|
||||
return real_syscall(nr, a, b, c);
|
||||
return real_syscall(nr, a, b, c, d);
|
||||
}
|
||||
|
||||
static long init_sys(long nr, long a, long b, long c) { return init_sys4(nr, a, b, c, 0); }
|
||||
|
||||
static int program_32bit(const char *prog, int scripts) {
|
||||
char head[256];
|
||||
long fd = init_sys(SYS_openat, AT_FDCWD, (long)prog, O_RDONLY | O_CLOEXEC);
|
||||
@@ -504,7 +506,7 @@ static long own_exe(char *g) {
|
||||
memcpy(g, exe_text, n + 1);
|
||||
return n;
|
||||
}
|
||||
long t = syscall(SYS_readlinkat, AT_FDCWD, "/proc/self/exe", g, PATH_MAX - 1);
|
||||
long t = init_sys4(SYS_readlinkat, AT_FDCWD, (long)"/proc/self/exe", (long)g, PATH_MAX - 1);
|
||||
if (t <= 0 || t >= PATH_MAX - 1) return FP_SLOW;
|
||||
g[t] = 0;
|
||||
static pthread_mutex_t exe_lock = PTHREAD_MUTEX_INITIALIZER;
|
||||
|
||||
Reference in new issue
Block a user