If a user process is working with kernel module, I want that another process can’t fire rmmod for that module.
How to achieve this type of functionality?
-beginner in Linux kernel programming.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
rmmodcan only unload a module when the refcount is zero.If the reference count is incremented when a user process is connected (and decremented when it disconnects), you’ll be fine.
If the module exposes a device, or is mounted as a filesystem, this should be handled naturally – if not, I guess it’ll depend on the userspace interface, but this where to start looking.
By the way,
lsmodwill show your module refcount. You can check whether it’s incremented when the userspace process connects.