fix(fex): keep the guest stack clear of the host stack's growth reserve (#3623)

This commit is contained in:
MaxsTechReview authored and GitHub committed 2026-12-03 07:13:39 -05:00
1 parent 8cf1e60cc2
commit affb0da37f
3 files changed
+128

No files matched your search

+10
View File
@@ -303,6 +303,16 @@ alone would then read as an installed client.
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`).
- `0020-guest-stack-clear-of-host-stack-reserve`: FEX places the guest's 128 MB stack range
with `MAP_FIXED_NOREPLACE`, scanning down from the top of the address space. With a 39-bit address
space the host stack sits in that top range in about one start in eight, and the guest stack then
landed directly below it, inside the space the kernel keeps free for the host stack to grow
(`RLIMIT_STACK`, at least 128 MB). A deep host call chain (the native userland's `execve` hook
and libc `syscall()` wrappers) then grew the host stack into the top of the guest stack, where
the guest's argument and environment strings live, and the next program started with a corrupted
environment (Proton failing with `KeyError: 'PWD'` or "No compat data path"). The guest stack is
now placed below that reserve. On a Retroid Pocket Duo, 100 nested Proton starts ran clean, 10 of
them with the host stack at the top; without the patch 3 of 25 were corrupted.
- **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,