name: Add zeromount description: add zeromount to kernel runs: using: composite steps: - name: clone zeromount shell: bash run: | git clone https://github.com/jimsterino98/Super-Builders.git ZEROMOUNT="$ROOT/Super-Builders" echo "ZEROMOUNT=$ZEROMOUNT" >> $GITHUB_ENV - name: apply zeromount patches shell: bash run: | echo "adding zeromount..." cd "$COMMON" cp "$ZEROMOUNT/$ANDROID_VER-$KERNEL_VER/WildKSU/patches/60_zeromount-$ANDROID_VER-$KERNEL_VER.patch" . #patch -p1 < 51_enhanced_susfs_gki-$ANDROID_VER-$KERNEL_VER.patch || true patch -p1 < 60_zeromount-$ANDROID_VER-$KERNEL_VER.patch || true rm -rf 60_zeromount-$ANDROID_VER-$KERNEL_VER.patch if [ -f fs/proc/task_mmu.c.rej ]; then echo "Fixing task_mmu.c..." sed -i '/pgoff = ((loff_t)vma->vm_pgoff) << PAGE_SHIFT;/a\ #ifdef CONFIG_ZEROMOUNT\ \tzeromount_spoof_mmap_metadata(inode, \&dev, \&ino);\ #endif' fs/proc/task_mmu.c fi if [ -f fs/stat.c.rej ]; then echo "fixing stat.c." if ! grep -q 'zeromount_stat_hook(dfd, filename, stat, request_mask, flags)' fs/stat.c; then perl -0pi -e 's@(static int vfs_statx\(.*?\)\s*\{.*?orig_flow:\n#endif\n)@$1\n#ifdef CONFIG_ZEROMOUNT\n\tif (filename) {\n\t\tint zm_ret = zeromount_stat_hook(dfd, filename, stat, request_mask, flags);\n\t\tif (zm_ret != -ENOENT)\n\t\t\treturn zm_ret;\n\t}\n#endif\n\n@s' fs/stat.c fi fi if [ -f fs/Kconfig.rej ]; then echo "Applying Kconfig zeromount fix..." if ! grep -q '^config ZEROMOUNT$' fs/Kconfig; then perl -0pi -e 's@(config IO_WQ\n\tbool\n)@\1\nconfig ZEROMOUNT\n\tbool "ZeroMount Path Redirection Subsystem"\n\tdefault y\n\thelp\n\t ZeroMount allows path redirection and virtual file injection\n\t without mounting filesystems. Useful for systemless modifications.\n\n@' fs/Kconfig fi fi #patch -p1 < 70_ksu_safety-wksu-$KERNEL_VER.patch || true - name: apply zeromount patches shell: bash run: | "$COMMON/scripts/config" --file "$GKI_DEFCONFIG" --enable CONFIG_ZEROMOUNT