Re: Try/catch for modules?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On Thu, Oct 17, 2019, 09:42 Maria Neptune <maria.elysse.n@xxxxxxxxx> wrote:
I hate to say it but honestly in a kernel module, your solution is not to do null dereferences. It's hard but you gotta.
Otherwise I've seen quite a bit of error handling done with gotos (if ptr==0 goto error), which I believe compiles to similar code as try/except blocks. Unsure how you'd handle stuff that sends a signal like null dereferences in that way though. 

On Thu, Oct 17, 2019, 09:37 Martin Galvan <omgalvan.86@xxxxxxxxx> wrote:
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.

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]

  Powered by Linux