mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-24 15:26:04 +00:00
fix(nativeguest): x86-64 path calls, SIGSYS handlers and re-execs stay inside the rootfs hook (#3074)
* fix(nativeguest): x86-64 path system calls and SIGSYS handlers stay inside the rootfs hook FEX passed most guest path system calls to the kernel with an inline svc, so the native path hook never mapped them, and it mirrored guest SIGSYS handlers with a raw rt_sigaction that replaced the hook's own handler, after which the next blocked system call killed the program. Path calls now go through libc's syscall(), which the hook maps (guarded until the hook is initialised so an early allocator cannot deadlock), and a SIGSYS handler set through syscall() is recorded and chained like one set through sigaction(). * fix(ddexec): a program that re-execs itself keeps the rootfs hook A re-exec through /proc/self/exe starts the program through the guest ld.so again but left out the hook, so the child saw host paths. Steam's reaper then recorded host install folders, and Battle.net games moved to a mapped drive the Library could not resolve. The re-exec now preloads the hook of the root the same way the first start does.
This commit is contained in:
1 parent
bf7f7ecda7
commit
823f70320f
11 files changed
+942
-52
No files matched your search
@@ -291,6 +291,18 @@ alone would then read as an installed client.
|
||||
spins until a `SIGALRM` handler sets a register (R12, or ESI in 32-bit `rt` and legacy frames):
|
||||
FEX-2611.1 with 0001 to 0011 never sees it in any of the three frame types, with this patch all
|
||||
three see it on the first signal, as natively.
|
||||
- `0013-path-syscalls-through-libc`: FEX passes most path system calls of the guest (`mkdirat`,
|
||||
`unlinkat`, `renameat`, `renameat2`, `symlinkat`, `linkat`, `mknodat`, `fchmodat`, `fchmodat2`,
|
||||
`fchownat`, `utimensat`, `truncate`, `chdir`, `chroot`, `inotify_add_watch`) straight to the kernel
|
||||
with an inline `svc`, which the native userland's path hook never sees, so an x86-64 program wrote
|
||||
`/opt/...` or `/root/...` to the Android root instead of the rootfs, and `cd` into a rootfs folder
|
||||
failed. They now go through libc's `syscall()`, which the hook maps like every other path; without
|
||||
the hook it is the same system call. `tools/tests/test_native_hook_path_syscalls.py` checks the hook
|
||||
side, including that an allocator which opens files before the hook has started does not hang.
|
||||
FEX also mirrors each guest signal handler with `syscall(SYS_rt_sigaction, ...)`; for `SIGSYS` the
|
||||
hook records the guest handler as it does for `sigaction()` and keeps its own installed, so a
|
||||
program that sets a crash handler is no longer killed by the next blocked system call
|
||||
(`tools/tests/test_native_hook_sigsys_mask.py`).
|
||||
- **Building and publishing.** Droid-Deck/DroidDeck-Components' `build-fex.yml` builds `tools/fex` from
|
||||
this repository at a chosen ref (default `main`) with host thunks, in the same Arch Linux ARM container
|
||||
with a read-only token, then a separate job replaces `fex.tzst` on Components' single `fex` release,
|
||||
|
||||
Reference in new issue
Block a user