From c26fe39b6086cc6e856e68a5fea364d10fae6c81 Mon Sep 17 00:00:00 2001 From: The412Banner Date: Sat, 26 Sep 2026 13:13:32 -0400 Subject: [PATCH] Keep libfakeinput's C++ runtime private libfakeinput.so links libstdc++ and libgcc statically and is preloaded into every session process, so it exported the whole C++ runtime (~7000 symbols, __gxx_personality_v0 and __cxa_* among them). Programs then unwound through its copy: shadPS4 aborted in pthread_exit the first time a game thread ended (forced unwind -> foreign personality -> terminate). Link with --exclude-libs,ALL so only the input hooks are exported, fail the build if the runtime leaks out again, and bump the preload cache so it is rebuilt. --- .github/workflows/build.yml | 10 ++++++++-- tools/build_local.sh | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c2d479537..371911e9f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -26,7 +26,7 @@ concurrency: cancel-in-progress: true env: - PRELOAD_CACHE_VERSION: v1 + PRELOAD_CACHE_VERSION: v2 jobs: build: @@ -160,7 +160,7 @@ jobs: D=app/src/main/assets/linuxfs mkdir -p "$D" aarch64-linux-gnu-g++ -shared -fPIC -O2 -Wall -Wno-attributes -Wno-nonnull-compare \ - -pthread -std=c++17 -static-libstdc++ -static-libgcc \ + -pthread -std=c++17 -static-libstdc++ -static-libgcc -Wl,--exclude-libs,ALL \ -o "$D/libfakeinput.so" app/src/main/cpp/fakeinput_steam.cpp -ldl aarch64-linux-gnu-strip --strip-unneeded "$D/libfakeinput.so" aarch64-linux-gnu-gcc -shared -fPIC -O2 -Wall -pthread \ @@ -270,6 +270,12 @@ jobs: for sym in open openat ioctl read close poll ppoll select stat fstat access scandir; do grep -qx "$sym" <<<"$FAKE" || { echo "::error::libfakeinput.so does not export $sym"; exit 1; } done + # The static C++ runtime stays private: every session process preloads this library, + # and an exported personality routine takes over other programs' unwinding (shadPS4 + # aborted in pthread_exit). + if grep -qxE '__gxx_personality_v0|__cxa_throw|_Unwind_Resume' <<<"$FAKE"; then + echo "::error::libfakeinput.so exports the C++ runtime"; exit 1 + fi SESSION=$(syms "$D/libblsession.so") for sym in socket bind getsockname setsockopt statfs statvfs; do grep -qx "$sym" <<<"$SESSION" || { echo "::error::libblsession.so does not export $sym"; exit 1; } diff --git a/tools/build_local.sh b/tools/build_local.sh index 09040662f..6673e469c 100755 --- a/tools/build_local.sh +++ b/tools/build_local.sh @@ -100,7 +100,7 @@ docker run --rm --platform linux/amd64 \ d=app/src/main/assets/linuxfs mkdir -p "$d" aarch64-linux-gnu-g++ -shared -fPIC -O2 -Wall -Wno-attributes -Wno-nonnull-compare \ - -pthread -std=c++17 -static-libstdc++ -static-libgcc \ + -pthread -std=c++17 -static-libstdc++ -static-libgcc -Wl,--exclude-libs,ALL \ -o "$d/libfakeinput.so" app/src/main/cpp/fakeinput_steam.cpp -ldl aarch64-linux-gnu-strip --strip-unneeded "$d/libfakeinput.so" aarch64-linux-gnu-gcc -shared -fPIC -O2 -Wall -pthread \