Try/catch for modules?
Maria Neptune
maria.elysse.n at gmail.com
Thu Oct 17 09:42:50 EDT 2019
On Thu, Oct 17, 2019, 09:42 Maria Neptune <maria.elysse.n at gmail.com> 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 at gmail.com> 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 at kernelnewbies.org
>> https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20191017/8924d59f/attachment.html>
More information about the Kernelnewbies
mailing list