5

Or is it possible to overcome the fault, since the code isn't in the monolithic part of the kernel?

6
  • I suppose it depends where in the module the fault occurs. If it happens during registering/unregistering with the kernel or another subsystem. I may take the entire system with it. If it's just the module suddently stopping, I think the kernel should be able to recover. – Bananguin Aug 16 '13 at 18:24
  • How about an endless loop? – TheMeaningfulEngineer Aug 16 '13 at 18:27
  • Can't tell you, but I think it still depends where the endless loop occurs. Modules are scheduled threads, afaik. So it probably wouldn't kill your system entirely. However, I have no clue how tolerant the kernel is. – Bananguin Aug 16 '13 at 18:29
  • Do you have some reference on the following: Modules are scheduled threads. Would like to read it, I had a completely different perspective. – TheMeaningfulEngineer Aug 16 '13 at 18:30
  • 1
    No, a fault in a module does not necessarily result in a system crash. @user1129682 There are kernel threads. Since a module is fundamentally a set of callbacks, however, they operate in the context of the calling thread, and this invocation does not represent a new one any more than calling a normal function would. However, you may create kernel threads from within module code. – goldilocks Aug 16 '13 at 19:10
1

It is possible to be overcome from here:

You should also give some thought to where you do your module experimentation, development, and testing. We have done our best to make our example modules safe and correct, but the possibility of bugs is always present. Faults in kernel code can bring about the demise of a user process or, occasionally, the entire system. They do not normally create more serious problems, such as disk corruption. Nonetheless, it is advisable to do your kernel experimentation on a system that does not contain data that you cannot afford to lose, and that does not perform essential services. Kernel hackers typically keep a “sacrificial” system around for the purpose of testing new code.

1

You can call BUG() or BUG_ON(condition) in kernel module to result in a system crash!

1

A fault in a kernel module may bring down a process if the module is running in process context, (e.g: due to a syscall), or it may bring down the system, if the module is running in interrupt context. Faults while registering/unregistering the module may hang the insmod/modprobe process, and of course you won't be able to unload the module. Infinite loops may leave a core/CPU running at full throttle, and unavailable to other processes.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.