From 04f93dbe5b6ddfdee8cc8c2ae9d14c31693b5b6a Mon Sep 17 00:00:00 2001 From: Kurt Himebauch <136133082+xXJSONDeruloXx@users.noreply.github.com> Date: Mon, 9 Nov 2026 22:27:25 -0500 Subject: [PATCH] fix(native): a sandbox whose loader can't be patched runs under proot --- .../java/com/droiddeck/launcher/runtime/BwrapSpawner.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/droiddeck/launcher/runtime/BwrapSpawner.kt b/app/src/main/java/com/droiddeck/launcher/runtime/BwrapSpawner.kt index 3e8307599..a64fe4fec 100644 --- a/app/src/main/java/com/droiddeck/launcher/runtime/BwrapSpawner.kt +++ b/app/src/main/java/com/droiddeck/launcher/runtime/BwrapSpawner.kt @@ -398,8 +398,10 @@ object BwrapSpawner { for (file in listOf(loader, libc)) { val key = "${file.path}:${file.length()}:${file.lastModified()}" if (key in seccompPatched) continue - runCatching { ElfSeccompPatch.patchFile(file) } - .onFailure { Log.e(TAG, "native userland: could not patch $file for Android's seccomp filter", it) } + // an unpatched loader or libc dies under Android's filter before the hook loads: proot runs it + val patched = runCatching { ElfSeccompPatch.patchFile(file) } + .onFailure { Log.e(TAG, "native userland: could not patch $file for Android's seccomp filter; proot runs the sandbox", it) } + if (patched.isFailure) return null seccompPatched.add("${file.path}:${file.length()}:${file.lastModified()}") } val program = host(plan.envTool).canonicalFile.takeIf { it.isFile } ?: return null