mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-25 07:46:01 +00:00
* 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.
36 lines
1.5 KiB
Python
36 lines
1.5 KiB
Python
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()
|