diff --git a/zygisk/module/daemon b/zygisk/module/daemon index 3b1dec4a5f..79a70d7991 100644 --- a/zygisk/module/daemon +++ b/zygisk/module/daemon @@ -25,9 +25,16 @@ if [ "$debug" = "true" ]; then fi fi -# Mount an empty temporary file system over /data/resource-cache to avoid possible overlay conflicts. +# Shadow /data/resource-cache with an empty directory of our own: initializing the framework assets +# in a root app_process forks `idmap2 create-multiple`, which would otherwise write the immutable +# framework idmaps of this boot into the cache every other process shares. Bind an empty directory +# rather than a tmpfs: a bind mount reuses the superblock of /data, so it claims none of the +# kernel-global anonymous device minors, whose gaps are visible from any process on the device. # Note that this script runs inside an isolated mount namespace (via unshare). -mount tmpfs -t tmpfs /data/resource-cache +emptyDir="$dir/.resource-cache" +rm -rf "$emptyDir" +mkdir -p "$emptyDir" +mount -o bind "$emptyDir" /data/resource-cache # Wait for Zygote socket using a polling loop if [ ! -S "/dev/socket/zygote" ]; then