Skip to content

nomount: replace in-kernel hooks for hijacking VFS structures, implement whiteouts, and refactor code - #23

Merged
maxsteeel merged 163 commits into
masterfrom
dev
Aug 24, 2026
Merged

nomount: replace in-kernel hooks for hijacking VFS structures, implement whiteouts, and refactor code#23
maxsteeel merged 163 commits into
masterfrom
dev

Conversation

@maxsteeel

@maxsteeel maxsteeel commented Jul 2, 2026

Copy link
Copy Markdown
Owner

There are too many changes made in this PR, so I will only highlight the most relevant and important ones here.

  • kernel/:

    • Remove all in-kernel hooks in favor of hijacking of i_op / f_op / s_op structures of rules injected.
    • Added official support to LKM mode. Added a Kconfig and a Makefile and also its respective workflow to compile LKM's into the module.
    • Implement the NM_FLAG_WHITEOUT bitmask to explicitly hide existing physical files from the VFS.
    • Replace hashtable lookups for structure hijacking lookups for O(1) lookups in hot-paths.
    • Remove nomount_inodes_ht and nomount_inode_node. Added nm_inode_info to O(1) inode operations.
    • Replace directory child arrays to directory child arrays, to improve management of directory childs and also to optimize iterate_dir operations.
    • Replace UID exclusion lists/hashtables to a IDR tree for O(1) checks.
    • Replace Generic Netlink API to a Keyring-based Payload API. Now kernel-userspace communication is managed sending a payload via add_key() syscall to the kernel instead of Generic Netlink API.
    • Added an automatic setup.sh script to integrate NoMount into the kernel. Removed kernel patches.
    • Simplifying and removing dead code. Fixed a lot of weird bugs.
  • userspace/:

    • Replace Generic Netlink API to a Keyring-based Payload API. Now kernel-userspace communication is managed sending a payload via add_key() syscall to the kernel instead of Generic Netlink API.
    • Refactor nm binary commands, expanding it to a more ordenated and intuitive commands, while keeping support to legacy commands.
    • Extend payload struct to pack NM_FLAG_WHITEOUT instructions via the new w (whiteout) command argument in the nm CLI tool.
    • Adapt the JSON and raw nm list parsers to properly identify and print whiteout entries natively. Also add a UID list command to manage UID's excluded in a better form.
    • Implement UID-based rules operations. Now can add, o hide files / folders for some UID's
      • Example:
      • nm add /system/etc/hosts /data/adb/modules/hosts/system/etc/hosts --uid 10100
      • nm whiteout /system/etc/lineage.prop --uid 10240
    • Replace .bss buffers for a stack-based buffers, to avoid strange bugs in some devices when .bss is ignored.
    • Solved some little bugs.
  • module/:

    • Add support for traditional OverlayFS character device (mknod) and Magisk .replace syntax detection during the boot phase inside metamount.sh. In response of the issue [Question] Delete implementation method in NoMount #16
    • Added official support to LKM mode. Refactor the module to support the LKM mode.
    • Added a banner in WebUI status to show if using NoMount built-in or LKM by @nleloc.
    • Add a symlink from /data/adb/modules/nomount/bin/nm to /data/adb/ksu/bin in case of KSU or to /data/adb/ap/bin in case of APatch, by @nleloc.
    • Refactor xargs batching pipelines in metamount.sh and index.js to process up to the maximum ARG_MAX limit dynamically via null-byte (\0) streams.
    • Remove JSON parsing overhead from hot-unloading routines in the WebUI, opting for a direct unified file/symlink/char device file-system scan targeting nm d.
    • Implement UID exclusion list directly from kernel, to verify what's UID's are really blocked in kernel.
    • Remove the alias engine.

and a lot of other misc changes :)

@maxsteeel
maxsteeel marked this pull request as ready for review July 5, 2026 04:48
@maxsteeel
maxsteeel force-pushed the dev branch 2 times, most recently from a40e9bc to f453d10 Compare July 5, 2026 05:34
@maxsteeel
maxsteeel marked this pull request as draft July 12, 2026 21:14
@maxsteeel
maxsteeel marked this pull request as ready for review July 24, 2026 23:18
@maxsteeel
maxsteeel force-pushed the dev branch 10 times, most recently from 0a054d7 to ab51125 Compare August 3, 2026 01:45
@maxsteeel
maxsteeel force-pushed the dev branch 12 times, most recently from b364cc1 to 5397628 Compare August 9, 2026 19:41
maxsteeel and others added 24 commits August 24, 2026 03:13
based on `lsmod` output, shows current working mode as LKM or Built-in
added 2 more string to translate
- Add root implementation check and abort installation on Magisk
- Symlink `nm` to KSU / APatch `bin` folder on installation, make `nm` more accessible
Now kernel integration is handled by the automatic setup.sh script, kernel patches are not needed anymore
@maxsteeel maxsteeel changed the title nomount: implement whiteouts, hijacking hooks and refactor code nomount: replace in-kernel hooks for hijacking VFS structures, implement whiteouts, and refactor code Aug 24, 2026
@maxsteeel
maxsteeel merged commit 85966f6 into master Aug 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants