Try/catch for modules?

Valdis Kl=?utf-8?Q?=c4=93?=tnieks valdis.kletnieks at vt.edu
Thu Oct 17 18:12:57 EDT 2019


On Thu, 17 Oct 2019 10:37:09 -0300, Martin Galvan said:
> 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.

For starters, the *correct* in-kernel way to deal with this is:
	if (!ptr) {
		printk("You blew it!\n");
		goto you_blew_it;
	}

Also, "current PID" and "my module" aren't two things that can correspond....

For double bonus points - this sort of "ignore the error if it's my process" means
that any other user can trigger the situation - and crash the system.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20191017/7aec1a72/attachment.sig>


More information about the Kernelnewbies mailing list