From: Jens Remus <jremus@linux.ibm.com>
To: Steven Rostedt <rostedt@kernel.org>
Cc: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org,
linux-s390@vger.kernel.org, x86@kernel.org,
Josh Poimboeuf <jpoimboe@kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
Heiko Carstens <hca@linux.ibm.com>,
Vasily Gorbik <gor@linux.ibm.com>,
Alexander Gordeev <agordeev@linux.ibm.com>,
Ilya Leoshkevich <iii@linux.ibm.com>,
Indu Bhagat <ibhagatgnu@gmail.com>,
Thomas Gleixner <tglx@kernel.org>, Ingo Molnar <mingo@redhat.com>,
Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>,
"H. Peter Anvin" <hpa@zytor.com>,
Namhyung Kim <namhyung@kernel.org>,
Andrii Nakryiko <andrii@kernel.org>, Kees Cook <kees@kernel.org>,
Sam James <sam@gentoo.org>
Subject: Re: [RFC PATCH v1 00/25] unwind_user: Implement .eh_frame handling
Date: Fri, 21 Aug 2026 21:51:30 +0200 [thread overview]
Message-ID: <61ff69a3-63fd-4f16-9546-793d21160a90@linux.ibm.com> (raw)
In-Reply-To: <20260818132113.737ae646@robin>
Hello Steven!
On 8/18/2026 7:21 PM, Steven Rostedt wrote:
> On Tue, 18 Aug 2026 16:49:29 +0200
> Jens Remus <jremus@linux.ibm.com> wrote:
>
>> This series adds support for parsing DWARF Call Frame Information (CFI)
>> from the .eh_frame_hdr and .eh_frame sections of user space ELF files.
>
> Very nice! I don't have time this week to look at it, but I just
> applied the series and tried it out with:
Thanks!
>
> perf record --call-graph fp,defer trace-cmd report ~/trace.dat
>
> And did a: perf -D script
>
> And found this:
>
> 264990534603 0x19370 [0x78]: PERF_RECORD_CALLCHAIN_DEFERRED(IP, 0x2): 1165/1165: 0x105700000005
> ... FP chain: nr:10
> ..... 0: 00007f5feafd362a
> ..... 1: 00007f5feb249781
> ..... 2: 00007f5feb2498de
> ..... 3: 000055935526fbdc
> ..... 4: 00005593552649e6
> ..... 5: 000055935523c2d0
> ..... 6: 000055935523d24c
> ..... 7: 0000559355227bfe
> ..... 8: 00007f5feaef9f75
> ..... 9: 00007ffdaf879d38
> ... thread: trace-cmd:1165
> ...... dso: /proc/kcore
> trace-cmd 1165 264.990473: 395990 cpu/cycles/P:
> ffffffff8477d8d3 check_preemption_disabled+0x13 ([kernel.kallsyms])
> ffffffff819aa495 rcu_is_watching+0x15 ([kernel.kallsyms])
> ffffffff816dbcff unwind_next_frame+0x45f ([kernel.kallsyms])
> ffffffff81642e91 arch_stack_walk+0xa1 ([kernel.kallsyms])
> ffffffff81a2e633 stack_trace_save+0x93 ([kernel.kallsyms])
> ffffffff82251210 kasan_save_stack+0x30 ([kernel.kallsyms])
> ffffffff822541b0 kasan_record_aux_stack+0xb0 ([kernel.kallsyms])
> ffffffff819c1e2a __call_rcu_common+0xca ([kernel.kallsyms])
> ffffffff821be05f kmem_cache_free+0x2ef ([kernel.kallsyms])
> ffffffff8233e4a7 vfs_fstatat+0x57 ([kernel.kallsyms])
> ffffffff8233e573 __do_sys_newfstatat+0x83 ([kernel.kallsyms])
> ffffffff84772a8e do_syscall_64+0x7e ([kernel.kallsyms])
> ffffffff8100012f entry_SYSCALL_64_after_hwframe+0x76 ([kernel.kallsyms])
> 7f5feafd362a __GI___fstatat64+0xa (/usr/lib/x86_64-linux-gnu/libc.so.6)
> 7f5feb249781 tep_load_plugins_hook+0xd1 (/usr/local/lib64/libtraceevent.so.1.9.0)
> 7f5feb2498de tep_load_plugins+0x35 (/usr/local/lib64/libtraceevent.so.1.9.0)
> 55935526fbdc tcmd_load_plugins+0x85 (/usr/local/bin/trace-cmd)
> 5593552649e6 tracecmd_alloc_fd+0x2da (/usr/local/bin/trace-cmd)
> 55935523c2d0 read_trace_header+0x62 (/usr/local/bin/trace-cmd)
> 55935523d24c trace_report+0x869 (/usr/local/bin/trace-cmd)
> 559355227bfe main+0x90 (/usr/local/bin/trace-cmd)
> 7f5feaef9f75 __libc_start_call_main+0x75 (/usr/lib/x86_64-linux-gnu/libc.so.6)
> 7ffdaf879d38 [unknown] ([unknown])
>
> I injected trace_printk() into the code to make sure it was using the
> eh_frame unwinding:
>
> diff --git a/kernel/unwind/user.c b/kernel/unwind/user.c
> index 85fc82252af1..585f022bcabe 100644
> --- a/kernel/unwind/user.c
> +++ b/kernel/unwind/user.c
> @@ -200,6 +200,7 @@ static int unwind_user_next(struct unwind_user_state *state)
> case UNWIND_USER_TYPE_EH_FRAME:
> switch (unwind_user_next_eh_frame(state)) {
> case 0:
> + trace_printk("USE EH_FRAME\n");
> return 0;
> case -ENOENT:
> continue; /* Try next method. */
> @@ -208,8 +209,9 @@ static int unwind_user_next(struct unwind_user_state *state)
> }
> break;
> case UNWIND_USER_TYPE_FP:
> - if (!unwind_user_next_fp(state))
> - return 0;
> + if (!unwind_user_next_fp(state)) {
> + trace_printk("USE FRAME POINTER\n");
> + return 0; }
> continue;
> default:
> WARN_ONCE(1, "Undefined unwind bit %d", bit);
>
> And have this:
>
> # trace-cmd show
> [..]
> trace-cmd-1136 [001] ..... 239.482498: unwind_user: USE EH_FRAME
> trace-cmd-1136 [001] ..... 239.482501: unwind_user: USE EH_FRAME
> trace-cmd-1136 [001] ..... 239.482504: unwind_user: USE EH_FRAME
> trace-cmd-1136 [001] ..... 239.482507: unwind_user: USE EH_FRAME
> trace-cmd-1136 [001] ..... 239.482821: unwind_user: USE EH_FRAME
> trace-cmd-1136 [001] ..... 239.482825: unwind_user: USE EH_FRAME
> trace-cmd-1136 [001] ..... 239.482828: unwind_user: USE EH_FRAME
> trace-cmd-1136 [001] ..... 239.482831: unwind_user: USE EH_FRAME
> trace-cmd-1136 [001] ..... 239.482834: unwind_user: USE EH_FRAME
> trace-cmd-1136 [001] ..... 239.483004: unwind_user: USE EH_FRAME
> trace-cmd-1136 [001] ..... 239.483007: unwind_user: USE EH_FRAME
> trace-cmd-1136 [001] ..... 239.483010: unwind_user: USE EH_FRAME
> trace-cmd-1136 [001] ..... 239.483013: unwind_user: USE EH_FRAME
> trace-cmd-1136 [001] ..... 239.483016: unwind_user: USE EH_FRAME
> trace-cmd-1136 [001] ..... 239.483230: unwind_user: USE FRAME POINTER
> trace-cmd-1136 [001] ..... 239.483234: unwind_user: USE EH_FRAME
> trace-cmd-1136 [001] ..... 239.483238: unwind_user: USE EH_FRAME
> trace-cmd-1136 [001] ..... 239.483240: unwind_user: USE EH_FRAME
> trace-cmd-1136 [001] ..... 239.483243: unwind_user: USE EH_FRAME
> [..]
Thanks for giving it a spin!
> Note, the compile had one warning (with all patches applied):
>
> vmlinux.o: warning: objtool: eh_frame_find+0x270c: call to eh_frame_do_expression.isra.0() with UACCESS enabled
I need to resolve those objtool warnings after my vacation. Any idea
how to get around the arch eh_frame_do_expression() callback issue?
Is there a mean to temporarily give up the UACCESS if it is within a
scoped guard region?
> I'll try to get time when I get back from my travels next week to look
> at each of the patches.
>
> I also do not think this makes sframe obsolete. I believe there's holes
> with eh_frame and some may not like the complexity of it. But this
> gives us an honest look at what options are available to us.
>
> Thanks for doing this!
It was fun and I learned quite a bit about .eh_frame, .eh_frame_hdr,
and GNU_EH_FRAME doing so.
Regards,
Jens
--
Jens Remus
Linux on Z Development (D3303)
jremus@de.ibm.com / jremus@linux.ibm.com
IBM Deutschland Research & Development GmbH; Vorsitzender des Aufsichtsrats: Wolfgang Wendt; Geschäftsführung: David Faller; Sitz der Gesellschaft: Ehningen; Registergericht: Amtsgericht Stuttgart, HRB 243294
IBM Data Privacy Statement: https://www.ibm.com/privacy/
next prev parent reply other threads:[~2026-08-21 19:52 UTC|newest]
Thread overview: 67+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-18 14:49 [RFC PATCH v1 00/25] unwind_user: Implement .eh_frame handling Jens Remus
2026-08-18 14:49 ` [RFC PATCH v1 01/25] unwind_user: Add generic and arch-specific headers to MAINTAINERS Jens Remus
2026-08-18 14:49 ` [RFC PATCH v1 02/25] unwind_user: Stop when reaching an outermost frame Jens Remus
2026-08-18 14:56 ` sashiko-bot
2026-08-18 14:49 ` [RFC PATCH v1 03/25] unwind_user: Enable archs that pass RA in a register Jens Remus
2026-08-18 14:58 ` sashiko-bot
2026-08-18 14:49 ` [RFC PATCH v1 04/25] unwind_user: Flexible FP/RA recovery rules Jens Remus
2026-08-18 14:58 ` sashiko-bot
2026-08-18 14:49 ` [RFC PATCH v1 05/25] unwind_user: Flexible CFA " Jens Remus
2026-08-18 14:57 ` sashiko-bot
2026-08-18 14:49 ` [RFC PATCH v1 06/25] unwind_user: Enable archs that define CFA = SP_callsite + offset Jens Remus
2026-08-18 14:57 ` sashiko-bot
2026-08-18 14:49 ` [RFC PATCH v1 07/25] unwind_user/eh_frame: Add support for reading .eh_frame_hdr section Jens Remus
2026-08-18 15:02 ` sashiko-bot
2026-08-21 19:41 ` Jens Remus
2026-08-18 14:49 ` [RFC PATCH v1 08/25] unwind_user/eh_frame: Store .eh_frame_hdr section data in per-mm maple tree Jens Remus
2026-08-18 15:08 ` sashiko-bot
2026-08-21 19:41 ` Jens Remus
2026-08-18 14:49 ` [RFC PATCH v1 09/25] unwind_user/eh_frame: Add support for reading .eh_frame section Jens Remus
2026-08-18 15:05 ` sashiko-bot
2026-08-21 19:41 ` Jens Remus
2026-08-18 14:49 ` [RFC PATCH v1 10/25] unwind_user/eh_frame: Detect .eh_frame_hdr sections in executables Jens Remus
2026-08-18 15:18 ` sashiko-bot
2026-08-21 19:41 ` Jens Remus
2026-08-18 14:49 ` [RFC PATCH v1 11/25] unwind_user/eh_frame: Wire up unwind_user to eh_frame Jens Remus
2026-08-18 15:09 ` sashiko-bot
2026-08-21 19:41 ` Jens Remus
2026-08-18 14:49 ` [RFC PATCH v1 12/25] unwind_user/eh_frame: Remove .eh_frame[_hdr] section on detected corruption Jens Remus
2026-08-18 15:10 ` sashiko-bot
2026-08-21 19:41 ` Jens Remus
2026-08-18 14:49 ` [RFC PATCH v1 13/25] unwind_user/eh_frame: Show file name in debug output Jens Remus
2026-08-18 15:00 ` sashiko-bot
2026-08-18 14:49 ` [RFC PATCH v1 14/25] unwind_user/eh_frame: Add .eh_frame[_hdr] validation option Jens Remus
2026-08-18 15:08 ` sashiko-bot
2026-08-21 19:41 ` Jens Remus
2026-08-18 14:49 ` [RFC PATCH v1 15/25] unwind_user/eh_frame: Duplicate registered .eh_frame[_hdr] section data on clone/fork Jens Remus
2026-08-18 15:11 ` sashiko-bot
2026-08-21 19:41 ` Jens Remus
2026-08-18 14:49 ` [RFC PATCH v1 16/25] unwind_user/eh_frame: Add linear .eh_frame search fallback Jens Remus
2026-08-18 15:06 ` sashiko-bot
2026-08-21 19:41 ` Jens Remus
2026-08-18 14:49 ` [RFC PATCH v1 17/25] unwind_user/eh_frame: Ignore DW_CFA_GNU_args_size Jens Remus
2026-08-18 15:04 ` sashiko-bot
2026-08-21 19:41 ` Jens Remus
2026-08-18 14:49 ` [RFC PATCH v1 18/25] unwind_user/eh_frame: Add support for DWARF expressions Jens Remus
2026-08-18 15:13 ` sashiko-bot
2026-08-21 19:41 ` Jens Remus
2026-08-18 14:49 ` [RFC PATCH v1 19/25] x86/uaccess: Add unsafe_copy_from_user() implementation Jens Remus
2026-08-18 15:08 ` sashiko-bot
2026-08-18 14:49 ` [RFC PATCH v1 20/25] unwind_user/eh_frame/x86: Enable eh_frame unwinding on x86 Jens Remus
2026-08-18 15:04 ` sashiko-bot
2026-08-18 14:49 ` [RFC PATCH v1 21/25] unwind_user/eh_frame/x86: Handle PLT expressions Jens Remus
2026-08-18 15:10 ` sashiko-bot
2026-08-21 19:41 ` Jens Remus
2026-08-18 14:49 ` [RFC PATCH v1 22/25] unwind_user/eh_frame/x86: Handle DRAP expressions Jens Remus
2026-08-18 15:10 ` sashiko-bot
2026-08-21 19:41 ` Jens Remus
2026-08-18 14:49 ` [RFC PATCH v1 23/25] s390/ptrace: Provide frame_pointer() Jens Remus
2026-08-18 15:06 ` sashiko-bot
2026-08-18 14:49 ` [RFC PATCH v1 24/25] unwind_user/eh_frame/s390: Enable eh_frame unwinding on s390 Jens Remus
2026-08-18 15:15 ` sashiko-bot
2026-08-18 14:49 ` [RFC PATCH v1 25/25] unwind_user/eh_frame: Add prctl() interface for (un)registering .eh_frame_hdr sections Jens Remus
2026-08-18 15:17 ` sashiko-bot
2026-08-21 19:41 ` Jens Remus
2026-08-18 17:21 ` [RFC PATCH v1 00/25] unwind_user: Implement .eh_frame handling Steven Rostedt
2026-08-21 19:51 ` Jens Remus [this message]
2026-08-19 8:35 ` Jens Remus
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=61ff69a3-63fd-4f16-9546-793d21160a90@linux.ibm.com \
--to=jremus@linux.ibm.com \
--cc=agordeev@linux.ibm.com \
--cc=andrii@kernel.org \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=gor@linux.ibm.com \
--cc=hca@linux.ibm.com \
--cc=hpa@zytor.com \
--cc=ibhagatgnu@gmail.com \
--cc=iii@linux.ibm.com \
--cc=jpoimboe@kernel.org \
--cc=kees@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=rostedt@kernel.org \
--cc=sam@gentoo.org \
--cc=tglx@kernel.org \
--cc=x86@kernel.org \
/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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox