Re: Try/catch for modules?
On Thu, Oct 17, 2019, 09:42 Maria Neptune <maria.elysse.n@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@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@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
you are going to use a try and catch in the kernel? On 10/17/19 9:42 AM, Maria Neptune wrote:
On Thu, Oct 17, 2019, 09:42 Maria Neptune <maria.elysse.n@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@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@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
-- So many immigrant groups have swept through our town that Brooklyn, like Atlantis, reaches mythological proportions in the mind of the world - RI Safir 1998 http://www.mrbrklyn.com DRM is THEFT - We are the STAKEHOLDERS - RI Safir 2002 http://www.nylxs.com - Leadership Development in Free Software http://www.brooklyn-living.com Being so tracked is for FARM ANIMALS and extermination camps, but incompatible with living as a free human being. -RI Safir 2013
participants (2)
-
Maria Neptune -
Ruben Safir