![]() |
|
Message-ID: <20250224160214.0cafdcad@onyx.my.domain> Date: Mon, 24 Feb 2025 16:02:14 +0200 From: Timo Teras <timo.teras@....fi> To: Ivan Trofimov <i.trofimow@...dex.ru> Cc: musl@...ts.openwall.com Subject: Re: [PATCH] x86_64: Generate an eh-frame entry for syscall_cp On Mon, 24 Feb 2025 16:35:54 +0300 Ivan Trofimov <i.trofimow@...dex.ru> wrote: > Some eBPF-based profilers > (open-telemetry/opentelemetry-ebpf-profiler, yandex/perforator, > parca-dev/parca etc. at github.com) leverage eh-frame section to > unwind the stacks of native executables in kernel context. > > This approach works pretty well most of the time, but sometimes fails > to unwind through hand-written assembly due to it missing cfi-* > directives. Usually it's not that big of a deal and doesn't change > the whole picture much, however with musl things are different, since > these unwinders fail to unwind syscalls back to userspace, as musl > doesn't generate an eh-frame entry for __syscall_cp function. Musl has tools/add-cfi.* files to add the cfi annotations programmatically. However, .eh_frame is intentionally turned off, and the cfi ends up in .debug_frame only. I earlier tried to get some .eh_frame enabled, but that led no where and I got no responses on what could be done to enable this for profiling purposes. Basically the response was that .eh_frame enables throwing exception through C library which is UB and intentionally not supported, and that it bloats the LOAD segment size for no good reason. See also eg. https://www.openwall.com/lists/musl/2021/07/16/1 probably there's some other threads also. I wonder if the newer GNU .sframe would be something that can be enabled? Rich, any comments on enabling .sframe generation? It would not enable throwing exceptions etc., and is smaller in size. > Imagine a flamegraph, where all (or most) of the syscalls are > completely out of place: this is the problem this patch aims to fix > for x86-64. Because of the above, opentelemetry-ebpf-profiler supports also .debug_frame directly in the .so and in detached debug files. Try installing musl debug data file (if available) and things will start working a lot better. Timo
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.