From: bot+bpf-ci@kernel.org
To: irogers@google.com,linux-kernel@vger.kernel.org,linux-trace-kernel@vger.kernel.org,linux-arch@vger.kernel.org
Cc: jpoimboe@kernel.org,rostedt@goodmis.org,peterz@infradead.org,mingo@redhat.com,tglx@kernel.org,bp@alien8.de,dave.hansen@linux.intel.com,x86@kernel.org,catalin.marinas@arm.com,will@kernel.org,mark.rutland@arm.com,linux-arm-kernel@lists.infradead.org,pjw@kernel.org,palmer@dabbelt.com,aou@eecs.berkeley.edu,alex@ghiti.fr,linux-riscv@lists.infradead.org,acme@kernel.org,namhyung@kernel.org,linux-perf-users@vger.kernel.org,mhiramat@kernel.org,ast@kernel.org,daniel@iogearbox.net,andrii@kernel.org,bpf@vger.kernel.org,nathan@kernel.org,nsc@kernel.org,linux-kbuild@vger.kernel.org,ojeda@kernel.org,rust-for-linux@vger.kernel.org,ardb@kernel.org,linux-efi@vger.kernel.org,maz@kernel.org,oupton@kernel.org,kvmarm@lists.linux.dev,shuah@kernel.org,linux-kselftest@vger.kernel.org,indu.bhagat@oracle.com,jremus@linux.ibm.com,wnliu@google.com,dylanbhatch@google.com,irogers@google.com,ast@kernel.org,andrii@kernel.org,daniel@iogearbox.net,martin.lau@kernel.org,eddyz87@gmail.com,yonghong.song@linux.dev,mas
on@kernel.org,ihor.solodrai@linux.dev
Subject: Re: [RFC PATCH v1 03/11] scripts, unwind: Add build-time .eh_frame minifier
Date: Mon, 23 Nov 2026 00:40:18 +0000 (UTC) [thread overview]
Message-ID: <7e1d3d4067c817a0ae6137044406af1138613ce289199ca065c65fc6d611f990@mail.kernel.org> (raw)
In-Reply-To: <20261122235757.3456048-4-irogers@google.com>
[-- Attachment #1: Type: text/plain, Size: 4742 bytes --]
> scripts, unwind: Add build-time .eh_frame minifier
TL;DR:
- On big-endian build hosts, min_eh_frame may silently skip minifying every
object, so the size reduction is lost
- Kconfig depends on UNWINDER_DWARF_CFI, which is defined only later in the
series
- min_eh_frame is missing from scripts/.gitignore
> diff --git a/arch/Kconfig b/arch/Kconfig
> --- a/arch/Kconfig
> +++ b/arch/Kconfig
> @@ -528,6 +528,16 @@ config HAVE_UNWIND_USER_CFI
> select UNWIND_USER
> select UNWIND_DWARF_CFI
>
> +config UNWINDER_DWARF_CFI_MINIFY
> + bool "Minify .eh_frame tables at build time"
> + depends on UNWINDER_DWARF_CFI
A subsystem pattern flags this as potentially concerning: a depends on
naming a symbol that no Kconfig file defines.
UNWINDER_DWARF_CFI is not defined anywhere at this commit, so this option
evaluates to n on every architecture. That leaves the hostprogs-always
entry in scripts/Makefile, the cmd_min_eh_frame hooks in Makefile.lib,
Makefile.build, Makefile.vmlinux_o and rust/Makefile, and
scripts/min_eh_frame.c itself unreachable here, so the results quoted in
the commit message cannot be reproduced from this commit.
The symbol is defined later in the series, in 6cf5792e969e ("x86/unwind:
Add Minimal DWARF CFI kernel unwinder"), efdfa5f38673 ("arm64/unwind: Add
Minimal DWARF CFI kernel unwinder") and 90a680847a32 ("riscv/unwind: Add
Minimal DWARF CFI kernel unwinder"), so this looks like a forward
reference rather than a misspelling, and bisection is not broken.
Would it make sense to reorder the series so the unwinder Kconfig symbol
comes before its consumers?
> + default y
> + help
> + Strip unneeded callee-saved register opcodes and coalesce PC-advance
> + bytecodes in .eh_frame sections at build time, reducing kernel unwind
> + table memory usage while ensuring only Minimal DWARF CFA bytecodes
> + remain in vmlinux and modules.
[ ... ]
> diff --git a/scripts/Makefile b/scripts/Makefile
> --- a/scripts/Makefile
> +++ b/scripts/Makefile
> @@ -12,6 +12,7 @@ hostprogs-always-$(CONFIG_SYSTEM_EXTRA_CERTIFICATE) += insert-sys-cert
> hostprogs-always-$(CONFIG_RUST_KERNEL_DOCTESTS) += rustdoc_test_builder
> hostprogs-always-$(CONFIG_RUST_KERNEL_DOCTESTS) += rustdoc_test_gen
> hostprogs-always-$(CONFIG_TRACEPOINTS) += tracepoint-update
> +hostprogs-always-$(CONFIG_UNWINDER_DWARF_CFI_MINIFY) += min_eh_frame
Should /min_eh_frame be added to scripts/.gitignore?
Every other host program built here has an entry there (/kallsyms,
/sorttable, /tracepoint-update, /insert-sys-cert, and so on), and
git check-ignore -v scripts/min_eh_frame matches no rule. After an in-tree
build with the option enabled, the binary shows up as untracked and could be
picked up by git add -A. No later commit in the series adds the entry.
[ ... ]
> diff --git a/scripts/min_eh_frame.c b/scripts/min_eh_frame.c
> new file mode 100644
> --- /dev/null
> +++ b/scripts/min_eh_frame.c
[ ... ]
> +int main(int argc, char **argv)
> +{
[ ... ]
> + if (memcmp(map, ELFMAG, SELFMAG) == 0 &&
> + map[EI_DATA] == ELFDATA2LSB &&
> + map[EI_CLASS] == ELFCLASS64)
> + rc = process_elf64(map, (size_t)st.st_size);
main() checks that the target object is little-endian, but not the byte
order of the host the tool runs on. process_elf64() then reads and writes
the ELF header, section header, symbol and Elf64_Rela fields as native
structs, and only the .eh_frame payload goes through get_le32()/put_le32().
On a big-endian build host cross-compiling an x86_64, arm64 or riscv64
kernel, the first check in process_elf64() sees the bytes 01 00 of e_type
as 0x0100:
if (ehdr->e_type != ET_REL)
return 0;
Won't every object then be silently left unminified while the build still
succeeds? CONFIG_UNWINDER_DWARF_CFI_MINIFY is default y and its help text
says only Minimal DWARF CFA bytecodes remain in vmlinux and modules, but on
such a host nothing is stripped, coalesced or dropped, and nothing reports
it.
Other ELF host tools in scripts/ handle this: scripts/elf-parse.c picks
rle/rbe accessors from EI_DATA, and scripts/mod/modpost.c applies
TO_NATIVE() to the ELF header fields.
The resulting kernel should still work, since kernel/unwind/dwarf_cfi.c
parses unminified CIEs and FDEs, but the documented size reduction would
not apply.
Could this either fail the build with a message when the host is not
little-endian, or read the ELF header, section, symbol and rela fields
through le16/le32/le64 accessors as elf-parse.c does?
---
AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md
CI run summary: https://github.com/kernel-patches/bpf/actions/runs/45087188604
next prev parent reply other threads:[~2026-11-23 0:40 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-22 23:57 [RFC PATCH v1 00/11] unwind: Minimal DWARF CFI stack unwinding for x86, arm64, and riscv Ian Rogers
2026-11-22 23:57 ` [RFC PATCH v1 01/11] unwind: Add Minimal DWARF CFI bytecode interpreter and KUnit tests Ian Rogers
2026-11-23 0:40 ` bot+bpf-ci
2026-11-22 23:57 ` [RFC PATCH v1 02/11] unwind_user: Support Minimal DWARF CFI user-space unwinding Ian Rogers
2026-11-23 0:39 ` bot+bpf-ci
2026-11-22 23:57 ` [RFC PATCH v1 03/11] scripts, unwind: Add build-time .eh_frame minifier Ian Rogers
2026-11-23 0:40 ` bot+bpf-ci [this message]
2026-11-22 23:57 ` [RFC PATCH v1 04/11] objtool/ibt: Ignore .eh_frame relocations during ENDBR validation Ian Rogers
2026-11-22 23:57 ` [RFC PATCH v1 05/11] x86/unwind: Add Minimal DWARF CFI kernel unwinder Ian Rogers
2026-11-23 0:56 ` bot+bpf-ci
2026-11-22 23:57 ` [RFC PATCH v1 06/11] arm64: unwind_user: Support Minimal DWARF CFI and FP user unwinding Ian Rogers
2026-11-22 23:57 ` [RFC PATCH v1 07/11] arm64/unwind: Add Minimal DWARF CFI kernel unwinder Ian Rogers
2026-11-23 0:56 ` bot+bpf-ci
2026-11-22 23:57 ` [RFC PATCH v1 08/11] riscv: unwind_user: Support Minimal DWARF CFI and FP user unwinding Ian Rogers
2026-11-23 0:39 ` bot+bpf-ci
2026-11-22 23:57 ` [RFC PATCH v1 09/11] riscv/unwind: Add Minimal DWARF CFI kernel unwinder Ian Rogers
2026-11-23 0:56 ` bot+bpf-ci
2026-11-22 23:57 ` [RFC PATCH v1 10/11] selftests/perf_events: Add Minimal DWARF CFI deferred user unwind test Ian Rogers
2026-11-23 0:40 ` bot+bpf-ci
2026-11-22 23:57 ` [RFC PATCH v1 11/11] scripts: Add eh_frame_min.py .eh_frame coverage and size analyzer Ian Rogers
2026-11-23 0:39 ` bot+bpf-ci
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=7e1d3d4067c817a0ae6137044406af1138613ce289199ca065c65fc6d611f990@mail.kernel.org \
--to=bot+bpf-ci@kernel.org \
--cc=acme@kernel.org \
--cc=alex@ghiti.fr \
--cc=andrii@kernel.org \
--cc=aou@eecs.berkeley.edu \
--cc=ardb@kernel.org \
--cc=ast@kernel.org \
--cc=bp@alien8.de \
--cc=bpf@vger.kernel.org \
--cc=catalin.marinas@arm.com \
--cc=daniel@iogearbox.net \
--cc=dave.hansen@linux.intel.com \
--cc=dylanbhatch@google.com \
--cc=eddyz87@gmail.com \
--cc=indu.bhagat@oracle.com \
--cc=irogers@google.com \
--cc=jpoimboe@kernel.org \
--cc=jremus@linux.ibm.com \
--cc=kvmarm@lists.linux.dev \
--cc=linux-arch@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-efi@vger.kernel.org \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=martin.lau@kernel.org \
--cc=maz@kernel.org \
--cc=mhiramat@kernel.org \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=nathan@kernel.org \
--cc=nsc@kernel.org \
--cc=ojeda@kernel.org \
--cc=oupton@kernel.org \
--cc=palmer@dabbelt.com \
--cc=peterz@infradead.org \
--cc=pjw@kernel.org \
--cc=rostedt@goodmis.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=shuah@kernel.org \
--cc=tglx@kernel.org \
--cc=will@kernel.org \
--cc=wnliu@google.com \
--cc=x86@kernel.org \
--cc=yonghong.song@linux.dev \
/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
all inboxes | Powered by JetHome®