kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
From: Ruben Safir <ruben@mrbrklyn.com>
To: Martin Galvan <omgalvan.86@gmail.com>
Cc: "Bernd Petrovitsch" <bernd@petrovitsch.priv.at>,
	"Valdis Klētnieks" <valdis.kletnieks@vt.edu>,
	kernelnewbies@kernelnewbies.org
Subject: Re: Try/catch for modules?
Date: Fri, 18 Oct 2019 13:02:10 -0400	[thread overview]
Message-ID: <20191018170209.GA11480@www2.mrbrklyn.com> (raw)
In-Reply-To: <CAN19L9G=QLYnXjFWT_uq3pbjHShYfgsUppUyu-xz+_w6yNLmdQ@mail.gmail.com>

On Fri, Oct 18, 2019 at 01:11:54PM -0300, Martin Galvan wrote:
> El vie., 18 oct. 2019 a las 13:05, Bernd Petrovitsch
> (<bernd@petrovitsch.priv.at>) escribió:
> > You actually want speed in the kernel and not necessarily extra effort
> > for "try" and "catch" which is - sooner or later - never really used.
> > And the "safety net" reduces the motivation to actually fix pointer bugs ....
> 
> I don't think I was clear. My intent is that if a pointer bug isn't
> fixed, my module will fail gracefully and go through the catch block
> instead of panicking the whole system. I don't see how this would stop
> me from fixing the bug itself; if anything, it could even help me
> debug it.
> 


I don't think you really understand what is going on here.  On the
kernel level you would never wrap up a process in another process in
order to catch a mistake, and then do error correction.  That method of
programming is not appropriate for kernel level code where you are
running everything on the hardware.

You can test for a condition before you run the code, and use GOTO if
you want, but you are not doing a Java like Catch and Throw.


> > A ioctl-handler runs in the context/on behalf/... of a process
> > (read: a user-space process/thread has called a syscall).
> 
> Yes.
> 
> > And there may be other code in your module which doesn't run
> > on behalf of a process/thread, e.g. triggered by a timer, hardware
> > IRQ, ...
> 
> That's an interesting point. Yes, my die_notifier will run in
> exception context, but current->pid will still match that of the
> process which triggered the exception. I don't know if this happens by
> definition or it's just a coincidence, but it seems to work.
> 
> _______________________________________________
> 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://www2.mrbrklyn.com/resources - Unpublished Archive 
http://www.coinhangout.com - coins!
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


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

  parent reply	other threads:[~2019-10-18 17:02 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-17 13:37 Try/catch for modules? Martin Galvan
     [not found] ` <CAG=DERmX7AU8YkEAYnPLfPKCLD=1OugmD95R9wZ3CepXvqzd2Q@mail.gmail.com>
2019-10-17 13:42   ` Maria Neptune
2019-10-17 13:51     ` Ruben Safir
2019-10-17 22:12 ` Valdis Klētnieks
2019-10-18 15:43   ` Martin Galvan
2019-10-18 15:47     ` Anuz Pratap Singh Tomar
2019-10-18 15:48     ` Maria Neptune
2019-10-18 16:04     ` Bernd Petrovitsch
2019-10-18 16:11       ` Martin Galvan
2019-10-18 16:18         ` Bernd Petrovitsch
2019-10-18 17:02         ` Ruben Safir [this message]
2019-10-18 17:05           ` Martin Galvan
2019-10-18 18:52             ` Ruben Safir
2019-10-18 18:53             ` Ruben Safir
2019-10-18 19:08               ` Ruben Safir
2019-10-18 21:53         ` Valdis Klētnieks
2019-10-18 22:09           ` Martin Galvan
2019-10-18 22:28             ` Greg KH
2019-10-18 18:48     ` Ruben Safir
2019-10-18 21:24     ` Rik van Riel
2019-10-18 21:32       ` Ruben Safir
2019-10-18 21:37       ` Ruben Safir
2019-10-18 22:59     ` Valdis Klētnieks
2019-10-19  7:46 ` Bjørn Mork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191018170209.GA11480@www2.mrbrklyn.com \
    --to=ruben@mrbrklyn.com \
    --cc=bernd@petrovitsch.priv.at \
    --cc=kernelnewbies@kernelnewbies.org \
    --cc=omgalvan.86@gmail.com \
    --cc=valdis.kletnieks@vt.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).