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 BA490FA372A for ; Thu, 17 Oct 2019 13:54:04 +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 786DD2082C for ; Thu, 17 Oct 2019 13:54:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 786DD2082C 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 1iL6Dm-0006Tr-9D; Thu, 17 Oct 2019 09:53:42 -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 1iL6Dj-0006Th-UV for kernelnewbies@kernelnewbies.org; Thu, 17 Oct 2019 09:53:40 -0400 Received: from [10.0.0.62] (www.mrbrklyn.com [96.57.23.83]) by mrbrklyn.com (Postfix) with ESMTP id F41A4161132 for ; Thu, 17 Oct 2019 09:53:38 -0400 (EDT) Subject: Re: Try/catch for modules? To: kernelnewbies@kernelnewbies.org References: From: Ruben Safir Message-ID: <91ce24cd-5c29-130f-d656-b04ac21125db@mrbrklyn.com> Date: Thu, 17 Oct 2019 09:51:40 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.1.1 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US 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="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: kernelnewbies-bounces@kernelnewbies.org 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 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 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 _______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies