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

+35
View File
@@ -0,0 +1,35 @@
import re
import unittest
from pathlib import Path
REPO = Path(__file__).resolve().parents[2]
PATCH = REPO / "tools/fex/patches/0017-fd-exec-keeps-argv0-and-path.patch"
SYSCALLS = "Source/Tools/LinuxEmulation/LinuxSyscalls/Syscalls.cpp"
INTERPRETER = "Source/Tools/FEXInterpreter/FEXInterpreter.cpp"
def lines(sign):
return [line[1:].strip() for line in PATCH.read_text().splitlines() if line.startswith(sign) and not line.startswith(sign * 3)]
class FexFdExecTest(unittest.TestCase):
def test_only_the_execve_handler_and_the_interpreter_change(self):
self.assertEqual([INTERPRETER, SYSCALLS], re.findall(r"^diff --git a/(\S+) ", PATCH.read_text(), re.M))
def test_a_descriptor_exec_keeps_the_callers_argv0(self):
self.assertIn("if (!NeedsLoaderFD) {", lines("-"))
self.assertIn("if (!NeedsLoaderFD && !IsFDExec) {", lines("+"))
def test_an_anonymous_program_reports_its_recovered_path(self):
self.assertIn('FEXCore::Config::Set(FEXCore::Config::CONFIG_APP_FILENAME, "<Anonymous>");', lines("-"))
self.assertIn("FEXCore::Config::Set(FEXCore::Config::CONFIG_APP_FILENAME, Program.ProgramPath);", lines("+"))
def test_the_config_name_stays_anonymous(self):
self.assertNotIn('FEXCore::Config::Set(FEXCore::Config::CONFIG_APP_CONFIG_NAME, "<Anonymous>");', lines("-"))
def test_no_comments_are_added(self):
self.assertFalse([line for line in lines("+") if line.startswith(("//", "/*"))])
if __name__ == "__main__":
unittest.main()