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=-0.4 required=3.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED 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 82F94FA3735 for ; Thu, 17 Oct 2019 13:38:01 +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 450252089C for ; Thu, 17 Oct 2019 13:38:00 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="bSyolyYQ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 450252089C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.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 1iL5y4-0005Ta-WC; Thu, 17 Oct 2019 09:37:29 -0400 Received: from mail-oi1-x229.google.com ([2607:f8b0:4864:20::229]) by shelob.surriel.com with esmtps (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.92.3) (envelope-from ) id 1iL5y3-0005TO-1J for kernelnewbies@kernelnewbies.org; Thu, 17 Oct 2019 09:37:27 -0400 Received: by mail-oi1-x229.google.com with SMTP id t84so2128826oih.10 for ; Thu, 17 Oct 2019 06:37:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=Qa7LXNx0ZOU75jwEFW+eFosiuDeKL/yEV4Aig8LtVkk=; b=bSyolyYQrQDEwSG0j4k9ja3J4DtqMpBVctOFtd5rjLjSGMGz0lf6n7hgjBwEfEmoqW 56H2qiYCVNF5aWGexspAetiwMBDituHiK53TvEwQ6bb38q8Xuv2rBRcmPnhJO5YhFmRM NEWpxlILvvXt7E2U3r7rq9NJAhWrt/B+foPVsHYe/3xZw76A+p+0ptS0q1yPmbAd69RP ZI9gJGtq/mLGrcNbKdV+MlCDEi4qBDF2zXL362F4TNXASocOCayiDY1qAucW6ZNXEvB/ 78iodQeXlmThDtsJ4a5eOwo8bkQyvxwdcAdPyUkvyUzVItk2+kxkirVILTYzdyCViM4J k1uA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=Qa7LXNx0ZOU75jwEFW+eFosiuDeKL/yEV4Aig8LtVkk=; b=Aq5GrUjTrcPkUccxhoWK9CKLGx6+lcptbn/CTeeyKZmIBJ/6ddLUMtowYpXEb/eFs0 yku8JVA1lFro75YjCrYtI7aAQohmVwG28ndLQppWEvWYOoyXVyRPU4G2z4nluKzVb0yG KdAqnTZ1kGNtS0xKztNwsG2ntsZ/M5zi5Edre1/BpPVHmeX2sTUWrqGncHr1SjpEo/Vq yy/yXrEBL4wVwY8NTTnVmkzuVNcMFXeBITFALy6F0/Jo0d019vnuFwnhjc1gFpsN5LO1 rEx4/FKmherfiW8q3uvXMOxfc8vZ5WwFeLrJS5ufTU/ElZoPM5+NmB59yGrpPf75yeRz ceiA== X-Gm-Message-State: APjAAAXMSh8t/PSPOaqtLF8vTIB8LCiiqST2sXpsIVLlehHZhtBNVkR4 ESg4b1EWfXYp6X6G3JkSUMmcli9ZaptyclNylO/xzTuH X-Google-Smtp-Source: APXvYqxNucLY1hdU+rItlwGUaBbT6GMIKM9fGPvm0jtsA4TMesoOyMW5Mlg+W5gqaAtqssO5ijxaQ5o/DTdTk/oa2x0= X-Received: by 2002:aca:df84:: with SMTP id w126mr3320823oig.79.1571319442395; Thu, 17 Oct 2019 06:37:22 -0700 (PDT) MIME-Version: 1.0 From: Martin Galvan Date: Thu, 17 Oct 2019 10:37:09 -0300 Message-ID: Subject: Try/catch for modules? To: 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="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: kernelnewbies-bounces@kernelnewbies.org 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