Skip to content

Module protection#57

Open
Cu63 wants to merge 2 commits intom0nad:masterfrom
Cu63:module_protection
Open

Module protection#57
Cu63 wants to merge 2 commits intom0nad:masterfrom
Cu63:module_protection

Conversation

@Cu63
Copy link
Copy Markdown
Contributor

@Cu63 Cu63 commented Apr 24, 2026

@m0nad

Add module protection against delete_module syscall

Introduces a protection mechanism that prevents the module from being
unloaded via delete_module by manipulating THIS_MODULE->refcnt.
While refcnt is non-zero, the kernel refuses to unload the module.

  • module_protect() — sets refcnt to a high value via atomic_set()
  • module_unprotect() — restores refcnt to 1
  • Signal 62 (SIGPROTECT) toggles protection state
  • Module starts protected by default on load (alongside being hidden)
Screenshot 2026-04-24 at 21 26 57

@m0nad
Copy link
Copy Markdown
Owner

m0nad commented Apr 27, 2026

Thanks for the PR.

The reference link on README seems to be broken.

Interesting technique, but I'm not full on-boarded. The reason is that I do not seek to add new functionalities to Diamorphine. Other PRs were rejected in the past for the same reason [#32 ].

Also, I don't know how this would keep the compatibility with older kernels and so on.

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.

2 participants