From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 22571CA9EA9 for ; Fri, 18 Oct 2019 17:02:40 +0000 (UTC) Received: from shelob.surriel.com (shelob.surriel.com [96.67.55.147]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B0B962064A for ; Fri, 18 Oct 2019 17:02:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B0B962064A Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=mrbrklyn.com Authentication-Results: mail.kernel.org; spf=fail smtp.mailfrom=kernelnewbies-bounces@kernelnewbies.org Received: from localhost ([::1] helo=shelob.surriel.com) by shelob.surriel.com with esmtp (Exim 4.92.3) (envelope-from ) id 1iLVdm-0007sg-Nv; Fri, 18 Oct 2019 13:02:14 -0400 Received: from www2.mrbrklyn.com ([96.57.23.82] helo=mrbrklyn.com) by shelob.surriel.com with esmtp (Exim 4.92.3) (envelope-from ) id 1iLVdk-0007sa-Ej for kernelnewbies@kernelnewbies.org; Fri, 18 Oct 2019 13:02:12 -0400 Received: by mrbrklyn.com (Postfix, from userid 1000) id 43F65161134; Fri, 18 Oct 2019 13:02:10 -0400 (EDT) Date: Fri, 18 Oct 2019 13:02:10 -0400 From: Ruben Safir To: Martin Galvan Subject: Re: Try/catch for modules? Message-ID: <20191018170209.GA11480@www2.mrbrklyn.com> References: <29246.1571350377@turing-police> <24fe8b41-2bc0-181e-7252-9e787949ab68@petrovitsch.priv.at> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Cc: Bernd Petrovitsch , Valdis =?utf-8?Q?Kl=C4=93tnieks?= , kernelnewbies@kernelnewbies.org X-BeenThere: kernelnewbies@kernelnewbies.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Learn about the Linux kernel List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Errors-To: kernelnewbies-bounces@kernelnewbies.org On Fri, Oct 18, 2019 at 01:11:54PM -0300, Martin Galvan wrote: > El vie., 18 oct. 2019 a las 13:05, Bernd Petrovitsch > () escribi=F3: > > 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 bug= s .... > = > 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