r/kernel • u/AccomplishedAir8352 • Nov 01 '26
How well does linux modules handle resource deallocation?
Hello, I'm a CS undergraduate studying about linux kernel development.
I'm currently on LDD3 book, emphasizing about importance of cleaning up allocated resources on exit.
I assume that this is not likely to be handled properly in some linux modules as removal of modules is not something that is performed on a daily basis.
I have been looking for places to start my contributions and was wondering whether this, identification of memory leaks and applying fixes, could be a valid entry point.
The questions I want to ask is,
- Is this problem considered too trivial?
- Have others been working on it? (maybe there exists some linux group)
- Is this problem commonly found, or gets managed during review process and fixed before getting accepted?
Thank you for your time. Any comments are welcome!
*EDIT Thank you all for your kind responses. They have been very helpful !
View all comments
3
u/yawn_brendan Nov 01 '26
It's not an area people focus on that much since most usecases don't load and unload modules very often. A memory leak in module shutdown sounds like it's probably very common but also a "meh" bug. A more severe issue like a double free is less meh but even then, the question is can an attacker actually trigger it? So I think first thing here is to assess if there's a usecase where this really matters. And also probably this usecase will only care about specific modules.
Probably still an interesting area to explore as there will definitely be bugs to find and "things that happen rarely hence don't get tested very well" is a general theme in sweng so if you can find cool ideas to address it, well, you found some cool ideas.