mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Colen Garoutte-Carson <coleng@microsoft.com>
To: "musl@lists.openwall.com" <musl@lists.openwall.com>
Subject: [musl] incomplete GDB backtrace stacks with MUSL cross toolchain
Date: Wed, 13 Mar 2024 01:16:47 +0000	[thread overview]
Message-ID: <DM6PR21MB16125BA8BB0FF55562BFD7AFCD2A2@DM6PR21MB1612.namprd21.prod.outlook.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1731 bytes --]

Hi,

                 We're using MUSL cross-compilation toolchains to build fully statically linked binaries, targeting x86_64, aarch64, and armel. (Which allows us to work around some issues with glibc incompatibilities)

                 If we connect GDB to our process and get a backtrace, we get very little.  i.e.:

__syscall_cp_c (Unknown Source:0)
__timedwait_cp (Unknown Source:0)
[Unknown/Just-In-Time compiled code] (Unknown Source:0)

Or:

__stdio_read (Unknown Source:0)
[Unknown/Just-In-Time compiled code] (Unknown Source:0)

                 We'd really like to get the rest of these stacks to investigate issues such as deadlocks, for example (among several other reasons, such as our own crash reporting handler).

                 I found related info on StackOverflow, such as: debugging - Why does gdb backtrace show only one frame when catching syscall? - Stack Overflow<https://stackoverflow.com/questions/29764951/why-does-gdb-backtrace-show-only-one-frame-when-catching-syscall>
                 And: c - Stack frame NULL in backtrace log - Stack Overflow<https://stackoverflow.com/questions/26214936/stack-frame-null-in-backtrace-log>

                 My hypothesis is that we're calling into code that does not provide the stack unwind descriptors needed by GDB.  The first of the above links refers specifically to MUSL and patching it (but for MIPS).

                 I've tried building a fresh MUSL (1.2.4) GCC (13.2.0) toolchain, and the issue persists with a binary built with it.

                 Can someone explain what we're running into here, and whether there is a potential solution (even if we may have to contribute it ourselves)?

Thanks!,

  *   Colen


[-- Attachment #2: Type: text/html, Size: 10100 bytes --]

             reply	other threads:[~2024-03-13 13:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-13  1:16 Colen Garoutte-Carson [this message]
2024-03-13 20:01 ` Szabolcs Nagy

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=DM6PR21MB16125BA8BB0FF55562BFD7AFCD2A2@DM6PR21MB1612.namprd21.prod.outlook.com \
    --to=coleng@microsoft.com \
    --cc=musl@lists.openwall.com \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

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).