fix(fex): x86-64 DwarFS AppImages start and GLib programs reach D-Bus (#3162)

* fix(fex): a program run from a descriptor keeps its argv[0] and an absolute /proc/self/exe

* fix(fex): 64-bit programs send their socket credentials through the hook

D-Bus clients fill SCM_CREDENTIALS with getuid(), which is 0 under the guest. FEX sent x86-64 sendmsg straight to the kernel, which refused the fake root uid with EPERM, so GLib programs lost the session bus and every portal. sendmsg, recvmsg and getsockopt now go through libc like the identity calls, so the hook puts in the real ids and shows the peer as root.
This commit is contained in:
MaxsTechReview authored and GitHub committed 2026-11-24 16:21:40 -05:00
1 parent 5ca0575e67
commit afe81ea69f
5 files changed
+241

No files matched your search

@@ -0,0 +1,26 @@
diff --git a/Source/Tools/FEXInterpreter/FEXInterpreter.cpp b/Source/Tools/FEXInterpreter/FEXInterpreter.cpp
index 2881ad9..abc84f3 100644
--- a/Source/Tools/FEXInterpreter/FEXInterpreter.cpp
+++ b/Source/Tools/FEXInterpreter/FEXInterpreter.cpp
@@ -518,7 +518,7 @@ int main(int argc, char** argv, char** const envp) {
FEXCore::Config::Set(FEXCore::Config::CONFIG_APP_CONFIG_NAME, Program.ProgramName);
} else {
// Anonymous program.
- FEXCore::Config::Set(FEXCore::Config::CONFIG_APP_FILENAME, "<Anonymous>");
+ FEXCore::Config::Set(FEXCore::Config::CONFIG_APP_FILENAME, Program.ProgramPath);
FEXCore::Config::Set(FEXCore::Config::CONFIG_APP_CONFIG_NAME, "<Anonymous>");
}
} else {
diff --git a/Source/Tools/LinuxEmulation/LinuxSyscalls/Syscalls.cpp b/Source/Tools/LinuxEmulation/LinuxSyscalls/Syscalls.cpp
index a7a432b..4a77d87 100644
--- a/Source/Tools/LinuxEmulation/LinuxSyscalls/Syscalls.cpp
+++ b/Source/Tools/LinuxEmulation/LinuxSyscalls/Syscalls.cpp
@@ -441,7 +441,7 @@ uint64_t ExecveHandler(FEXCore::Core::CpuStateFrame* Frame, const char* pathname
if (*OldArgv) {
// The direct fallback uses the executable path as argv[0]. An FD-backed load uses the
// binfmt preserve-argv0 layout, so the caller-supplied argv[0] has to stay in the vector.
- if (!NeedsLoaderFD) {
+ if (!NeedsLoaderFD && !IsFDExec) {
++OldArgv;
}
while (*OldArgv) {
@@ -0,0 +1,18 @@
diff --git a/Source/Tools/LinuxEmulation/LinuxSyscalls/Syscalls/Passthrough.cpp b/Source/Tools/LinuxEmulation/LinuxSyscalls/Syscalls/Passthrough.cpp
index e287cd2..2181667 100644
--- a/Source/Tools/LinuxEmulation/LinuxSyscalls/Syscalls/Passthrough.cpp
+++ b/Source/Tools/LinuxEmulation/LinuxSyscalls/Syscalls/Passthrough.cpp
@@ -469,10 +469,10 @@ namespace x64 {
REGISTER_SYSCALL_IMPL_X64(setitimer, SyscallPassthrough3<SYSCALL_DEF(setitimer)>);
REGISTER_SYSCALL_IMPL_X64(sendfile, SyscallPassthrough4<SYSCALL_DEF(sendfile)>);
REGISTER_SYSCALL_IMPL_X64(accept, SyscallPassthrough3<SYSCALL_DEF(accept)>);
- REGISTER_SYSCALL_IMPL_X64(sendmsg, SyscallPassthrough3<SYSCALL_DEF(sendmsg)>);
- REGISTER_SYSCALL_IMPL_X64(recvmsg, SyscallPassthrough3<SYSCALL_DEF(recvmsg)>);
+ REGISTER_SYSCALL_IMPL_X64(sendmsg, SyscallPathPassthrough3<SYSCALL_DEF(sendmsg)>);
+ REGISTER_SYSCALL_IMPL_X64(recvmsg, SyscallPathPassthrough3<SYSCALL_DEF(recvmsg)>);
REGISTER_SYSCALL_IMPL_X64(setsockopt, SyscallPassthrough5<SYSCALL_DEF(setsockopt)>);
- REGISTER_SYSCALL_IMPL_X64(getsockopt, SyscallPassthrough5<SYSCALL_DEF(getsockopt)>);
+ REGISTER_SYSCALL_IMPL_X64(getsockopt, SyscallPathPassthrough5<SYSCALL_DEF(getsockopt)>);
REGISTER_SYSCALL_IMPL_X64(wait4, SyscallPassthrough4<SYSCALL_DEF(wait4)>);
REGISTER_SYSCALL_IMPL_X64(semop, SyscallPassthrough3<SYSCALL_DEF(semop)>);
REGISTER_SYSCALL_IMPL_X64(getrlimit, SyscallPassthrough2<SYSCALL_DEF(getrlimit)>);