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.7 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,HTML_MESSAGE,HTML_OBFUSCATE_05_10, 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 5250EC2B9F4 for ; Mon, 14 Jun 2021 15:12:13 +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 07C1C6124B for ; Mon, 14 Jun 2021 15:12:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 07C1C6124B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kernelnewbies-bounces@kernelnewbies.org Received: from localhost ([::1] helo=shelob.surriel.com) by shelob.surriel.com with esmtp (Exim 4.94.2) (envelope-from ) id 1lsoFU-00081T-EK; Mon, 14 Jun 2021 11:11:36 -0400 Received: from mail-il1-x12e.google.com ([2607:f8b0:4864:20::12e]) by shelob.surriel.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1lsoFS-00080M-FT for kernelnewbies@kernelnewbies.org; Mon, 14 Jun 2021 11:11:34 -0400 Received: by mail-il1-x12e.google.com with SMTP id w14so12519971ilv.1 for ; Mon, 14 Jun 2021 08:11:34 -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=W2/q12A9ehNXvuGRDNwdemZ7tzcO5b9OrOXCETTsWE8=; b=fdevHy0XYgaNx/XgYmPHTH7HYC6SS8qn1zIrzyuRxQ4ukAvuQuFdWJd0LbunHyhntn Rekpl+B/xyhejb8SAKGAy5njxymvbuD7GR8wMwCAcmoczi9USxIs3QZyIVTpeufm/dA2 KNFqfVNllKIE1Nt6bHQ0ep/+9d20PS3I6aVkLs+R/fNRn465JQnbovJSWij3Mb9vi5tq DY1Zs9BpJOyOaFiQPzg4kefC+DCdvXjBLY1oY7cfY2yvZi0nw5+QJMuhAJqHTsMaC9Y7 DVCA7mhIK7cl1H9dSPY7mL7Bec979UkyavmTlSWs97UXXm+RJEMr7OKxhnbdv/3Vhi5q msEg== 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=W2/q12A9ehNXvuGRDNwdemZ7tzcO5b9OrOXCETTsWE8=; b=cnDi59/of4eX0aMAWyNuzoLP+Twc9qXIa4NFi7GoCV1est/sBranDg/rfEOEM7VEnf k+SRHAG2r3Hs0LLjLswiQfGssO2mmD3M1wRgl2SsLoykPyRRriJu0ed50uEbwdTKkdbt oox2I8nm3CmYan6AyRYC8mx/uHN81eKvKe1t4SlvPjc5YpzaSN6pFc9HqZGS2qE7+Iks 79blcES6MMlfReocwS4wDU8C0QR0oHgOgHtuw5fYESuuqBodYl0AzCTRJz+2/ccHUZ6Y EVIKA5l6Ad/EzYq0sovyEUPmx3j4xkWmc1JLXPB07b1a83Cu574+8nXGpRoc9N5KWale Y51Q== X-Gm-Message-State: AOAM533HPbNPIU4hd+G6qEVHY4U3996vNET4MCE0VPttNuw2vFccTXvG OousWV8yrl8RjCUh3g4NWpQeFbEk1ZpYtcG5tbG3cROZ6fM85w== X-Google-Smtp-Source: ABdhPJyg1tEeRkluV03FMdgafJqs75Ol72Y+QuQm6arPCZYoLyNJwpxthCQGygnQpN1fOl1slKY67YknD6r9KKjE2NE= X-Received: by 2002:a92:8e04:: with SMTP id c4mr14663147ild.219.1623683492420; Mon, 14 Jun 2021 08:11:32 -0700 (PDT) MIME-Version: 1.0 From: hemanth nandish Date: Mon, 14 Jun 2021 20:40:57 +0530 Message-ID: Subject: Getting backtrace of a process 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: multipart/mixed; boundary="===============9148719449439785574==" Errors-To: kernelnewbies-bounces@kernelnewbies.org --===============9148719449439785574== Content-Type: multipart/alternative; boundary="000000000000cb20b705c4bb45b4" --000000000000cb20b705c4bb45b4 Content-Type: text/plain; charset="UTF-8" I am trying to get create a custom error log of a process when it causes a segmentation fault. We can modify the* /proc/sys/kernel/core_pattern* file to pipe the core information to a handler binary. I am trying to use the *libunwind *library within this handler to also get the backtrace information but it is failing. As per my understanding, the *do_coredump* kills the faulty process inside *coredump_wait* function before invoking the userspace handler, This might be the reason the libunwind fails to gather the backtrace as it uses PTRACE calls. Is there any way to overcome this without modifying the kernel code? --000000000000cb20b705c4bb45b4 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I am trying to get create a custom error log of a process = when it causes a segmentation fault.
We can modify the /proc/sys/ker= nel/core_pattern file to pipe the core information to a handler binary.=

I am trying to use the libunwind library within = this handler to also get the backtrace information but it is failing.
=

As per my understanding, the do_coredump=C2=A0ki= lls the faulty process inside=20 coredump_wait=C2=A0 function before invoking the userspace ha= ndler,
This might be the reason the libunwind=C2=A0fails to gathe= r the backtrace as it uses PTRACE calls.

Is there = any way to overcome this without modifying the kernel code?

<= /div>

--000000000000cb20b705c4bb45b4-- --===============9148719449439785574== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies --===============9148719449439785574==--