From 7fa7e7f05d9fca5585afcec833ab787f34ac746f Mon Sep 17 00:00:00 2001 From: Kurt Himebauch <136133082+xXJSONDeruloXx@users.noreply.github.com> Date: Sun, 8 Nov 2026 16:53:38 -0500 Subject: [PATCH] docs(native): how to test under Android's seccomp filter --- tools/nativeguest/README.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tools/nativeguest/README.md b/tools/nativeguest/README.md index 71b50750b5..19571de96c 100644 --- a/tools/nativeguest/README.md +++ b/tools/nativeguest/README.md @@ -16,3 +16,19 @@ same length: the code compares environment names by length) and extended with: - starting Wine without its static preloader, which opens files with raw system calls. Build: `tools/nativeguest/build.sh out.so` with an aarch64 glibc cross compiler. + +## Testing under Android's seccomp filter + +Some devices (eng builds, `setenforce 0` ROMs) run apps with no seccomp filter, so a hook that +passes there can still die with SIGSYS on a stock phone (`GUEST_EXIT 159`). `seccomp-sim.c` applies +a filter that answers the calls Android blocks with SIGSYS, then runs the program: + +``` +aarch64-linux-gnu-gcc -static -O2 -o seccomp-sim tools/nativeguest/seccomp-sim.c +# copy it into the rootfs, then name it for every native launch: +echo /usr/local/bin/seccomp-sim > /etc/droiddeck/seccomp-sim +``` + +`grep Seccomp: /proc//status` should then show `2` for the session's processes. Empty the file +to turn it off. `seccomp-sim -a NR,NR PROGRAM` leaves the listed calls allowed, to find which one +kills a program.