From: Vincent Whitchurch <vincent.whitchurch@axis.com>
To: Szabolcs Nagy <szabolcs.nagy@arm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will@kernel.org>, kernel <kernel@axis.com>,
Tamas Zsoldos <tamas.zsoldos@arm.com>,
Daniel Kiss <daniel.kiss@arm.com>,
Vincenzo Frascino <vincenzo.frascino@arm.com>,
Ard Biesheuvel <ardb@kernel.org>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] arm64: vdso: Include .eh_frame in debug ELF
Date: Mon, 28 Nov 2022 11:18:30 +0100 [thread overview]
Message-ID: <Y4SK9ruHqk3giWTW@axis.com> (raw)
In-Reply-To: <Y4C0ope66V+0DzYC@arm.com>
On Fri, Nov 25, 2022 at 01:27:14PM +0100, Szabolcs Nagy wrote:
> The 11/25/2022 11:37, Vincent Whitchurch wrote:
> > We currently strip out .eh_frame to work around crashes in libgcc when
> > it tries to unwind out of signal handlers, see commit 87676cfca141
> > ("arm64: vdso: Disable dwarf unwinding through the sigreturn
> > trampoline").
> >
> > The .eh_frame does however have correct unwind information for the
> > functions implemented in C in vgettimeofday.c, but currently this
> > information is not available even for offline unwinding using the
> > vdso.so.dbg. As a result of this, perf built with libdw is unable to
> > unwind the stack when the PC is inside one of these functions.
> >
> > To fix this, strip the .eh_frame section only from the vdso.so and not
> > from the vdso.so.dbg. This can be used by offline unwinders with access
> > to the debug symbols, and will not affect libgcc since the section will
> > still not be present in the normal vDSO.
>
> adding eh_frame to vdso.so.dbg makes sense.
>
> but if libdw correctly unwinds across a signal handler
> then libgcc should be able to do so too.
I have not tested if libdw can unwind across a signal handler. It is
unlikely to work since all the CFI directives in __kernel_rt_sigreturn
are commented out. The CFI in .eh_frame only covers the C functions and
unwinding those works with libdw.
$ aarch64-linux-gnu-objdump --dwarf=frames arch/arm64/kernel/vdso/vdso.so.dbg | grep pc
00000014 000000000000001c 00000018 FDE cie=00000000 pc=0000000000000330..00000000000005cc
00000034 0000000000000014 00000038 FDE cie=00000000 pc=00000000000005d0..0000000000000784
0000004c 0000000000000018 00000050 FDE cie=00000000 pc=0000000000000784..00000000000007fc
$ nm -n arch/arm64/kernel/vdso/vdso.so.dbg
0000000000000330 T __kernel_clock_gettime
00000000000005d0 T __kernel_gettimeofday
0000000000000784 T __kernel_clock_getres
0000000000000820 T __kernel_rt_sigreturn
> so maybe eh_frame should be added back to vdso.so just
> without frame info for __kernel_rt_sigreturn+NOP to
> ensure unwinders use heuristics for sigreturn.
> (i dont know if this was considered back when eh_frame
> was dropped from the vdso)
I don't know either why 87676cfca141 had to both remove the CFI
directives from __kernel_rt_sigreturn and remove the .eh_frame section
completely from vdso.so instead of only doing the former, but I assume
there was a good reason for that.
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
prev parent reply other threads:[~2022-11-28 10:20 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-25 10:37 [PATCH] arm64: vdso: Include .eh_frame in debug ELF Vincent Whitchurch
2022-11-25 12:27 ` Szabolcs Nagy
2022-11-28 10:18 ` Vincent Whitchurch [this message]
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=Y4SK9ruHqk3giWTW@axis.com \
--to=vincent.whitchurch@axis.com \
--cc=ardb@kernel.org \
--cc=catalin.marinas@arm.com \
--cc=daniel.kiss@arm.com \
--cc=kernel@axis.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=szabolcs.nagy@arm.com \
--cc=tamas.zsoldos@arm.com \
--cc=vincenzo.frascino@arm.com \
--cc=will@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;
as well as URLs for NNTP newsgroup(s).