Try/catch for modules?

Martin Galvan omgalvan.86 at gmail.com
Thu Oct 17 09:37:09 EDT 2019


Hi all,

I'm writing a kernel module, and am trying to implement some
exception-handling mechanism so that the system won't oops/panic if my
module does e.g. a NULL dereference. The (horribly hackish) way I'm
doing this right now is registering a die_notifier which will set the
'panic_on_oops' variable to 0 if we detect that the current PID
corresponds to my module. However, this is ugly for many reasons.

What would be the "standard" way of doing this? Is there something
like Window's try/except blocks, where I can get back control of the
execution flow, without having the process die? I'm aware of
_ASM_EXTABLE, but I understand this only works for a single
instruction and has other limitations.



More information about the Kernelnewbies mailing list