From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI, RCVD_IN_MSPIKE_H2 autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 18620 invoked from network); 2 Apr 2023 02:57:37 -0000 Received: from second.openwall.net (193.110.157.125) by inbox.vuxu.org with ESMTPUTF8; 2 Apr 2023 02:57:37 -0000 Received: (qmail 27815 invoked by uid 550); 2 Apr 2023 02:57:33 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 27779 invoked from network); 2 Apr 2023 02:57:33 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1680404241; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=/T1NvKEGgKnkMd8OUsjQbfJjecMqae9vwcoe+Z8jvYE=; b=AEgu1b1Fp16c86eRSVKQ9avVEAddHLWCfOgDAvZpGFhNEpfX6ONgosajudB5Sh0+Ow 47okfekxgOlTapOCt+zeddDlHYqYvcIuK2GcNcjzEowbocCBj5PUS7jHSFlWjQuvvV/i 68ky5tv2fFDgCowcsTj/+E8z6UQMUFMjP2eJyLWLEXFZYWIY/DnWH9okJBIn8JwVwcFc nVo6rwZAj7r6oBMSn3LJVVGt3vynDepYfdwWQsscWxEH8XHt+rOOof/++/gQxjuldgbm 1zwpTxYmC0YxBQ/zSMPKRPSTNXPDKmviU2+AxXbGHNOxwFkm4BNNIqHZa3c+tQbsQ8pY 84Rw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680404241; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/T1NvKEGgKnkMd8OUsjQbfJjecMqae9vwcoe+Z8jvYE=; b=qx2HeJY99Lh8M5pnTqXtzeEexbTnRnjyrwiLa2oBjq5b4q5FgsmlpnJFG707itu5Ps PZDTgx6l9i4Cqz8U3USW34OS5gQ4TtZu/mSSbkHWs/8kXGjfAOjG4I+Yb/ojn66xh1yA dFv3voZJ5Zj4cqxHci2eMfoKSa0y5aj7eJAIegoJ1ebDdCa9NNvoG+D70fNpJMk+PX+k iKnizMNan8PDnh+33V7juUpyq+QnvT/OiK3Sa1YuSJbvLIOr7/HtvkdmeW1BGbk1n+hB xu74THZ5RASl3XI7Ox01yDEpFP6FmNzfkJConeI4ZZ0NNXHnqNvKPOdAsKhOgjkAQ84i SFmQ== X-Gm-Message-State: AAQBX9fRUcJ5xGr9xmwhCOdsA6a3NrRaL9SdFOYnFRNvF4FcO1RYEQpT GioUEUg1+xKz0d6JPPafFxBRKIk25/02S8BODxw= X-Google-Smtp-Source: AKy350YRvYfuNTWlaHW8xDpChI/SOJ30B5lW8rDr146HE7ho4VYXvCTV13J28pfAH7xK6n047J26R6rdhpjdqjooZto= X-Received: by 2002:ac2:44d4:0:b0:4d8:5037:6da0 with SMTP id d20-20020ac244d4000000b004d850376da0mr9436002lfm.8.1680404241027; Sat, 01 Apr 2023 19:57:21 -0700 (PDT) MIME-Version: 1.0 References: <20230331114009.GF3630668@port70.net> In-Reply-To: <20230331114009.GF3630668@port70.net> From: Matt Wozniski Date: Sat, 1 Apr 2023 22:57:09 -0400 Message-ID: To: Matt Wozniski , musl@lists.openwall.com Cc: nsz@port70.net Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Subject: Re: [musl] Unwinding multithreaded musl applications with elfutils fails On Fri, Mar 31, 2023 at 7:40=E2=80=AFAM Szabolcs Nagy wrot= e: > > * Matt Wozniski [2023-03-30 22:43:28 -0400]: > > Using the elfutils eu-stack program or libdw's dwfl_getthread_frames > > API to unwind multithreaded applications linked against musl libc on > > x86-64 fails, getting stuck on `__clone`: > > musl has limited cfi debug info support (target specific), likely the > unwinder needs a > > .cfi_undefined rip > > in the clone start function to know where the stack frames end. ... > musl supports building things without any cfi debug info since c > does not require unwind support, but linux systems nowadays assume > unwind tables are part of the platform abi so musl based distros > should probably include it. ... > musl does not guarantee frame-pointers either So, if I understand what you're saying correctly: musl itself doesn't guarantee the ability to unwind through it at all (neither using DWARF unwind tables nor using frame pointers), but musl based distros like Alpine ought to include proper unwind tables. Does that mean that you don't consider the lack of CFI for `__clone` a defect in musl, but that it's still worth reporting to the Alpine musl maintainers as a defect in Alpine's musl build? If so, what would distro maintainers have to do in order to remedy that defect? Would it be patches to the (target specific) `clone.s` to add appropriate CFI when building musl for the distro? > (it could figure out the end with the same heuristic that gdb uses, > but apparently elfutils is not smart enough). > > some backtracers may want cleared frame-pointer (rbp=3D0) to detect > the end. ... > rbp=3D0 may be the reason why backtrace in the main thread works, so it > may be enough to do that in threads too. And it sounds like both of these are workarounds that elfutils might be able to pursue in the absence of correct unwind information built into musl itself. Thanks, that gives a useful direction to dig in. Thanks for the reply!