kpm: build NoMount as a KernelPatch module (6.6 and older) - #48
kpm: build NoMount as a KernelPatch module (6.6 and older)#48Bouteillepleine wants to merge 164 commits into
Conversation
- kernel/: - Implement the `NM_FLAG_WHITEOUT` bitmask to explicitly hide existing physical files from the VFS. - Intercept `iterate_dir` via `nomount_actor_proxy` to silently drop `dir_context` entries flagged with `NM_FLAG_WHITEOUT`. - Strip trailing slashes and handle whiteouts safely in-place within `nomount_handle_getname`. - Refactor private dirs logic from path-based string matching to pure inode/dentry tracking. - Unify multiple RCU read lock sections and sequential hash table lookups into a single O(1) pass within `nomount_handle_getattr` and `nomount_handle_permission` to reduce CPU cache thrashing and lock contention. - Fix a critical logic error by replacing bitwise masking `switch` statements with sequential `if` conditions in inode spoofing routines. - Add missing `u8 flags` member to `struct nomount_child_name` to allow flag inheritance in the virtual topology array. - Remove `__nomount_is_injected_file_rcu` and `__nomount_is_traversal_allowed_rcu` helpers. - userspace/: - Extend Netlink payload struct to pack `NM_FLAG_WHITEOUT` instructions via the new `w` command argument in the `nm` CLI tool. - Adapt the JSON and raw `nm list` parsers to properly identify and print whiteout entries natively from the Netlink attribute header. - module/: - Add support for traditional OverlayFS character device (`mknod`) and Magisk `.replace` syntax detection during the boot phase inside `metamount.sh`. - 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`.
- Switched to Flexible Array Members (FAM) to eliminate SLUB overhead. - Removed compiler padding and redundant struct list_heads. - Implemented an 8KB static u8 counting filter for lockless getname rejection. - Optimized Netlink batch routing to use direct memory access without copy. - Improved iterate_dir proxy by replacing strlen with boundary checks. Dramatically reduces unpageable memory usage and VFS latency overhead.
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
…oc/keys hijacking
Now kernel integration is handled by the automatic setup.sh script, kernel patches are not needed anymore
|
I don't understand this pull request. Are you planning to create a .kpm file for each kernel version? Wouldn't that be the same as an LKM file? Because as far as I know, a .kpm file has to be universal, regardless of the kernel version. I don't know if I'm wrong; I haven't worked with KPM. But if the purpose of this pull request is to create a .kpm file for each kernel version, I don't see it as feasible. And yes, I know this pull request has been around for a while, but I've been busy fixing bugs. Now the dev branch is in a "stable" state, so I have more time for other things, like reviewing these kinds of pull requests. |
|
KPM's a nice feature, 6.12 doesn't handle KPM for some reason (that's my kernel's phone). So if you want it, that's the pr reason, and i think it is ready upto 6.6. Function calls resolve via kallsyms_lookup_name() at load, so that's already version-agnostic. The matrix is for raw struct field offsets (i_rwsem, idr_rt, rb_leftmost...), which come from kernel headers at compile time and shift across major versions. One .o built for one version has wrong offsets on another. |
47bfc92 to
2d77d4d
Compare
# Conflicts: # kernel/README.md # kernel/setup.sh # kernel/src/nomount.c # kernel/src/nomount.h
Builds the existing engine as a KernelPatch module, so it can be loaded at runtime on a KernelPatch host instead of being compiled into the kernel.