* feat: emulate LSE atomics so the Steam client starts on ARMv8.0 CPUs * fix: keep NZCV across patched LSE min/max stubs and catch st* aliases * fix: fail the LSE check when objdump fails * fix: validate the CASP pair on a mismatch in the LSE emulator * fix: sandboxes switch on the LSE emulator when it is preloaded * fix: keep the MaliBridge pointer from main * Handle LSE atomics before preload constructors * Support early LSE handling in root guest processes * Fix LSE-Emu signal and patching review findings * Assert CASP and min/max sites use patched stubs * Correct patch test statistics regexes * Validate SIGILL syscall ABI and retain active state on restore failure * Preserve the previous SIGILL disposition during early install * Synchronize instruction fetch on generated LSE stubs * Address LSE-Emu follow-up review findings * Fix missing LSE signal handler state declarations * Honor application signal mask when forwarding SIGILL * Preserve SA_RESETHAND mask during handler forwarding * Fix LSE opt-out after early handler install * Avoid recursive SIGILL forwarding during LSE emulation * Fix LSE SIGILL handler re-entry tracking * Honor SA_NODEFER in forwarded SIGILL mask * Preserve nested SIGILL delivery semantics * Preserve explicit SIGILL mask with SA_NODEFER * Reduce LSE patch contention across threads * Guard nested faults before acquiring patch lock * Fix early SIGILL restore and wake patch waiters * Preserve libc restorer when restoring application SIGILL * Wait for concurrent LSE patch instead of skipping * Fix LSE patch lock release and fork recovery * Avoid reinstalling the early SIGILL handler * chore: retrigger CI * Avoid proc maps reads in concurrent SIGILL patching * Prevent late IFUNC handler install when emulation is disabled * Clarify cached mapping lookup * Move cached map declarations before find_gap * Default LSE instruction patching to off * Document conservative LSE emulation default * Keep LSE instruction patching opt-in in sandbox preload * Document default and opt-in LSE emulation checks * Assert LSE patching remains opt-in in sandbox tests * Align LSE device checks with SDK 34 patching behavior * Check expected mprotect failures in opt-in device run * Clarify LSE emulator device validation criteria * Specify controlled SDK mprotect validation * fix(lse-emu): publish SIGILL actions atomically * fix(runtime): honor LSE_EMU=0 before preload * test(runtime): keep LSE preload disabled when opted out * fix(runtime): fully honor LSE_EMU=0 opt-out * test(runtime): verify LSE opt-out removes inherited preload * fix(runtime): filter inherited LSE preload without preload file * fix(lse-emu): use bounded signal-safe action snapshots * fix(runtime): split inherited preloads on spaces and colons * test(runtime): cover both LSE preload entry orders * fix(lse-emu): recycle displaced SIGILL snapshots * fix(preload): preserve colliding path cache entries * test(lse-emu): report patch failure details * fix(lse-emu): serialize action snapshot publishers * fix(lse-emu): fall back to reachable arena mapping * fix(lse-emu): make signal action publication nonblocking * refactor(lse-emu): remove obsolete publisher lock * Fix SIGILL snapshot retirement and honor session LSE opt-out * Preserve the Java staging API and isolate the SIGILL stress test * fix(nativeguest): filter LSE preload when disabled * fix(lse-emu): tighten seccomp and signal setup * fix(session): preserve active LSE override while staging * fix(lse-emu): return atomically displaced signal actions * fix(lse-emu): stage raw signal masks safely * fix(lse-emu): distinguish seccomp listener success * fix(lse-emu): publish seccomp veto atomically * fix(lse-emu): fail closed on RX restore errors * fix(lse-emu): keep stack-using atomic stubs on trap path * fix(lse-emu): allow patching with inherited seccomp * test(lse-emu): cover LDAPR patch path * test(lse-emu): assert LDAPR-only patching * fix(nativeguest): filter disabled LSE from preload chains * docs(lse-emu): define inherited seccomp patch policy * fix(lse-emu): emulate LDAPR trap fallback * refactor(lse-emu): remove unused seccomp query * fix(nativeguest): release filtered preload chain in scope * test(lse-emu): allow forwarded udf diagnostic * fix(nativeguest): avoid unsafe preload fallback when disabled * test(lse-emu): match full zero instruction field * test(lse-emu): match complete instruction diagnostics * Keep nested native preloads from duplicating host libraries * fix(nativeguest): fail exec when disabled preload cannot map * fix(nativeguest): stop exec when preload mapping fails * fix(nativeguest): propagate preload filter allocation failures * Consume only the selected one-shot SIGILL action * Reclaim abandoned SIGILL action slots after fork * Revalidate the live file mapping before optional LSE patching --------- Co-authored-by: Kurt Himebauch <136133082+xXJSONDeruloXx@users.noreply.github.com>
LSE-Emu
lse_emu.c is a copy of SildurFX/LSE-Emu at commit
8bc9548ac6fd24a8d506b266b17ba8d0e71a9b01 (GPL-3.0-or-later) with two fixes, listed in
docs/arm-v8.0-steam-client.md under "Fixes over upstream": NZCV kept across the min/max
stubs, and a store-back on CASP mismatches so the returned pair is atomic. Carry them forward
until upstream has them.
It is an LD_PRELOAD library that emulates the ARMv8.1 LSE atomic instructions (and LDAPR)
on ARMv8.0 CPUs. A SIGILL handler performs each trapped instruction with an LL/SC loop. A GNU
IFUNC resolver installs a minimal early handler on CPUs without LSE before dependency
constructors, covering LSE instructions executed before the preload constructor. The early handler
is removed after initialization unless LSE_EMU=1 is set. With LSE_EMU_PATCH=1 the first trap at a site
writes an LL/SC stub nearby and replaces the instruction with a branch to it, so later runs do not trap.
Patching is off by default. It is restricted to private file-backed executable mappings whose
live file and offset still match the original mapping. Leave patching off for programs that
can remap executable pages concurrently: checking the mapping cannot lock it against a remap.
The session stages it as /usr/local/lib/droiddeck-lse/liblse_emu.so and only lists it in
/etc/ld.so.preload when /proc/cpuinfo has no atomics flag. See
docs/arm-v8.0-steam-client.md for why.
To update, copy lse_emu.c from a newer upstream commit and change the commit above.