Kernel build fail with 'btf_encoder__encode: btf__dedup failed!'
Subsystems (5)
Hi,
I'm getting the following error during build:
$ ./tools/testing/selftests/bpf/vmtest.sh -j30
[...]
BTF .btf.vmlinux.bin.o
btf_encoder__encode: btf__dedup failed!
Failed to encode BTF
LD .tmp_vmlinux.kallsyms1
NM .tmp_vmlinux.kallsyms1.syms
KSYMS .tmp_vmlinux.kallsyms1.S
AS .tmp_vmlinux.kallsyms1.S
LD .tmp_vmlinux.kallsyms2
NM .tmp_vmlinux.kallsyms2.syms
KSYMS .tmp_vmlinux.kallsyms2.S
AS .tmp_vmlinux.kallsyms2.S
LD .tmp_vmlinux.kallsyms3
NM .tmp_vmlinux.kallsyms3.syms
KSYMS .tmp_vmlinux.kallsyms3.S
AS .tmp_vmlinux.kallsyms3.S
LD vmlinux
BTFIDS vmlinux
FAILED: load BTF from vmlinux: No such file or directory
make[1]: *** [scripts/Makefile.vmlinux:35: vmlinux] Error 255
make[1]: *** Deleting file 'vmlinux'
make: *** [Makefile:1264: vmlinux] Error 2This happens on both bpf-next/master (84150795a49) and 6.2-rc5 (2241ab53cb).
I've also tried arch linux pahole 1:1.24+r29+g02d67c5-1 as well as upstream pahole on master (02d67c5176) and upstream pahole on next (2ca56f4c6f659).
Of the above 6 combinations, I think I've tried all of them (maybe missing 1 or 2).
Looks like GCC got updated recently on my machine, so perhaps it's related?
CONFIG_CC_VERSION_TEXT="gcc (GCC) 12.2.1 20230111"
I'll try some debugging, but just wanted to report it first.
Thanks,
Daniel
Quoted 41 lines · Daniel Xu
Hi,
I'm getting the following error during build:
$ ./tools/testing/selftests/bpf/vmtest.sh -j30 [...] BTF .btf.vmlinux.bin.o btf_encoder__encode: btf__dedup failed! Failed to encode BTF LD .tmp_vmlinux.kallsyms1 NM .tmp_vmlinux.kallsyms1.syms KSYMS .tmp_vmlinux.kallsyms1.S AS .tmp_vmlinux.kallsyms1.S LD .tmp_vmlinux.kallsyms2 NM .tmp_vmlinux.kallsyms2.syms KSYMS .tmp_vmlinux.kallsyms2.S AS .tmp_vmlinux.kallsyms2.S LD .tmp_vmlinux.kallsyms3 NM .tmp_vmlinux.kallsyms3.syms KSYMS .tmp_vmlinux.kallsyms3.S AS .tmp_vmlinux.kallsyms3.S LD vmlinux BTFIDS vmlinux FAILED: load BTF from vmlinux: No such file or directory make[1]: *** [scripts/Makefile.vmlinux:35: vmlinux] Error 255 make[1]: *** Deleting file 'vmlinux' make: *** [Makefile:1264: vmlinux] Error 2This happens on both bpf-next/master (
84150795a49) and 6.2-rc5 (2241ab53cb).I've also tried arch linux pahole 1:1.24+r29+g02d67c5-1 as well as upstream pahole on master (
02d67c5176) and upstream pahole on next (2ca56f4c6f659).Of the above 6 combinations, I think I've tried all of them (maybe missing 1 or 2).
Looks like GCC got updated recently on my machine, so perhaps it's related?
Quoted 6 lines
CONFIG_CC_VERSION_TEXT="gcc (GCC) 12.2.1 20230111"I'll try some debugging, but just wanted to report it first.
Thanks,
Daniel
Applying the following diff:
src/btf.c +4 -1
@@ -4576,8 +4576,11 @@ static int btf_dedup_ref_type(struct btf_dedup *d, __u32 type_id)int ref_type_id;long h; -if (d->map[type_id] ==BTF_IN_PROGRESS_ID ) +if (d->map[type_id] ==BTF_IN_PROGRESS_ID ) { +struct btf_type *t =btf_type_by_id (d->btf, type_id); +pr_warn ("eloop type_id=%d, kind=%d, type=%d\n" , type_id,btf_kind (t), t->type);return -ELOOP ; + }if (d->map[type_id] <=BTF_MAX_NR_TYPES )return resolve_type_id (d, type_id);
Yields:
BTF .btf.vmlinux.bin.o
libbpf: eloop type_id=2, kind=10, type=2
btf_encoder__encode: btf__dedup failed!
Failed to encode BTF
So it's a CONST pointing to itself?
I'm somewhat out of ideas here.
Quoted 38 lines · Daniel Xu
Hi,
I'm getting the following error during build:
$ ./tools/testing/selftests/bpf/vmtest.sh -j30 [...] BTF .btf.vmlinux.bin.o btf_encoder__encode: btf__dedup failed! Failed to encode BTF LD .tmp_vmlinux.kallsyms1 NM .tmp_vmlinux.kallsyms1.syms KSYMS .tmp_vmlinux.kallsyms1.S AS .tmp_vmlinux.kallsyms1.S LD .tmp_vmlinux.kallsyms2 NM .tmp_vmlinux.kallsyms2.syms KSYMS .tmp_vmlinux.kallsyms2.S AS .tmp_vmlinux.kallsyms2.S LD .tmp_vmlinux.kallsyms3 NM .tmp_vmlinux.kallsyms3.syms KSYMS .tmp_vmlinux.kallsyms3.S AS .tmp_vmlinux.kallsyms3.S LD vmlinux BTFIDS vmlinux FAILED: load BTF from vmlinux: No such file or directory make[1]: *** [scripts/Makefile.vmlinux:35: vmlinux] Error 255 make[1]: *** Deleting file 'vmlinux' make: *** [Makefile:1264: vmlinux] Error 2This happens on both bpf-next/master (
84150795a49) and 6.2-rc5 (2241ab53cb).I've also tried arch linux pahole 1:1.24+r29+g02d67c5-1 as well as upstream pahole on master (
02d67c5176) and upstream pahole on next (2ca56f4c6f659).Of the above 6 combinations, I think I've tried all of them (maybe missing 1 or 2).
Quoted 6 lines
Looks like GCC got updated recently on my machine, so perhaps it's related?
CONFIG_CC_VERSION_TEXT="gcc (GCC) 12.2.1 20230111"I'll try some debugging, but just wanted to report it first.
hi,
I can't reproduce that.. can you reproduce it outside vmtest.sh?
there will be lot of output with patch below, but could contain some more error output
jirka
---
scripts/link-vmlinux.sh +1 -1
@@ -125,7 +125,7 @@ gen_btf() vmlinux_link ${1} info "BTF" ${2} - LLVM_OBJCOPY="${OBJCOPY}" ${PAHOLE} -J ${PAHOLE_FLAGS} ${1} + LLVM_OBJCOPY="${OBJCOPY}" ${PAHOLE} -V -J ${PAHOLE_FLAGS} ${1} # Create ${2} which contains just .BTF section but no symbols. Add # SHF_ALLOC because .BTF will be part of the vmlinux image. --strip-all
Hi Jiri,
Quoted 44 lines · Jiri Olsa
Quoted 43 lines · Daniel Xu
Hi,
I'm getting the following error during build:
$ ./tools/testing/selftests/bpf/vmtest.sh -j30 [...] BTF .btf.vmlinux.bin.o btf_encoder__encode: btf__dedup failed! Failed to encode BTF LD .tmp_vmlinux.kallsyms1 NM .tmp_vmlinux.kallsyms1.syms KSYMS .tmp_vmlinux.kallsyms1.S AS .tmp_vmlinux.kallsyms1.S LD .tmp_vmlinux.kallsyms2 NM .tmp_vmlinux.kallsyms2.syms KSYMS .tmp_vmlinux.kallsyms2.S AS .tmp_vmlinux.kallsyms2.S LD .tmp_vmlinux.kallsyms3 NM .tmp_vmlinux.kallsyms3.syms KSYMS .tmp_vmlinux.kallsyms3.S AS .tmp_vmlinux.kallsyms3.S LD vmlinux BTFIDS vmlinux FAILED: load BTF from vmlinux: No such file or directory make[1]: *** [scripts/Makefile.vmlinux:35: vmlinux] Error 255 make[1]: *** Deleting file 'vmlinux' make: *** [Makefile:1264: vmlinux] Error 2This happens on both bpf-next/master (
84150795a49) and 6.2-rc5 (2241ab53cb).I've also tried arch linux pahole 1:1.24+r29+g02d67c5-1 as well as upstream pahole on master (
02d67c5176) and upstream pahole on next (2ca56f4c6f659).Of the above 6 combinations, I think I've tried all of them (maybe missing 1 or 2).
Looks like GCC got updated recently on my machine, so perhaps it's related?
CONFIG_CC_VERSION_TEXT="gcc (GCC) 12.2.1 20230111"
Quoted 7 lines
Quoted 1 line
I'll try some debugging, but just wanted to report it first.
hi,
I can't reproduce that.. can you reproduce it outsidevmtest.sh?there will be lot of output with patch below, but could contain some more error output
Thanks for the hints. Doing a regular build outside of vmtest.sh seems to work ok. So maybe it's a difference in the build config.
I'll put a little more time into debugging to see if it goes anywhere. But I'll have to get back to the regularly scheduled programming soon.
[...]
Thanks,
Daniel
Quoted 51 lines · Daniel Xu
Hi Jiri,
Quoted 48 lines · Jiri Olsa
Quoted 38 lines · Daniel Xu
Hi,
I'm getting the following error during build:
$ ./tools/testing/selftests/bpf/vmtest.sh -j30 [...] BTF .btf.vmlinux.bin.o btf_encoder__encode: btf__dedup failed! Failed to encode BTF LD .tmp_vmlinux.kallsyms1 NM .tmp_vmlinux.kallsyms1.syms KSYMS .tmp_vmlinux.kallsyms1.S AS .tmp_vmlinux.kallsyms1.S LD .tmp_vmlinux.kallsyms2 NM .tmp_vmlinux.kallsyms2.syms KSYMS .tmp_vmlinux.kallsyms2.S AS .tmp_vmlinux.kallsyms2.S LD .tmp_vmlinux.kallsyms3 NM .tmp_vmlinux.kallsyms3.syms KSYMS .tmp_vmlinux.kallsyms3.S AS .tmp_vmlinux.kallsyms3.S LD vmlinux BTFIDS vmlinux FAILED: load BTF from vmlinux: No such file or directory make[1]: *** [scripts/Makefile.vmlinux:35: vmlinux] Error 255 make[1]: *** Deleting file 'vmlinux' make: *** [Makefile:1264: vmlinux] Error 2This happens on both bpf-next/master (
84150795a49) and 6.2-rc5 (2241ab53cb).I've also tried arch linux pahole 1:1.24+r29+g02d67c5-1 as well as upstream pahole on master (
02d67c5176) and upstream pahole on next (2ca56f4c6f659).Of the above 6 combinations, I think I've tried all of them (maybe missing 1 or 2).
Quoted 6 lines
Looks like GCC got updated recently on my machine, so perhaps it's related?
CONFIG_CC_VERSION_TEXT="gcc (GCC) 12.2.1 20230111"I'll try some debugging, but just wanted to report it first.
hi,
I can't reproduce that.. can you reproduce it outsidevmtest.sh?
Quoted 8 lines
Quoted 2 lines
there will be lot of output with patch below, but could contain some more error output
Thanks for the hints. Doing a regular build outside of
vmtest.shseems to work ok. So maybe it's a difference in the build config.I'll put a little more time into debugging to see if it goes anywhere. But I'll have to get back to the regularly scheduled programming soon.
6.2-rc5 compiles correctly when CONFIG_X86_KERNEL_IBT is commented but fails in pahole when CONFIG_X86_KERNEL_IBT is set.
Thanks,
Signature · 1 line
Alexandre Peixoto Ferreira
Quoted 56 lines · Alexandre Peixoto Ferreira
Quoted 53 lines · Daniel Xu
Hi Jiri,
Quoted 50 lines · Jiri Olsa
Quoted 38 lines · Daniel Xu
Hi,
I'm getting the following error during build:
$ ./tools/testing/selftests/bpf/vmtest.sh -j30 [...] BTF .btf.vmlinux.bin.o btf_encoder__encode: btf__dedup failed! Failed to encode BTF LD .tmp_vmlinux.kallsyms1 NM .tmp_vmlinux.kallsyms1.syms KSYMS .tmp_vmlinux.kallsyms1.S AS .tmp_vmlinux.kallsyms1.S LD .tmp_vmlinux.kallsyms2 NM .tmp_vmlinux.kallsyms2.syms KSYMS .tmp_vmlinux.kallsyms2.S AS .tmp_vmlinux.kallsyms2.S LD .tmp_vmlinux.kallsyms3 NM .tmp_vmlinux.kallsyms3.syms KSYMS .tmp_vmlinux.kallsyms3.S AS .tmp_vmlinux.kallsyms3.S LD vmlinux BTFIDS vmlinux FAILED: load BTF from vmlinux: No such file or directory make[1]: *** [scripts/Makefile.vmlinux:35: vmlinux] Error 255 make[1]: *** Deleting file 'vmlinux' make: *** [Makefile:1264: vmlinux] Error 2This happens on both bpf-next/master (
84150795a49) and 6.2-rc5 (2241ab53cb).I've also tried arch linux pahole 1:1.24+r29+g02d67c5-1 as well as upstream pahole on master (
02d67c5176) and upstream pahole on next (2ca56f4c6f659).Of the above 6 combinations, I think I've tried all of them (maybe missing 1 or 2).
Quoted 6 lines
Looks like GCC got updated recently on my machine, so perhaps it's related?
CONFIG_CC_VERSION_TEXT="gcc (GCC) 12.2.1 20230111"I'll try some debugging, but just wanted to report it first.
hi,
I can't reproduce that.. can you reproduce it outsidevmtest.sh?there will be lot of output with patch below, but could contain some more error output
Quoted 8 lines
Quoted 6 lines
Thanks for the hints. Doing a regular build outside of
vmtest.shseems to work ok. So maybe it's a difference in the build config.I'll put a little more time into debugging to see if it goes anywhere. But I'll have to get back to the regularly scheduled programming soon.
6.2-rc5 compiles correctly when
CONFIG_X86_KERNEL_IBTis commented but fails in pahole whenCONFIG_X86_KERNEL_IBTis set.
could you plese attach your config and the build error? I can't reproduce that
thanks,
jirka
Hi Jiri & Alexandre,
Quoted 60 lines · Jiri Olsa
Quoted 59 lines · Alexandre Peixoto Ferreira
Quoted 56 lines · Daniel Xu
Hi Jiri,
Quoted 42 lines · Jiri Olsa
Quoted 41 lines · Daniel Xu
Hi,
I'm getting the following error during build:
$ ./tools/testing/selftests/bpf/vmtest.sh -j30 [...] BTF .btf.vmlinux.bin.o btf_encoder__encode: btf__dedup failed! Failed to encode BTF LD .tmp_vmlinux.kallsyms1 NM .tmp_vmlinux.kallsyms1.syms KSYMS .tmp_vmlinux.kallsyms1.S AS .tmp_vmlinux.kallsyms1.S LD .tmp_vmlinux.kallsyms2 NM .tmp_vmlinux.kallsyms2.syms KSYMS .tmp_vmlinux.kallsyms2.S AS .tmp_vmlinux.kallsyms2.S LD .tmp_vmlinux.kallsyms3 NM .tmp_vmlinux.kallsyms3.syms KSYMS .tmp_vmlinux.kallsyms3.S AS .tmp_vmlinux.kallsyms3.S LD vmlinux BTFIDS vmlinux FAILED: load BTF from vmlinux: No such file or directory make[1]: *** [scripts/Makefile.vmlinux:35: vmlinux] Error 255 make[1]: *** Deleting file 'vmlinux' make: *** [Makefile:1264: vmlinux] Error 2This happens on both bpf-next/master (
84150795a49) and 6.2-rc5 (2241ab53cb).I've also tried arch linux pahole 1:1.24+r29+g02d67c5-1 as well as upstream pahole on master (
02d67c5176) and upstream pahole on next (2ca56f4c6f659).Of the above 6 combinations, I think I've tried all of them (maybe missing 1 or 2).
Looks like GCC got updated recently on my machine, so perhaps it's related?
Quoted 8 lines
Quoted 3 lines
CONFIG_CC_VERSION_TEXT="gcc (GCC) 12.2.1 20230111"I'll try some debugging, but just wanted to report it first.
hi,
I can't reproduce that.. can you reproduce it outsidevmtest.sh?there will be lot of output with patch below, but could contain some more error output
Thanks for the hints. Doing a regular build outside of
vmtest.shseems to work ok. So maybe it's a difference in the build config.
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
I'll put a little more time into debugging to see if it goes anywhere. But I'll have to get back to the regularly scheduled programming soon.
6.2-rc5 compiles correctly when
CONFIG_X86_KERNEL_IBTis commented but fails in pahole whenCONFIG_X86_KERNEL_IBTis set.could you plese attach your config and the build error? I can't reproduce that
I've confirmed that CONFIG_X86_KERNEL_IBT=n fixes my issue as well.
Here is the config that produces my originally reported error:
https://pastes.dxuuu.xyz/wlg9tb
Thanks,
Daniel
Quoted 72 lines · Daniel Xu
Hi Jiri & Alexandre,
Quoted 60 lines · Jiri Olsa
Quoted 59 lines · Alexandre Peixoto Ferreira
Quoted 56 lines · Daniel Xu
Hi Jiri,
Quoted 42 lines · Jiri Olsa
Quoted 41 lines · Daniel Xu
Hi,
I'm getting the following error during build:
$ ./tools/testing/selftests/bpf/vmtest.sh -j30 [...] BTF .btf.vmlinux.bin.o btf_encoder__encode: btf__dedup failed! Failed to encode BTF LD .tmp_vmlinux.kallsyms1 NM .tmp_vmlinux.kallsyms1.syms KSYMS .tmp_vmlinux.kallsyms1.S AS .tmp_vmlinux.kallsyms1.S LD .tmp_vmlinux.kallsyms2 NM .tmp_vmlinux.kallsyms2.syms KSYMS .tmp_vmlinux.kallsyms2.S AS .tmp_vmlinux.kallsyms2.S LD .tmp_vmlinux.kallsyms3 NM .tmp_vmlinux.kallsyms3.syms KSYMS .tmp_vmlinux.kallsyms3.S AS .tmp_vmlinux.kallsyms3.S LD vmlinux BTFIDS vmlinux FAILED: load BTF from vmlinux: No such file or directory make[1]: *** [scripts/Makefile.vmlinux:35: vmlinux] Error 255 make[1]: *** Deleting file 'vmlinux' make: *** [Makefile:1264: vmlinux] Error 2This happens on both bpf-next/master (
84150795a49) and 6.2-rc5 (2241ab53cb).I've also tried arch linux pahole 1:1.24+r29+g02d67c5-1 as well as upstream pahole on master (
02d67c5176) and upstream pahole on next (2ca56f4c6f659).Of the above 6 combinations, I think I've tried all of them (maybe missing 1 or 2).
Looks like GCC got updated recently on my machine, so perhaps it's related?
Quoted 8 lines
Quoted 3 lines
CONFIG_CC_VERSION_TEXT="gcc (GCC) 12.2.1 20230111"I'll try some debugging, but just wanted to report it first.
hi,
I can't reproduce that.. can you reproduce it outsidevmtest.sh?there will be lot of output with patch below, but could contain some more error output
Thanks for the hints. Doing a regular build outside of
vmtest.shseems to work ok. So maybe it's a difference in the build config.Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
I'll put a little more time into debugging to see if it goes anywhere. But I'll have to get back to the regularly scheduled programming soon.
6.2-rc5 compiles correctly when
CONFIG_X86_KERNEL_IBTis commented but fails in pahole whenCONFIG_X86_KERNEL_IBTis set.could you plese attach your config and the build error? I can't reproduce that
Quoted 7 lines
I've confirmed that
CONFIG_X86_KERNEL_IBT=nfixes my issue as well.Here is the config that produces my originally reported error:
https://pastes.dxuuu.xyz/wlg9tbThanks,
Daniel
Here's a patch that helps for me. Not sure if you want to apply this or fix the root cause in bpftool.
---
From 3dc50f3dd45767cb8c3b32c1510c7064f20f80c1 Mon Sep 17 00:00:00 2001
Message-Id: <3dc50f3dd45767cb8c3b32c1510c7064f20f80c1.1674865319.git.dxu@dxuuu.xyz>
From: Daniel Xu <[email protected]>
Date: Fri, 27 Jan 2023 17:17:32 -0700
Subject: [PATCH] bpf, selftests: Disable CONFIG_X86_KERNEL_IBT for vmtest.sh
CONFIG_X86_KERNEL_IBT=y was causing the following compile error:
BTF .btf.vmlinux.bin.o
btf_encoder__encode: btf__dedup failed!
Failed to encode BTF
LD .tmp_vmlinux.kallsyms1
NM .tmp_vmlinux.kallsyms1.syms
KSYMS .tmp_vmlinux.kallsyms1.S
AS .tmp_vmlinux.kallsyms1.S
LD .tmp_vmlinux.kallsyms2
NM .tmp_vmlinux.kallsyms2.syms
KSYMS .tmp_vmlinux.kallsyms2.S
AS .tmp_vmlinux.kallsyms2.S
LD .tmp_vmlinux.kallsyms3
NM .tmp_vmlinux.kallsyms3.syms
KSYMS .tmp_vmlinux.kallsyms3.S
AS .tmp_vmlinux.kallsyms3.S
LD vmlinux
BTFIDS vmlinux
libbpf: failed to find '.BTF' ELF section in vmlinux
FAILED: load BTF from vmlinux: No data available make[1]: *** [scripts/Makefile.vmlinux:34: vmlinux] Error 255 make[1]: *** Deleting file 'vmlinux'
make: *** [Makefile:1252: vmlinux] Error 2
Disable for vmtests as we do not really need the extra security measures there.
I suspect this was recently triggered by 4fd5f70ce14d ("x86/Kconfig: Enable kernel IBT by default").
--- tools/testing/selftests/bpf/config.x86_64 | 1 + 1 file changed, 1 insertion(+)
tools/testing/selftests/bpf/config.x86_64 +1 -0
@@ -237,6 +237,7 @@ CONFIG_VIRTIO_PCI=y CONFIG_VLAN_8021Q=y CONFIG_X86_ACPI_CPUFREQ=y CONFIG_X86_CPUID=y +CONFIG_X86_KERNEL_IBT=n CONFIG_X86_MSR=y CONFIG_X86_POWERNOW_K8=y CONFIG_XDP_SOCKETS_DIAG=y
--
2.39.1
Jirka and Daniel,
Quoted 62 lines · Jiri Olsa
Quoted 61 lines · Alexandre Peixoto Ferreira
Quoted 59 lines · Daniel Xu
Hi Jiri,
Quoted 42 lines · Jiri Olsa
Quoted 41 lines · Daniel Xu
Hi,
I'm getting the following error during build:
$ ./tools/testing/selftests/bpf/vmtest.sh -j30 [...] BTF .btf.vmlinux.bin.o btf_encoder__encode: btf__dedup failed! Failed to encode BTF LD .tmp_vmlinux.kallsyms1 NM .tmp_vmlinux.kallsyms1.syms KSYMS .tmp_vmlinux.kallsyms1.S AS .tmp_vmlinux.kallsyms1.S LD .tmp_vmlinux.kallsyms2 NM .tmp_vmlinux.kallsyms2.syms KSYMS .tmp_vmlinux.kallsyms2.S AS .tmp_vmlinux.kallsyms2.S LD .tmp_vmlinux.kallsyms3 NM .tmp_vmlinux.kallsyms3.syms KSYMS .tmp_vmlinux.kallsyms3.S AS .tmp_vmlinux.kallsyms3.S LD vmlinux BTFIDS vmlinux FAILED: load BTF from vmlinux: No such file or directory make[1]: *** [scripts/Makefile.vmlinux:35: vmlinux] Error 255 make[1]: *** Deleting file 'vmlinux' make: *** [Makefile:1264: vmlinux] Error 2This happens on both bpf-next/master (
84150795a49) and 6.2-rc5 (2241ab53cb).I've also tried arch linux pahole 1:1.24+r29+g02d67c5-1 as well as upstream pahole on master (
02d67c5176) and upstream pahole on next (2ca56f4c6f659).Of the above 6 combinations, I think I've tried all of them (maybe missing 1 or 2).
Looks like GCC got updated recently on my machine, so perhaps it's related?
Quoted 8 lines
Quoted 3 lines
CONFIG_CC_VERSION_TEXT="gcc (GCC) 12.2.1 20230111"I'll try some debugging, but just wanted to report it first.
hi,
I can't reproduce that.. can you reproduce it outsidevmtest.sh?there will be lot of output with patch below, but could contain some more error output
Thanks for the hints. Doing a regular build outside of
vmtest.shseems to work ok. So maybe it's a difference in the build config.I'll put a little more time into debugging to see if it goes anywhere. But I'll have to get back to the regularly scheduled programming soon.
Quoted 7 lines
Quoted 2 lines
6.2-rc5 compiles correctly when
CONFIG_X86_KERNEL_IBTis commented but fails in pahole whenCONFIG_X86_KERNEL_IBTis set.could you plese attach your config and the build error? I can't reproduce that
thanks,
jirka
My working .config is available at https://pastebin.pl/view/bef3765c
change CONFIG_X86_KERNEL_IBT to y to get the error.
The error is similar to Daniel's and is shown below:
LD .tmp_vmlinux.btf
BTF .btf.vmlinux.bin.obtf_encoder__encode: btf__dedup failed!
Failed to encode BTF
LD .tmp_vmlinux.kallsyms1
NM .tmp_vmlinux.kallsyms1.syms
KSYMS .tmp_vmlinux.kallsyms1.S
AS .tmp_vmlinux.kallsyms1.S
LD .tmp_vmlinux.kallsyms2
NM .tmp_vmlinux.kallsyms2.syms
KSYMS .tmp_vmlinux.kallsyms2.S
AS .tmp_vmlinux.kallsyms2.S
LD .tmp_vmlinux.kallsyms3
NM .tmp_vmlinux.kallsyms3.syms
KSYMS .tmp_vmlinux.kallsyms3.S
AS .tmp_vmlinux.kallsyms3.S
LD vmlinux
BTFIDS vmlinux
FAILED: load BTF from vmlinux: No such file or directory make[1]: *** [scripts/Makefile.vmlinux:35: vmlinux] Error 255 make[1]: *** Deleting file 'vmlinux'
make: *** [Makefile:1264: vmlinux] Error 2
Thanks,
Signature · 1 line
Alexandre Peixoto Ferreira
Quoted 92 lines · Alexandre Peixoto Ferreira
Jirka and Daniel,
Quoted 62 lines · Jiri Olsa
Quoted 61 lines · Alexandre Peixoto Ferreira
Quoted 59 lines · Daniel Xu
Hi Jiri,
Quoted 42 lines · Jiri Olsa
Quoted 41 lines · Daniel Xu
Hi,
I'm getting the following error during build:
$ ./tools/testing/selftests/bpf/vmtest.sh -j30 [...] BTF .btf.vmlinux.bin.o btf_encoder__encode: btf__dedup failed! Failed to encode BTF LD .tmp_vmlinux.kallsyms1 NM .tmp_vmlinux.kallsyms1.syms KSYMS .tmp_vmlinux.kallsyms1.S AS .tmp_vmlinux.kallsyms1.S LD .tmp_vmlinux.kallsyms2 NM .tmp_vmlinux.kallsyms2.syms KSYMS .tmp_vmlinux.kallsyms2.S AS .tmp_vmlinux.kallsyms2.S LD .tmp_vmlinux.kallsyms3 NM .tmp_vmlinux.kallsyms3.syms KSYMS .tmp_vmlinux.kallsyms3.S AS .tmp_vmlinux.kallsyms3.S LD vmlinux BTFIDS vmlinux FAILED: load BTF from vmlinux: No such file or directory make[1]: *** [scripts/Makefile.vmlinux:35: vmlinux] Error 255 make[1]: *** Deleting file 'vmlinux' make: *** [Makefile:1264: vmlinux] Error 2This happens on both bpf-next/master (
84150795a49) and 6.2-rc5 (2241ab53cb).I've also tried arch linux pahole 1:1.24+r29+g02d67c5-1 as well as upstream pahole on master (
02d67c5176) and upstream pahole on next (2ca56f4c6f659).Of the above 6 combinations, I think I've tried all of them (maybe missing 1 or 2).
Looks like GCC got updated recently on my machine, so perhaps it's related?
Quoted 8 lines
Quoted 3 lines
CONFIG_CC_VERSION_TEXT="gcc (GCC) 12.2.1 20230111"I'll try some debugging, but just wanted to report it first.
hi,
I can't reproduce that.. can you reproduce it outsidevmtest.sh?there will be lot of output with patch below, but could contain some more error output
Thanks for the hints. Doing a regular build outside of
vmtest.shseems to work ok. So maybe it's a difference in the build config.I'll put a little more time into debugging to see if it goes anywhere. But I'll have to get back to the regularly scheduled programming soon.
Quoted 7 lines
Quoted 2 lines
6.2-rc5 compiles correctly when
CONFIG_X86_KERNEL_IBTis commented but fails in pahole whenCONFIG_X86_KERNEL_IBTis set.could you plese attach your config and the build error? I can't reproduce that
thanks,
jirkaMy working .config is available at https://pastebin.pl/view/bef3765c
changeCONFIG_X86_KERNEL_IBTto y to get the error.The error is similar to Daniel's and is shown below:
LD .tmp_vmlinux.btf
BTF .btf.vmlinux.bin.obtf_encoder__encode:btf__dedupfailed!
Failed to encode BTF
LD .tmp_vmlinux.kallsyms1
NM .tmp_vmlinux.kallsyms1.syms
KSYMS.tmp_vmlinux.kallsyms1.S
AS.tmp_vmlinux.kallsyms1.S
LD .tmp_vmlinux.kallsyms2
NM .tmp_vmlinux.kallsyms2.syms
KSYMS.tmp_vmlinux.kallsyms2.S
AS.tmp_vmlinux.kallsyms2.S
LD .tmp_vmlinux.kallsyms3
NM .tmp_vmlinux.kallsyms3.syms
Quoted 8 lines
KSYMS
.tmp_vmlinux.kallsyms3.S
AS.tmp_vmlinux.kallsyms3.S
LD vmlinux
BTFIDS vmlinux
FAILED: load BTF from vmlinux: No such file or directory make[1]: *** [scripts/Makefile.vmlinux:35: vmlinux] Error 255 make[1]: *** Deleting file 'vmlinux'
make: *** [Makefile:1264: vmlinux] Error 2
I can't reproduce that.. I tried with gcc versions:
gcc (GCC) 13.0.1 20230117 (Red Hat 13.0.1-0)
gcc (GCC) 12.2.1 20221121 (Red Hat 12.2.1-4)
I haven't found fedora setup with 12.2.1 20230111 yet
I tried alsa with latest pahole master branch
were you guys able to get any more verbose output
that I suggested earlier?
jirka
Hello,
I seem to be having a related problem trying to build Linux at all. This used to work, but after some recent upgrades (I am also running Arch Linux), I'm getting a dedup error too. I'm also getting a "relocation to !ENDBR" error that, as far as I can tell (and that's not particularly far, to be fair), is erroneous, which makes me think something even stranger is going on with my tools. Since both of these issues appeared, so far, only on Arch Linux, it might be an Arch-speciifc packaging issue.
I've uploaded my config and pahole log to the following URLs:
https://endrift.com/files/config.gz
https://endrift.com/files/make-log.xz
Vicki
PS: My apologies for the lack of a quoted reply or any other formatting issues; I'm not subscribed to this mailing list and am struggling to figure out how to send a reply without the originals in my client. In retrospect, maybe I could have imported the .eml/mbox directly.
Jiri,
Quoted 104 lines · Jiri Olsa
Quoted 90 lines · Alexandre Peixoto Ferreira
Jirka and Daniel,
Quoted 61 lines · Jiri Olsa
Quoted 60 lines · Alexandre Peixoto Ferreira
Quoted 59 lines · Daniel Xu
Hi Jiri,
Quoted 42 lines · Jiri Olsa
Quoted 41 lines · Daniel Xu
Hi,
I'm getting the following error during build:
$ ./tools/testing/selftests/bpf/vmtest.sh -j30 [...] BTF .btf.vmlinux.bin.o btf_encoder__encode: btf__dedup failed! Failed to encode BTF LD .tmp_vmlinux.kallsyms1 NM .tmp_vmlinux.kallsyms1.syms KSYMS .tmp_vmlinux.kallsyms1.S AS .tmp_vmlinux.kallsyms1.S LD .tmp_vmlinux.kallsyms2 NM .tmp_vmlinux.kallsyms2.syms KSYMS .tmp_vmlinux.kallsyms2.S AS .tmp_vmlinux.kallsyms2.S LD .tmp_vmlinux.kallsyms3 NM .tmp_vmlinux.kallsyms3.syms KSYMS .tmp_vmlinux.kallsyms3.S AS .tmp_vmlinux.kallsyms3.S LD vmlinux BTFIDS vmlinux FAILED: load BTF from vmlinux: No such file or directory make[1]: *** [scripts/Makefile.vmlinux:35: vmlinux] Error 255 make[1]: *** Deleting file 'vmlinux' make: *** [Makefile:1264: vmlinux] Error 2This happens on both bpf-next/master (
84150795a49) and 6.2-rc5 (2241ab53cb).I've also tried arch linux pahole 1:1.24+r29+g02d67c5-1 as well as upstream pahole on master (
02d67c5176) and upstream pahole on next (2ca56f4c6f659).Of the above 6 combinations, I think I've tried all of them (maybe missing 1 or 2).
Looks like GCC got updated recently on my machine, so perhaps it's related?
Quoted 8 lines
Quoted 3 lines
CONFIG_CC_VERSION_TEXT="gcc (GCC) 12.2.1 20230111"I'll try some debugging, but just wanted to report it first.
hi,
I can't reproduce that.. can you reproduce it outsidevmtest.sh?there will be lot of output with patch below, but could contain some more error output
Thanks for the hints. Doing a regular build outside of
vmtest.shseems to work ok. So maybe it's a difference in the build config.I'll put a little more time into debugging to see if it goes anywhere. But I'll have to get back to the regularly scheduled programming soon.
Quoted 7 lines
Quoted 2 lines
6.2-rc5 compiles correctly when
CONFIG_X86_KERNEL_IBTis commented but fails in pahole whenCONFIG_X86_KERNEL_IBTis set.could you plese attach your config and the build error? I can't reproduce that
thanks,
jirkaMy working .config is available at https://pastebin.pl/view/bef3765c
changeCONFIG_X86_KERNEL_IBTto y to get the error.The error is similar to Daniel's and is shown below:
LD .tmp_vmlinux.btf
BTF .btf.vmlinux.bin.obtf_encoder__encode:btf__dedupfailed!
Failed to encode BTF
LD .tmp_vmlinux.kallsyms1
NM .tmp_vmlinux.kallsyms1.syms
KSYMS.tmp_vmlinux.kallsyms1.S
AS.tmp_vmlinux.kallsyms1.S
LD .tmp_vmlinux.kallsyms2
NM .tmp_vmlinux.kallsyms2.syms
KSYMS.tmp_vmlinux.kallsyms2.S
AS.tmp_vmlinux.kallsyms2.S
LD .tmp_vmlinux.kallsyms3
NM .tmp_vmlinux.kallsyms3.symsQuoted 8 lines
KSYMS
.tmp_vmlinux.kallsyms3.S
AS.tmp_vmlinux.kallsyms3.S
LD vmlinux
BTFIDS vmlinux
FAILED: load BTF from vmlinux: No such file or directory make[1]: *** [scripts/Makefile.vmlinux:35: vmlinux] Error 255 make[1]: *** Deleting file 'vmlinux'
make: *** [Makefile:1264: vmlinux] Error 2I can't reproduce that.. I tried with gcc versions:
gcc (GCC) 13.0.1 20230117 (Red Hat 13.0.1-0) gcc (GCC) 12.2.1 20221121 (Red Hat 12.2.1-4)
Quoted 8 lines
I haven't found fedora setup with 12.2.1 20230111 yet
I tried alsa with latest pahole master branch
were you guys able to get any more verbose output
that I suggested earlier?jirka
I compiled with and without IBT using the -V on pahole (LLVM_OBJCOPY=objcopy pahole -V -J --btf_gen_floats -j .tmp_vmlinux.btf) and the outfiles are a little too big (540MB). The error happens with this CONST type pointing to itself. That does not happen with the IBT option removed.
$ grep -n "CONST (anon) type_id" /tmp/with_IBT | more 346:[2] CONST (anon) type_id=2 349:[5] CONST (anon) type_id=5 351:[7] CONST (anon) type_id=7 356:[12] CONST (anon) type_id=12 363:[19] CONST (anon) type_id=19 373:[29] CONST (anon) type_id=29 375:[31] CONST (anon) type_id=31 409:[63] CONST (anon) type_id=63 444:[89] CONST (anon) type_id=0 472:[97] CONST (anon) type_id=97 616:[129] CONST (anon) type_id=129 652:[131] CONST (anon) type_id=131 1319:[234] CONST (anon) type_id=234 1372:[246] CONST (anon) type_id=246 ....
$diff -ru with_IBT without_IBT
without_IBT 2023-01-31 09:46:23.456005278 -0600 renamed from with_IBT 2023-01-31 09:39:24.915912735 -0600 +0 -0
@@ -340,346 +340,14800 @@
Found per-CPU symbol 'cpu_tlbstate_shared' at address 0x2c040 Found per-CPU symbol 'mce_poll_banks' at address 0x1ad20 Found 341 per-CPU variables!
-Found 61470 functions!
+Found 61462 functions!
+File .tmp_vmlinux.btf:
+[1] FUNC_PROTO (anon) return=0 args=(void)
+[2] FUNC verify_cpu type_id=1
+[3] FUNC_PROTO (anon) return=0 args=(void)
+[4] FUNC sev_verify_cbit type_id=3
+search cu 'arch/x86/kernel/head_64.S' for percpu global variables. +Found per-CPU symbol 'cpu_loops_per_jiffy' at address 0x18a08 +Found per-CPU symbol 'perf_nmi_tstamp' at address 0x19f70 +Found per-CPU symbol 'kvm_running_vcpu' at address 0x19f80 +Found per-CPU symbol 'cpu_kick_mask' at address 0x19f78 +Found per-CPU symbol 'cpu_tsc_khz' at address 0x19f88 +Found per-CPU symbol 'cpu_loops_per_jiffy' at address 0x18a08 +Found per-CPU symbol 'cpu_loops_per_jiffy' at address 0x18a08 +Found per-CPU symbol 'perf_nmi_tstamp' at address 0x19f70 +Found per-CPU symbol 'perf_nmi_tstamp' at address 0x19f70 +Found per-CPU symbol 'current_tsc_ratio' at address 0x19fa0 +Found per-CPU symbol 'cpu_loops_per_jiffy' at address 0x18a08 +Found per-CPU symbol 'cpu_loops_per_jiffy' at address 0x18a08 +Found per-CPU symbol 'kvm_running_vcpu' at address 0x19f80 +Found per-CPU symbol 'kvm_running_vcpu' at address 0x19f80 +Found per-CPU symbol 'cpu_kick_mask' at address 0x19f78 +Found per-CPU symbol 'cpu_kick_mask' at address 0x19f78 +Found per-CPU symbol 'perf_nmi_tstamp' at address 0x19f70 +Found per-CPU symbol 'perf_nmi_tstamp' at address 0x19f70 +Found per-CPU symbol 'cpu_loops_per_jiffy' at address 0x18a08 +Found per-CPU symbol 'perf_nmi_tstamp' at address 0x19f70 +Found per-CPU symbol 'cpu_tsc_khz' at address 0x19f88 +Found per-CPU symbol 'last_nmi_rip' at address 0x1a018 +Found per-CPU symbol 'nmi_stats' at address 0x1a030 +Found per-CPU symbol 'swallow_nmi' at address 0x1a020 +Found per-CPU symbol 'nmi_state' at address 0x1a010 +Found per-CPU symbol 'kvm_running_vcpu' at address 0x19f80 +Found per-CPU symbol 'nmi_cr2' at address 0x1a008 +Found per-CPU symbol 'kvm_running_vcpu' at address 0x19f80 +Found per-CPU symbol 'cpu_tsc_khz' at address 0x19f88 +Found per-CPU symbol 'cpu_kick_mask' at address 0x19f78 +Found per-CPU symbol 'cpu_kick_mask' at address 0x19f78 +Found per-CPU symbol 'cpu_loops_per_jiffy' at address 0x18a08
...
And the lines 342-365 of the with_IBT result:
342 Found 341 per-CPU variables!
343 Found 61470 functions!
344 File .tmp_vmlinux.btf:
345 [1] INT long unsigned int size=8 nr_bits=64 encoding=(none) 346 [2] CONST (anon) type_id=2
347 [3] PTR (anon) type_id=6
348 [4] INT char size=1 nr_bits=8 encoding=(none)
349 [5] CONST (anon) type_id=5
350 [6] INT unsigned int size=4 nr_bits=32 encoding=(none) 351 [7] CONST (anon) type_id=7
352 [8] TYPEDEF __s8 type_id=10
353 [9] INT signed char size=1 nr_bits=8 encoding=SIGNED 354 [10] TYPEDEF __u8 type_id=12
355 [11] INT unsigned char size=1 nr_bits=8 encoding=(none) 356 [12] CONST (anon) type_id=12
357 [13] TYPEDEF __s16 type_id=15
358 [14] INT short int size=2 nr_bits=16 encoding=SIGNED 359 [15] TYPEDEF __u16 type_id=17
360 [16] INT short unsigned int size=2 nr_bits=16 encoding=(none) 361 [17] TYPEDEF __s32 type_id=19
362 [18] INT int size=4 nr_bits=32 encoding=SIGNED
363 [19] CONST (anon) type_id=19
364 [20] TYPEDEF __u32 type_id=7
365 [21] TYPEDEF __s64 type_id=23
lines 342-362 of without_IBT
342 Found 341 per-CPU variables!
343 Found 61462 functions!
344 File .tmp_vmlinux.btf:
345 [1] FUNC_PROTO (anon) return=0 args=(void)
346 [2] FUNC verify_cpu type_id=1
347 [3] FUNC_PROTO (anon) return=0 args=(void)
348 [4] FUNC sev_verify_cbit type_id=3
349 search cu 'arch/x86/kernel/head_64.S' for percpu global variables. 350 Found per-CPU symbol 'cpu_loops_per_jiffy' at address 0x18a08 351 Found per-CPU symbol 'perf_nmi_tstamp' at address 0x19f70 352 Found per-CPU symbol 'kvm_running_vcpu' at address 0x19f80 353 Found per-CPU symbol 'cpu_kick_mask' at address 0x19f78 354 Found per-CPU symbol 'cpu_tsc_khz' at address 0x19f88 355 Found per-CPU symbol 'cpu_loops_per_jiffy' at address 0x18a08 356 Found per-CPU symbol 'cpu_loops_per_jiffy' at address 0x18a08 357 Found per-CPU symbol 'perf_nmi_tstamp' at address 0x19f70 358 Found per-CPU symbol 'perf_nmi_tstamp' at address 0x19f70 359 Found per-CPU symbol 'current_tsc_ratio' at address 0x19fa0 360 Found per-CPU symbol 'cpu_loops_per_jiffy' at address 0x18a08 361 Found per-CPU symbol 'cpu_loops_per_jiffy' at address 0x18a08 362 Found per-CPU symbol 'kvm_running_vcpu' at address 0x19f80
If the full debug files are useful or a target grep or diff is better let me know.
Thanks,
Signature · 1 line
Alexandre Peixoto Ferreira
Quoted 234 lines · Alexandre Peixoto Ferreira
Jiri,
Quoted 104 lines · Jiri Olsa
Quoted 90 lines · Alexandre Peixoto Ferreira
Jirka and Daniel,
Quoted 61 lines · Jiri Olsa
Quoted 60 lines · Alexandre Peixoto Ferreira
Quoted 59 lines · Daniel Xu
Hi Jiri,
Quoted 42 lines · Jiri Olsa
Quoted 41 lines · Daniel Xu
Hi,
I'm getting the following error during build:
$ ./tools/testing/selftests/bpf/vmtest.sh -j30 [...] BTF .btf.vmlinux.bin.o btf_encoder__encode: btf__dedup failed! Failed to encode BTF LD .tmp_vmlinux.kallsyms1 NM .tmp_vmlinux.kallsyms1.syms KSYMS .tmp_vmlinux.kallsyms1.S AS .tmp_vmlinux.kallsyms1.S LD .tmp_vmlinux.kallsyms2 NM .tmp_vmlinux.kallsyms2.syms KSYMS .tmp_vmlinux.kallsyms2.S AS .tmp_vmlinux.kallsyms2.S LD .tmp_vmlinux.kallsyms3 NM .tmp_vmlinux.kallsyms3.syms KSYMS .tmp_vmlinux.kallsyms3.S AS .tmp_vmlinux.kallsyms3.S LD vmlinux BTFIDS vmlinux FAILED: load BTF from vmlinux: No such file or directory make[1]: *** [scripts/Makefile.vmlinux:35: vmlinux] Error 255 make[1]: *** Deleting file 'vmlinux' make: *** [Makefile:1264: vmlinux] Error 2This happens on both bpf-next/master (
84150795a49) and 6.2-rc5 (2241ab53cb).I've also tried arch linux pahole 1:1.24+r29+g02d67c5-1 as well as upstream pahole on master (
02d67c5176) and upstream pahole on next (2ca56f4c6f659).Of the above 6 combinations, I think I've tried all of them (maybe missing 1 or 2).
Looks like GCC got updated recently on my machine, so perhaps it's related?
Quoted 8 lines
Quoted 3 lines
CONFIG_CC_VERSION_TEXT="gcc(GCC) 12.2.1 20230111"I'll try some debugging, but just wanted to report it first.
hi,
I can't reproduce that.. can you reproduce it outsidevmtest.sh?there will be lot of output with patch below, but could contain some more error output
Thanks for the hints. Doing a regular build outside of
vmtest.shseems to work ok. So maybe it's a difference in the build config.I'll put a little more time into debugging to see if it goes anywhere. But I'll have to get back to the regularly scheduled programming soon.
Quoted 7 lines
Quoted 2 lines
6.2-rc5 compiles correctly when
CONFIG_X86_KERNEL_IBTis commented but fails in pahole whenCONFIG_X86_KERNEL_IBTis set.could you plese attach your config and the build error? I can't reproduce that
thanks,
jirkaMy working .config is available at https://pastebin.pl/view/bef3765c
changeCONFIG_X86_KERNEL_IBTto y to get the error.The error is similar to Daniel's and is shown below:
LD .tmp_vmlinux.btf
BTF .btf.vmlinux.bin.obtf_encoder__encode:btf__dedupfailed!
Failed to encode BTF
LD .tmp_vmlinux.kallsyms1
NM .tmp_vmlinux.kallsyms1.syms
KSYMS.tmp_vmlinux.kallsyms1.S
AS.tmp_vmlinux.kallsyms1.S
LD .tmp_vmlinux.kallsyms2
NM .tmp_vmlinux.kallsyms2.syms
KSYMS.tmp_vmlinux.kallsyms2.S
AS.tmp_vmlinux.kallsyms2.S
LD .tmp_vmlinux.kallsyms3
NM .tmp_vmlinux.kallsyms3.symsQuoted 8 lines
KSYMS
.tmp_vmlinux.kallsyms3.S
AS.tmp_vmlinux.kallsyms3.S
LD vmlinux
BTFIDS vmlinux
FAILED: load BTF from vmlinux: No such file or directory make[1]: *** [scripts/Makefile.vmlinux:35: vmlinux] Error 255 make[1]: *** Deleting file 'vmlinux'
make: *** [Makefile:1264: vmlinux] Error 2I can't reproduce that.. I tried with gcc versions:
gcc (GCC) 13.0.1 20230117 (Red Hat 13.0.1-0)
gcc (GCC) 12.2.1 20221121 (Red Hat 12.2.1-4)Quoted 8 lines
I haven't found fedora setup with 12.2.1 20230111 yet
I tried alsa with latest pahole master branch
were you guys able to get any more verbose output
that I suggested earlier?jirka
I compiled with and without IBT using the -V on pahole (LLVM_OBJCOPY=objcopy pahole -V -J --btf_gen_floats -j .tmp_vmlinux.btf) and the outfiles are a little too big (540MB). The error happens with this CONST type pointing to itself. That does not happen with the IBT option removed.
$ grep -n "CONST (anon) type_id" /tmp/with_IBT | more 346:[2] CONST (anon) type_id=2 349:[5] CONST (anon) type_id=5 351:[7] CONST (anon) type_id=7 356:[12] CONST (anon) type_id=12 363:[19] CONST (anon) type_id=19 373:[29] CONST (anon) type_id=29 375:[31] CONST (anon) type_id=31 409:[63] CONST (anon) type_id=63 444:[89] CONST (anon) type_id=0 472:[97] CONST (anon) type_id=97 616:[129] CONST (anon) type_id=129 652:[131] CONST (anon) type_id=131 1319:[234] CONST (anon) type_id=234 1372:[246] CONST (anon) type_id=246 ....$diff -ru
with_IBTwithout_IBTwithout_IBT 2023-01-31 09:46:23.456005278 -0600 renamed from with_IBT 2023-01-31 09:39:24.915912735 -0600 +0
-0@@ -340,346 +340,14800 @@Found per-CPU symbol '
cpu_tlbstate_shared' at address0x2c040Found per-CPU symbol 'mce_poll_banks' at address0x1ad20Found 341 per-CPU variables!without_IBT 2023-01-31 09:46:23.456005278 -0600 renamed from with_IBT 2023-01-31 09:39:24.915912735 -0600 +39
-1-Found 61470 functions! +Found 61462 functions! +File .tmp_vmlinux.btf: +[1] FUNC_PROTO (anon) return=0 args=(void) +[2] FUNC verify_cpu type_id=1 +[3] FUNC_PROTO (anon) return=0 args=(void) +[4] FUNC sev_verify_cbit type_id=3 +search cu 'arch/x86/kernel/head_64.S' for percpu global variables. +Found per-CPU symbol 'cpu_loops_per_jiffy' at address 0x18a08 +Found per-CPU symbol 'perf_nmi_tstamp' at address 0x19f70 +Found per-CPU symbol 'kvm_running_vcpu' at address 0x19f80 +Found per-CPU symbol 'cpu_kick_mask' at address 0x19f78 +Found per-CPU symbol 'cpu_tsc_khz' at address 0x19f88 +Found per-CPU symbol 'cpu_loops_per_jiffy' at address 0x18a08 +Found per-CPU symbol 'cpu_loops_per_jiffy' at address 0x18a08 +Found per-CPU symbol 'perf_nmi_tstamp' at address 0x19f70 +Found per-CPU symbol 'perf_nmi_tstamp' at address 0x19f70 +Found per-CPU symbol 'current_tsc_ratio' at address 0x19fa0 +Found per-CPU symbol 'cpu_loops_per_jiffy' at address 0x18a08 +Found per-CPU symbol 'cpu_loops_per_jiffy' at address 0x18a08 +Found per-CPU symbol 'kvm_running_vcpu' at address 0x19f80 +Found per-CPU symbol 'kvm_running_vcpu' at address 0x19f80 +Found per-CPU symbol 'cpu_kick_mask' at address 0x19f78 +Found per-CPU symbol 'cpu_kick_mask' at address 0x19f78 +Found per-CPU symbol 'perf_nmi_tstamp' at address 0x19f70 +Found per-CPU symbol 'perf_nmi_tstamp' at address 0x19f70 +Found per-CPU symbol 'cpu_loops_per_jiffy' at address 0x18a08 +Found per-CPU symbol 'perf_nmi_tstamp' at address 0x19f70 +Found per-CPU symbol 'cpu_tsc_khz' at address 0x19f88 +Found per-CPU symbol 'last_nmi_rip' at address 0x1a018 +Found per-CPU symbol 'nmi_stats' at address 0x1a030 +Found per-CPU symbol 'swallow_nmi' at address 0x1a020 +Found per-CPU symbol 'nmi_state' at address 0x1a010 +Found per-CPU symbol 'kvm_running_vcpu' at address 0x19f80 +Found per-CPU symbol 'nmi_cr2' at address 0x1a008 +Found per-CPU symbol 'kvm_running_vcpu' at address 0x19f80 +Found per-CPU symbol 'cpu_tsc_khz' at address 0x19f88 +Found per-CPU symbol 'cpu_kick_mask' at address 0x19f78 +Found per-CPU symbol 'cpu_kick_mask' at address 0x19f78 +Found per-CPU symbol 'cpu_loops_per_jiffy' at address 0x18a08And the lines 342-365 of the
with_IBTresult:
342 Found 341 per-CPU variables!
343 Found 61470 functions!
344 File .tmp_vmlinux.btf:
345 [1] INT long unsigned int size=8 nr_bits=64 encoding=(none) 346 [2] CONST (anon) type_id=2
347 [3] PTR (anon) type_id=6
348 [4] INT char size=1 nr_bits=8 encoding=(none)
349 [5] CONST (anon) type_id=5
350 [6] INT unsigned int size=4 nr_bits=32 encoding=(none) 351 [7] CONST (anon) type_id=7
352 [8] TYPEDEF__s8type_id=10
353 [9] INT signed char size=1 nr_bits=8 encoding=SIGNED 354 [10] TYPEDEF__u8type_id=12
355 [11] INT unsigned char size=1 nr_bits=8 encoding=(none) 356 [12] CONST (anon) type_id=12
357 [13] TYPEDEF__s16type_id=15
358 [14] INT short int size=2 nr_bits=16 encoding=SIGNED 359 [15] TYPEDEF__u16type_id=17
360 [16] INT short unsigned int size=2 nr_bits=16 encoding=(none) 361 [17] TYPEDEF__s32type_id=19
362 [18] INT int size=4 nr_bits=32 encoding=SIGNED
363 [19] CONST (anon) type_id=19
364 [20] TYPEDEF__u32type_id=7
365 [21] TYPEDEF__s64type_id=23lines 342-362 of
without_IBT342 Found 341 per-CPU variables!
343 Found 61462 functions!
344 File .tmp_vmlinux.btf:
345 [1]FUNC_PROTO(anon) return=0 args=(void)
346 [2] FUNCverify_cputype_id=1
347 [3]FUNC_PROTO(anon) return=0 args=(void)
348 [4] FUNCsev_verify_cbittype_id=3
349 search cu 'arch/x86/kernel/head_64.S' for percpu global variables. 350 Found per-CPU symbol 'cpu_loops_per_jiffy' at address0x18a08351 Found per-CPU symbol 'perf_nmi_tstamp' at address0x19f70352 Found per-CPU symbol 'kvm_running_vcpu' at address0x19f80353 Found per-CPU symbol 'cpu_kick_mask' at address0x19f78354 Found per-CPU symbol 'cpu_tsc_khz' at address0x19f88355 Found per-CPU symbol 'cpu_loops_per_jiffy' at address0x18a08356 Found per-CPU symbol 'cpu_loops_per_jiffy' at address0x18a08357 Found per-CPU symbol 'perf_nmi_tstamp' at address0x19f70358 Found per-CPU symbol 'perf_nmi_tstamp' at address0x19f70359 Found per-CPU symbol 'current_tsc_ratio' at address0x19fa0360 Found per-CPU symbol 'cpu_loops_per_jiffy' at address0x18a08361 Found per-CPU symbol 'cpu_loops_per_jiffy' at address0x18a08362 Found per-CPU symbol 'kvm_running_vcpu' at address0x19f80
Quoted 2 lines
If the full debug files are useful or a target grep or diff is better let me know.
I managed to reproduce this too with IBT enabled; one thing I noticed is with pahole built with an up-to-date libbpf and the changes in https://github.com/acmel/dwarves/tree/next, the problem went away. I didn't have time to root-cause it yet however.
Not sure if you're in a position to do this, but if you can, would you mind building pahole from
https://github.com/acmel/dwarves/tree/next
...and re-testing to see if that helps? Thanks!
Alan
Quoted 2 lines
Thanks,
Alam,
Quoted 241 lines · Alan Maguire
Quoted 233 lines · Alexandre Peixoto Ferreira
Jiri,
Quoted 104 lines · Jiri Olsa
Quoted 90 lines · Alexandre Peixoto Ferreira
Jirka and Daniel,
Quoted 61 lines · Jiri Olsa
Quoted 60 lines · Alexandre Peixoto Ferreira
Quoted 59 lines · Daniel Xu
Hi Jiri,
Quoted 42 lines · Jiri Olsa
Quoted 41 lines · Daniel Xu
Hi,
I'm getting the following error during build:
$ ./tools/testing/selftests/bpf/vmtest.sh -j30 [...] BTF .btf.vmlinux.bin.o btf_encoder__encode: btf__dedup failed! Failed to encode BTF LD .tmp_vmlinux.kallsyms1 NM .tmp_vmlinux.kallsyms1.syms KSYMS .tmp_vmlinux.kallsyms1.S AS .tmp_vmlinux.kallsyms1.S LD .tmp_vmlinux.kallsyms2 NM .tmp_vmlinux.kallsyms2.syms KSYMS .tmp_vmlinux.kallsyms2.S AS .tmp_vmlinux.kallsyms2.S LD .tmp_vmlinux.kallsyms3 NM .tmp_vmlinux.kallsyms3.syms KSYMS .tmp_vmlinux.kallsyms3.S AS .tmp_vmlinux.kallsyms3.S LD vmlinux BTFIDS vmlinux FAILED: load BTF from vmlinux: No such file or directory make[1]: *** [scripts/Makefile.vmlinux:35: vmlinux] Error 255 make[1]: *** Deleting file 'vmlinux' make: *** [Makefile:1264: vmlinux] Error 2This happens on both bpf-next/master (
84150795a49) and 6.2-rc5 (2241ab53cb).I've also tried arch linux pahole 1:1.24+r29+g02d67c5-1 as well as upstream pahole on master (
02d67c5176) and upstream pahole on next (2ca56f4c6f659).Of the above 6 combinations, I think I've tried all of them (maybe missing 1 or 2).
Looks like GCC got updated recently on my machine, so perhaps it's related?
Quoted 8 lines
Quoted 3 lines
CONFIG_CC_VERSION_TEXT="gcc(GCC) 12.2.1 20230111"I'll try some debugging, but just wanted to report it first.
hi,
I can't reproduce that.. can you reproduce it outsidevmtest.sh?there will be lot of output with patch below, but could contain some more error output
Thanks for the hints. Doing a regular build outside of
vmtest.shseems to work ok. So maybe it's a difference in the build config.I'll put a little more time into debugging to see if it goes anywhere. But I'll have to get back to the regularly scheduled programming soon.
Quoted 7 lines
Quoted 2 lines
6.2-rc5 compiles correctly when
CONFIG_X86_KERNEL_IBTis commented but fails in pahole whenCONFIG_X86_KERNEL_IBTis set.could you plese attach your config and the build error? I can't reproduce that
thanks,
jirkaMy working .config is available at https://pastebin.pl/view/bef3765c
changeCONFIG_X86_KERNEL_IBTto y to get the error.The error is similar to Daniel's and is shown below:
LD .tmp_vmlinux.btf
BTF .btf.vmlinux.bin.obtf_encoder__encode:btf__dedupfailed!
Failed to encode BTF
LD .tmp_vmlinux.kallsyms1
NM .tmp_vmlinux.kallsyms1.syms
KSYMS.tmp_vmlinux.kallsyms1.S
AS.tmp_vmlinux.kallsyms1.S
LD .tmp_vmlinux.kallsyms2
NM .tmp_vmlinux.kallsyms2.syms
KSYMS.tmp_vmlinux.kallsyms2.S
AS.tmp_vmlinux.kallsyms2.S
LD .tmp_vmlinux.kallsyms3
NM .tmp_vmlinux.kallsyms3.symsQuoted 8 lines
KSYMS
.tmp_vmlinux.kallsyms3.S
AS.tmp_vmlinux.kallsyms3.S
LD vmlinux
BTFIDS vmlinux
FAILED: load BTF from vmlinux: No such file or directory make[1]: *** [scripts/Makefile.vmlinux:35: vmlinux] Error 255 make[1]: *** Deleting file 'vmlinux'
make: *** [Makefile:1264: vmlinux] Error 2I can't reproduce that.. I tried with gcc versions:
gcc (GCC) 13.0.1 20230117 (Red Hat 13.0.1-0)
gcc (GCC) 12.2.1 20221121 (Red Hat 12.2.1-4)Quoted 8 lines
I haven't found fedora setup with 12.2.1 20230111 yet
I tried alsa with latest pahole master branch
were you guys able to get any more verbose output
that I suggested earlier?jirka
I compiled with and without IBT using the -V on pahole (LLVM_OBJCOPY=objcopy pahole -V -J --btf_gen_floats -j .tmp_vmlinux.btf) and the outfiles are a little too big (540MB). The error happens with this CONST type pointing to itself. That does not happen with the IBT option removed.
$ grep -n "CONST (anon) type_id" /tmp/with_IBT | more 346:[2] CONST (anon) type_id=2 349:[5] CONST (anon) type_id=5 351:[7] CONST (anon) type_id=7 356:[12] CONST (anon) type_id=12 363:[19] CONST (anon) type_id=19 373:[29] CONST (anon) type_id=29 375:[31] CONST (anon) type_id=31 409:[63] CONST (anon) type_id=63 444:[89] CONST (anon) type_id=0 472:[97] CONST (anon) type_id=97 616:[129] CONST (anon) type_id=129 652:[131] CONST (anon) type_id=131 1319:[234] CONST (anon) type_id=234 1372:[246] CONST (anon) type_id=246 ....$diff -ru
with_IBTwithout_IBTwithout_IBT 2023-01-31 09:46:23.456005278 -0600 renamed from with_IBT 2023-01-31 09:39:24.915912735 -0600 +39
-1@@ -340,346 +340,14800 @@ Found per-CPU symbol 'cpu_tlbstate_shared' at address 0x2c040 Found per-CPU symbol 'mce_poll_banks' at address 0x1ad20 Found 341 per-CPU variables! -Found 61470 functions! +Found 61462 functions! +File .tmp_vmlinux.btf: +[1] FUNC_PROTO (anon) return=0 args=(void) +[2] FUNC verify_cpu type_id=1 +[3] FUNC_PROTO (anon) return=0 args=(void) +[4] FUNC sev_verify_cbit type_id=3 +search cu 'arch/x86/kernel/head_64.S' for percpu global variables. +Found per-CPU symbol 'cpu_loops_per_jiffy' at address 0x18a08 +Found per-CPU symbol 'perf_nmi_tstamp' at address 0x19f70 +Found per-CPU symbol 'kvm_running_vcpu' at address 0x19f80 +Found per-CPU symbol 'cpu_kick_mask' at address 0x19f78 +Found per-CPU symbol 'cpu_tsc_khz' at address 0x19f88 +Found per-CPU symbol 'cpu_loops_per_jiffy' at address 0x18a08 +Found per-CPU symbol 'cpu_loops_per_jiffy' at address 0x18a08 +Found per-CPU symbol 'perf_nmi_tstamp' at address 0x19f70 +Found per-CPU symbol 'perf_nmi_tstamp' at address 0x19f70 +Found per-CPU symbol 'current_tsc_ratio' at address 0x19fa0 +Found per-CPU symbol 'cpu_loops_per_jiffy' at address 0x18a08 +Found per-CPU symbol 'cpu_loops_per_jiffy' at address 0x18a08 +Found per-CPU symbol 'kvm_running_vcpu' at address 0x19f80 +Found per-CPU symbol 'kvm_running_vcpu' at address 0x19f80 +Found per-CPU symbol 'cpu_kick_mask' at address 0x19f78 +Found per-CPU symbol 'cpu_kick_mask' at address 0x19f78 +Found per-CPU symbol 'perf_nmi_tstamp' at address 0x19f70 +Found per-CPU symbol 'perf_nmi_tstamp' at address 0x19f70 +Found per-CPU symbol 'cpu_loops_per_jiffy' at address 0x18a08 +Found per-CPU symbol 'perf_nmi_tstamp' at address 0x19f70 +Found per-CPU symbol 'cpu_tsc_khz' at address 0x19f88 +Found per-CPU symbol 'last_nmi_rip' at address 0x1a018 +Found per-CPU symbol 'nmi_stats' at address 0x1a030 +Found per-CPU symbol 'swallow_nmi' at address 0x1a020 +Found per-CPU symbol 'nmi_state' at address 0x1a010 +Found per-CPU symbol 'kvm_running_vcpu' at address 0x19f80 +Found per-CPU symbol 'nmi_cr2' at address 0x1a008 +Found per-CPU symbol 'kvm_running_vcpu' at address 0x19f80 +Found per-CPU symbol 'cpu_tsc_khz' at address 0x19f88 +Found per-CPU symbol 'cpu_kick_mask' at address 0x19f78 +Found per-CPU symbol 'cpu_kick_mask' at address 0x19f78 +Found per-CPU symbol 'cpu_loops_per_jiffy' at address 0x18a08And the lines 342-365 of the
with_IBTresult:
342 Found 341 per-CPU variables!
343 Found 61470 functions!
344 File .tmp_vmlinux.btf:
345 [1] INT long unsigned int size=8 nr_bits=64 encoding=(none) 346 [2] CONST (anon) type_id=2
347 [3] PTR (anon) type_id=6
348 [4] INT char size=1 nr_bits=8 encoding=(none)
349 [5] CONST (anon) type_id=5
350 [6] INT unsigned int size=4 nr_bits=32 encoding=(none) 351 [7] CONST (anon) type_id=7
352 [8] TYPEDEF__s8type_id=10
353 [9] INT signed char size=1 nr_bits=8 encoding=SIGNED 354 [10] TYPEDEF__u8type_id=12
355 [11] INT unsigned char size=1 nr_bits=8 encoding=(none) 356 [12] CONST (anon) type_id=12
357 [13] TYPEDEF__s16type_id=15
358 [14] INT short int size=2 nr_bits=16 encoding=SIGNED 359 [15] TYPEDEF__u16type_id=17
360 [16] INT short unsigned int size=2 nr_bits=16 encoding=(none) 361 [17] TYPEDEF__s32type_id=19
362 [18] INT int size=4 nr_bits=32 encoding=SIGNED
363 [19] CONST (anon) type_id=19
364 [20] TYPEDEF__u32type_id=7
365 [21] TYPEDEF__s64type_id=23lines 342-362 of
without_IBT342 Found 341 per-CPU variables!
343 Found 61462 functions!
344 File .tmp_vmlinux.btf:
345 [1]FUNC_PROTO(anon) return=0 args=(void)
346 [2] FUNCverify_cputype_id=1
347 [3]FUNC_PROTO(anon) return=0 args=(void)
348 [4] FUNCsev_verify_cbittype_id=3
349 search cu 'arch/x86/kernel/head_64.S' for percpu global variables. 350 Found per-CPU symbol 'cpu_loops_per_jiffy' at address0x18a08351 Found per-CPU symbol 'perf_nmi_tstamp' at address0x19f70352 Found per-CPU symbol 'kvm_running_vcpu' at address0x19f80353 Found per-CPU symbol 'cpu_kick_mask' at address0x19f78354 Found per-CPU symbol 'cpu_tsc_khz' at address0x19f88355 Found per-CPU symbol 'cpu_loops_per_jiffy' at address0x18a08356 Found per-CPU symbol 'cpu_loops_per_jiffy' at address0x18a08357 Found per-CPU symbol 'perf_nmi_tstamp' at address0x19f70358 Found per-CPU symbol 'perf_nmi_tstamp' at address0x19f70359 Found per-CPU symbol 'current_tsc_ratio' at address0x19fa0360 Found per-CPU symbol 'cpu_loops_per_jiffy' at address0x18a08361 Found per-CPU symbol 'cpu_loops_per_jiffy' at address0x18a08362 Found per-CPU symbol 'kvm_running_vcpu' at address0x19f80Quoted 2 lines
If the full debug files are useful or a target grep or diff is better let me know.
I managed to reproduce this too with IBT enabled; one thing I noticed is with pahole built with an up-to-date libbpf and the changes in https://github.com/acmel/dwarves/tree/next, the problem went away. I didn't have time to root-cause it yet however.
Quoted 11 lines
Not sure if you're in a position to do this, but if you can, would you mind building pahole from
https://github.com/acmel/dwarves/tree/next
...and re-testing to see if that helps? Thanks!
Alan
Quoted 2 lines
Thanks,
I tried with libbpf compiled from master https://github.com/libbpf/libbpf.git and pahole compiled from next branch on https://github.com/acmel/dwarve with the same result. With IBT enabled pahole fails and removing it results in a successful kernel.
Alex,
Signature · 1 line
Alexandre Peixoto Ferreira
Quoted 251 lines · Alexandre Peixoto Ferreira
Alam,
Quoted 248 lines · Alan Maguire
Quoted 233 lines · Alexandre Peixoto Ferreira
Jiri,
Quoted 104 lines · Jiri Olsa
Quoted 90 lines · Alexandre Peixoto Ferreira
Jirka and Daniel,
Quoted 61 lines · Jiri Olsa
Quoted 60 lines · Alexandre Peixoto Ferreira
Quoted 59 lines · Daniel Xu
Hi Jiri,
Quoted 42 lines · Jiri Olsa
Quoted 41 lines · Daniel Xu
Hi,
I'm getting the following error during build:
$ ./tools/testing/selftests/bpf/vmtest.sh -j30 [...] BTF .btf.vmlinux.bin.o btf_encoder__encode: btf__dedup failed! Failed to encode BTF LD .tmp_vmlinux.kallsyms1 NM .tmp_vmlinux.kallsyms1.syms KSYMS .tmp_vmlinux.kallsyms1.S AS .tmp_vmlinux.kallsyms1.S LD .tmp_vmlinux.kallsyms2 NM .tmp_vmlinux.kallsyms2.syms KSYMS .tmp_vmlinux.kallsyms2.S AS .tmp_vmlinux.kallsyms2.S LD .tmp_vmlinux.kallsyms3 NM .tmp_vmlinux.kallsyms3.syms KSYMS .tmp_vmlinux.kallsyms3.S AS .tmp_vmlinux.kallsyms3.S LD vmlinux BTFIDS vmlinux FAILED: load BTF from vmlinux: No such file or directory make[1]: *** [scripts/Makefile.vmlinux:35: vmlinux] Error 255 make[1]: *** Deleting file 'vmlinux' make: *** [Makefile:1264: vmlinux] Error 2This happens on both bpf-next/master (
84150795a49) and 6.2-rc5 (2241ab53cb).I've also tried arch linux pahole 1:1.24+r29+g02d67c5-1 as well as upstream pahole on master (
02d67c5176) and upstream pahole on next (2ca56f4c6f659).Of the above 6 combinations, I think I've tried all of them (maybe missing 1 or 2).
Looks like GCC got updated recently on my machine, so perhaps it's related?
Quoted 8 lines
Quoted 3 lines
CONFIG_CC_VERSION_TEXT="gcc(GCC) 12.2.1 20230111"I'll try some debugging, but just wanted to report it first.
hi,
I can't reproduce that.. can you reproduce it outsidevmtest.sh?there will be lot of output with patch below, but could contain some more error output
Thanks for the hints. Doing a regular build outside of
vmtest.shseems to work ok. So maybe it's a difference in the build config.I'll put a little more time into debugging to see if it goes anywhere. But I'll have to get back to the regularly scheduled programming soon.
Quoted 7 lines
Quoted 2 lines
6.2-rc5 compiles correctly when
CONFIG_X86_KERNEL_IBTis commented but fails in pahole whenCONFIG_X86_KERNEL_IBTis set.could you plese attach your config and the build error? I can't reproduce that
thanks,
jirkaMy working .config is available at https://pastebin.pl/view/bef3765c
changeCONFIG_X86_KERNEL_IBTto y to get the error.The error is similar to Daniel's and is shown below:
LD .tmp_vmlinux.btf
BTF .btf.vmlinux.bin.obtf_encoder__encode:btf__dedupfailed!
Failed to encode BTF
LD .tmp_vmlinux.kallsyms1
NM .tmp_vmlinux.kallsyms1.syms
KSYMS.tmp_vmlinux.kallsyms1.S
AS.tmp_vmlinux.kallsyms1.S
LD .tmp_vmlinux.kallsyms2
NM .tmp_vmlinux.kallsyms2.syms
KSYMS.tmp_vmlinux.kallsyms2.S
AS.tmp_vmlinux.kallsyms2.S
LD .tmp_vmlinux.kallsyms3
NM .tmp_vmlinux.kallsyms3.symsQuoted 8 lines
KSYMS
.tmp_vmlinux.kallsyms3.S
AS.tmp_vmlinux.kallsyms3.S
LD vmlinux
BTFIDS vmlinux
FAILED: load BTF from vmlinux: No such file or directory make[1]: *** [scripts/Makefile.vmlinux:35: vmlinux] Error 255 make[1]: *** Deleting file 'vmlinux'
make: *** [Makefile:1264: vmlinux] Error 2I can't reproduce that.. I tried with gcc versions:
gcc (GCC) 13.0.1 20230117 (Red Hat 13.0.1-0)
gcc (GCC) 12.2.1 20221121 (Red Hat 12.2.1-4)Quoted 8 lines
I haven't found fedora setup with 12.2.1 20230111 yet
I tried alsa with latest pahole master branch
were you guys able to get any more verbose output
that I suggested earlier?jirka
I compiled with and without IBT using the -V on pahole (LLVM_OBJCOPY=objcopy pahole -V -J --btf_gen_floats -j .tmp_vmlinux.btf) and the outfiles are a little too big (540MB). The error happens with this CONST type pointing to itself. That does not happen with the IBT option removed.
$ grep -n "CONST (anon) type_id" /tmp/with_IBT | more 346:[2] CONST (anon) type_id=2 349:[5] CONST (anon) type_id=5 351:[7] CONST (anon) type_id=7 356:[12] CONST (anon) type_id=12 363:[19] CONST (anon) type_id=19 373:[29] CONST (anon) type_id=29 375:[31] CONST (anon) type_id=31 409:[63] CONST (anon) type_id=63 444:[89] CONST (anon) type_id=0 472:[97] CONST (anon) type_id=97 616:[129] CONST (anon) type_id=129 652:[131] CONST (anon) type_id=131 1319:[234] CONST (anon) type_id=234 1372:[246] CONST (anon) type_id=246 ....$diff -ru
with_IBTwithout_IBTwithout_IBT 2023-01-31 09:46:23.456005278 -0600 renamed from with_IBT 2023-01-31 09:39:24.915912735 -0600 +39
-1@@ -340,346 +340,14800 @@ Found per-CPU symbol 'cpu_tlbstate_shared' at address 0x2c040 Found per-CPU symbol 'mce_poll_banks' at address 0x1ad20 Found 341 per-CPU variables! -Found 61470 functions! +Found 61462 functions! +File .tmp_vmlinux.btf: +[1] FUNC_PROTO (anon) return=0 args=(void) +[2] FUNC verify_cpu type_id=1 +[3] FUNC_PROTO (anon) return=0 args=(void) +[4] FUNC sev_verify_cbit type_id=3 +search cu 'arch/x86/kernel/head_64.S' for percpu global variables. +Found per-CPU symbol 'cpu_loops_per_jiffy' at address 0x18a08 +Found per-CPU symbol 'perf_nmi_tstamp' at address 0x19f70 +Found per-CPU symbol 'kvm_running_vcpu' at address 0x19f80 +Found per-CPU symbol 'cpu_kick_mask' at address 0x19f78 +Found per-CPU symbol 'cpu_tsc_khz' at address 0x19f88 +Found per-CPU symbol 'cpu_loops_per_jiffy' at address 0x18a08 +Found per-CPU symbol 'cpu_loops_per_jiffy' at address 0x18a08 +Found per-CPU symbol 'perf_nmi_tstamp' at address 0x19f70 +Found per-CPU symbol 'perf_nmi_tstamp' at address 0x19f70 +Found per-CPU symbol 'current_tsc_ratio' at address 0x19fa0 +Found per-CPU symbol 'cpu_loops_per_jiffy' at address 0x18a08 +Found per-CPU symbol 'cpu_loops_per_jiffy' at address 0x18a08 +Found per-CPU symbol 'kvm_running_vcpu' at address 0x19f80 +Found per-CPU symbol 'kvm_running_vcpu' at address 0x19f80 +Found per-CPU symbol 'cpu_kick_mask' at address 0x19f78 +Found per-CPU symbol 'cpu_kick_mask' at address 0x19f78 +Found per-CPU symbol 'perf_nmi_tstamp' at address 0x19f70 +Found per-CPU symbol 'perf_nmi_tstamp' at address 0x19f70 +Found per-CPU symbol 'cpu_loops_per_jiffy' at address 0x18a08 +Found per-CPU symbol 'perf_nmi_tstamp' at address 0x19f70 +Found per-CPU symbol 'cpu_tsc_khz' at address 0x19f88 +Found per-CPU symbol 'last_nmi_rip' at address 0x1a018 +Found per-CPU symbol 'nmi_stats' at address 0x1a030 +Found per-CPU symbol 'swallow_nmi' at address 0x1a020 +Found per-CPU symbol 'nmi_state' at address 0x1a010 +Found per-CPU symbol 'kvm_running_vcpu' at address 0x19f80 +Found per-CPU symbol 'nmi_cr2' at address 0x1a008 +Found per-CPU symbol 'kvm_running_vcpu' at address 0x19f80 +Found per-CPU symbol 'cpu_tsc_khz' at address 0x19f88 +Found per-CPU symbol 'cpu_kick_mask' at address 0x19f78 +Found per-CPU symbol 'cpu_kick_mask' at address 0x19f78 +Found per-CPU symbol 'cpu_loops_per_jiffy' at address 0x18a08And the lines 342-365 of the
with_IBTresult:
342 Found 341 per-CPU variables!
343 Found 61470 functions!
344 File .tmp_vmlinux.btf:
345 [1] INT long unsigned int size=8 nr_bits=64 encoding=(none) 346 [2] CONST (anon) type_id=2
347 [3] PTR (anon) type_id=6
348 [4] INT char size=1 nr_bits=8 encoding=(none)
349 [5] CONST (anon) type_id=5
350 [6] INT unsigned int size=4 nr_bits=32 encoding=(none) 351 [7] CONST (anon) type_id=7
352 [8] TYPEDEF__s8type_id=10
353 [9] INT signed char size=1 nr_bits=8 encoding=SIGNED 354 [10] TYPEDEF__u8type_id=12
355 [11] INT unsigned char size=1 nr_bits=8 encoding=(none) 356 [12] CONST (anon) type_id=12
357 [13] TYPEDEF__s16type_id=15
358 [14] INT short int size=2 nr_bits=16 encoding=SIGNED 359 [15] TYPEDEF__u16type_id=17
360 [16] INT short unsigned int size=2 nr_bits=16 encoding=(none) 361 [17] TYPEDEF__s32type_id=19
362 [18] INT int size=4 nr_bits=32 encoding=SIGNED
363 [19] CONST (anon) type_id=19
364 [20] TYPEDEF__u32type_id=7
365 [21] TYPEDEF__s64type_id=23lines 342-362 of
without_IBT342 Found 341 per-CPU variables!
343 Found 61462 functions!
344 File .tmp_vmlinux.btf:
345 [1]FUNC_PROTO(anon) return=0 args=(void)
346 [2] FUNCverify_cputype_id=1
347 [3]FUNC_PROTO(anon) return=0 args=(void)
348 [4] FUNCsev_verify_cbittype_id=3
349 search cu 'arch/x86/kernel/head_64.S' for percpu global variables. 350 Found per-CPU symbol 'cpu_loops_per_jiffy' at address0x18a08351 Found per-CPU symbol 'perf_nmi_tstamp' at address0x19f70352 Found per-CPU symbol 'kvm_running_vcpu' at address0x19f80353 Found per-CPU symbol 'cpu_kick_mask' at address0x19f78354 Found per-CPU symbol 'cpu_tsc_khz' at address0x19f88355 Found per-CPU symbol 'cpu_loops_per_jiffy' at address0x18a08356 Found per-CPU symbol 'cpu_loops_per_jiffy' at address0x18a08357 Found per-CPU symbol 'perf_nmi_tstamp' at address0x19f70358 Found per-CPU symbol 'perf_nmi_tstamp' at address0x19f70359 Found per-CPU symbol 'current_tsc_ratio' at address0x19fa0360 Found per-CPU symbol 'cpu_loops_per_jiffy' at address0x18a08361 Found per-CPU symbol 'cpu_loops_per_jiffy' at address0x18a08362 Found per-CPU symbol 'kvm_running_vcpu' at address0x19f80Quoted 2 lines
If the full debug files are useful or a target grep or diff is better let me know.
I managed to reproduce this too with IBT enabled; one thing I noticed is with pahole built with an up-to-date libbpf and the changes in https://github.com/acmel/dwarves/tree/next, the problem went away. I didn't have time to root-cause it yet however.
Not sure if you're in a position to do this, but if you can, would you mind building pahole from
https://github.com/acmel/dwarves/tree/next
...and re-testing to see if that helps? Thanks!
Quoted 8 lines
Quoted 3 lines
Alan
Quoted 2 lines
Thanks,
I tried with libbpf compiled from master
https://github.com/libbpf/libbpf.git and pahole compiled from next branch on
https://github.com/acmel/dwarve with the same result.
With IBT enabled pahole fails and removing it results in a successful kernel.
hi,
in case it slipped, you also need to add new options for pahole:
https://lore.kernel.org/bpf/[email protected]/
should be added for version 124 for now
jirka
Jiri,
Quoted 262 lines · Jiri Olsa
Quoted 251 lines · Alexandre Peixoto Ferreira
Alam,
Quoted 248 lines · Alan Maguire
Quoted 233 lines · Alexandre Peixoto Ferreira
Jiri,
Quoted 104 lines · Jiri Olsa
Quoted 94 lines · Alexandre Peixoto Ferreira
Jirka and Daniel,
Quoted 61 lines · Jiri Olsa
Quoted 60 lines · Alexandre Peixoto Ferreira
Quoted 59 lines · Daniel Xu
Hi Jiri,
Quoted 42 lines · Jiri Olsa
Quoted 41 lines · Daniel Xu
Hi,
I'm getting the following error during build:
$ ./tools/testing/selftests/bpf/vmtest.sh -j30 [...] BTF .btf.vmlinux.bin.o btf_encoder__encode: btf__dedup failed! Failed to encode BTF LD .tmp_vmlinux.kallsyms1 NM .tmp_vmlinux.kallsyms1.syms KSYMS .tmp_vmlinux.kallsyms1.S AS .tmp_vmlinux.kallsyms1.S LD .tmp_vmlinux.kallsyms2 NM .tmp_vmlinux.kallsyms2.syms KSYMS .tmp_vmlinux.kallsyms2.S AS .tmp_vmlinux.kallsyms2.S LD .tmp_vmlinux.kallsyms3 NM .tmp_vmlinux.kallsyms3.syms KSYMS .tmp_vmlinux.kallsyms3.S AS .tmp_vmlinux.kallsyms3.S LD vmlinux BTFIDS vmlinux FAILED: load BTF from vmlinux: No such file or directory make[1]: *** [scripts/Makefile.vmlinux:35: vmlinux] Error 255 make[1]: *** Deleting file 'vmlinux' make: *** [Makefile:1264: vmlinux] Error 2This happens on both bpf-next/master (
84150795a49) and 6.2-rc5 (2241ab53cb).I've also tried arch linux pahole 1:1.24+r29+g02d67c5-1 as well as upstream pahole on master (
02d67c5176) and upstream pahole on next (2ca56f4c6f659).Of the above 6 combinations, I think I've tried all of them (maybe missing 1 or 2).
Looks like GCC got updated recently on my machine, so perhaps it's related?
Quoted 8 lines
Quoted 3 lines
CONFIG_CC_VERSION_TEXT="gcc (GCC) 12.2.1 20230111"I'll try some debugging, but just wanted to report it first.
hi,
I can't reproduce that.. can you reproduce it outsidevmtest.sh?there will be lot of output with patch below, but could contain some more error output
Thanks for the hints. Doing a regular build outside of
vmtest.shseems to work ok. So maybe it's a difference in the build config.I'll put a little more time into debugging to see if it goes anywhere. But I'll have to get back to the regularly scheduled programming soon.
Quoted 7 lines
Quoted 2 lines
6.2-rc5 compiles correctly when
CONFIG_X86_KERNEL_IBTis commented but fails in pahole whenCONFIG_X86_KERNEL_IBTis set.could you plese attach your config and the build error? I can't reproduce that
thanks,
jirkaMy working .config is available at https://pastebin.pl/view/bef3765c
changeCONFIG_X86_KERNEL_IBTto y to get the error.The error is similar to Daniel's and is shown below:
LD .tmp_vmlinux.btf
BTF .btf.vmlinux.bin.obtf_encoder__encode:btf__dedupfailed!
Failed to encode BTFLD .tmp_vmlinux.kallsyms1 NM .tmp_vmlinux.kallsyms1.syms KSYMS .tmp_vmlinux.kallsyms1.S AS .tmp_vmlinux.kallsyms1.S LD .tmp_vmlinux.kallsyms2 NM .tmp_vmlinux.kallsyms2.syms KSYMS .tmp_vmlinux.kallsyms2.S AS .tmp_vmlinux.kallsyms2.S LD .tmp_vmlinux.kallsyms3 NM .tmp_vmlinux.kallsyms3.syms KSYMS .tmp_vmlinux.kallsyms3.S AS .tmp_vmlinux.kallsyms3.S LD vmlinux BTFIDS vmlinuxQuoted 4 lines
FAILED: load BTF from vmlinux: No such file or directory make[1]: *** [
scripts/Makefile.vmlinux:35: vmlinux] Error 255 make[1]: *** Deleting file 'vmlinux'
make: *** [Makefile:1264: vmlinux] Error 2I can't reproduce that.. I tried with gcc versions:
gcc (GCC) 13.0.1 20230117 (Red Hat 13.0.1-0) gcc (GCC) 12.2.1 20221121 (Red Hat 12.2.1-4)Quoted 8 lines
I haven't found fedora setup with 12.2.1 20230111 yet
I tried alsa with latest pahole master branch
were you guys able to get any more verbose output
that I suggested earlier?jirka
I compiled with and without IBT using the -V on pahole (LLVM_OBJCOPY=objcopy pahole -V -J --btf_gen_floats -j .tmp_vmlinux.btf) and the outfiles are a little too big (540MB). The error happens with this CONST type pointing to itself. That does not happen with the IBT option removed.
$ grep -n "CONST (anon) type_id" /tmp/with_IBT | more 346:[2] CONST (anon) type_id=2 349:[5] CONST (anon) type_id=5 351:[7] CONST (anon) type_id=7 356:[12] CONST (anon) type_id=12 363:[19] CONST (anon) type_id=19 373:[29] CONST (anon) type_id=29 375:[31] CONST (anon) type_id=31 409:[63] CONST (anon) type_id=63 444:[89] CONST (anon) type_id=0 472:[97] CONST (anon) type_id=97 616:[129] CONST (anon) type_id=129 652:[131] CONST (anon) type_id=131 1319:[234] CONST (anon) type_id=234 1372:[246] CONST (anon) type_id=246 ....$diff -ru
with_IBTwithout_IBTwithout_IBT 2023-01-31 09:46:23.456005278 -0600 renamed from with_IBT 2023-01-31 09:39:24.915912735 -0600 +39
-1@@ -340,346 +340,14800 @@ Found per-CPU symbol 'cpu_tlbstate_shared' at address 0x2c040 Found per-CPU symbol 'mce_poll_banks' at address 0x1ad20 Found 341 per-CPU variables! -Found 61470 functions! +Found 61462 functions! +File .tmp_vmlinux.btf: +[1] FUNC_PROTO (anon) return=0 args=(void) +[2] FUNC verify_cpu type_id=1 +[3] FUNC_PROTO (anon) return=0 args=(void) +[4] FUNC sev_verify_cbit type_id=3 +search cu 'arch/x86/kernel/head_64.S' for percpu global variables. +Found per-CPU symbol 'cpu_loops_per_jiffy' at address 0x18a08 +Found per-CPU symbol 'perf_nmi_tstamp' at address 0x19f70 +Found per-CPU symbol 'kvm_running_vcpu' at address 0x19f80 +Found per-CPU symbol 'cpu_kick_mask' at address 0x19f78 +Found per-CPU symbol 'cpu_tsc_khz' at address 0x19f88 +Found per-CPU symbol 'cpu_loops_per_jiffy' at address 0x18a08 +Found per-CPU symbol 'cpu_loops_per_jiffy' at address 0x18a08 +Found per-CPU symbol 'perf_nmi_tstamp' at address 0x19f70 +Found per-CPU symbol 'perf_nmi_tstamp' at address 0x19f70 +Found per-CPU symbol 'current_tsc_ratio' at address 0x19fa0 +Found per-CPU symbol 'cpu_loops_per_jiffy' at address 0x18a08 +Found per-CPU symbol 'cpu_loops_per_jiffy' at address 0x18a08 +Found per-CPU symbol 'kvm_running_vcpu' at address 0x19f80 +Found per-CPU symbol 'kvm_running_vcpu' at address 0x19f80 +Found per-CPU symbol 'cpu_kick_mask' at address 0x19f78 +Found per-CPU symbol 'cpu_kick_mask' at address 0x19f78 +Found per-CPU symbol 'perf_nmi_tstamp' at address 0x19f70 +Found per-CPU symbol 'perf_nmi_tstamp' at address 0x19f70 +Found per-CPU symbol 'cpu_loops_per_jiffy' at address 0x18a08 +Found per-CPU symbol 'perf_nmi_tstamp' at address 0x19f70 +Found per-CPU symbol 'cpu_tsc_khz' at address 0x19f88 +Found per-CPU symbol 'last_nmi_rip' at address 0x1a018 +Found per-CPU symbol 'nmi_stats' at address 0x1a030 +Found per-CPU symbol 'swallow_nmi' at address 0x1a020 +Found per-CPU symbol 'nmi_state' at address 0x1a010 +Found per-CPU symbol 'kvm_running_vcpu' at address 0x19f80 +Found per-CPU symbol 'nmi_cr2' at address 0x1a008 +Found per-CPU symbol 'kvm_running_vcpu' at address 0x19f80 +Found per-CPU symbol 'cpu_tsc_khz' at address 0x19f88 +Found per-CPU symbol 'cpu_kick_mask' at address 0x19f78 +Found per-CPU symbol 'cpu_kick_mask' at address 0x19f78 +Found per-CPU symbol 'cpu_loops_per_jiffy' at address 0x18a08And the lines 342-365 of the
with_IBTresult:342 Found 341 per-CPU variables! 343 Found 61470 functions! 344 File .tmp_vmlinux.btf: 345 [1] INT long unsigned int size=8 nr_bits=64 encoding=(none) 346 [2] CONST (anon) type_id=2 347 [3] PTR (anon) type_id=6 348 [4] INT char size=1 nr_bits=8 encoding=(none) 349 [5] CONST (anon) type_id=5 350 [6] INT unsigned int size=4 nr_bits=32 encoding=(none) 351 [7] CONST (anon) type_id=7 352 [8] TYPEDEF __s8 type_id=10 353 [9] INT signed char size=1 nr_bits=8 encoding=SIGNED 354 [10] TYPEDEF __u8 type_id=12 355 [11] INT unsigned char size=1 nr_bits=8 encoding=(none) 356 [12] CONST (anon) type_id=12 357 [13] TYPEDEF __s16 type_id=15 358 [14] INT short int size=2 nr_bits=16 encoding=SIGNED 359 [15] TYPEDEF __u16 type_id=17 360 [16] INT short unsigned int size=2 nr_bits=16 encoding=(none) 361 [17] TYPEDEF __s32 type_id=19 362 [18] INT int size=4 nr_bits=32 encoding=SIGNED 363 [19] CONST (anon) type_id=19 364 [20] TYPEDEF __u32 type_id=7 365 [21] TYPEDEF __s64 type_id=23lines 342-362 of
without_IBT342 Found 341 per-CPU variables! 343 Found 61462 functions! 344 File .tmp_vmlinux.btf: 345 [1] FUNC_PROTO (anon) return=0 args=(void) 346 [2] FUNC verify_cpu type_id=1 347 [3] FUNC_PROTO (anon) return=0 args=(void) 348 [4] FUNC sev_verify_cbit type_id=3 349 search cu 'arch/x86/kernel/head_64.S' for percpu global variables. 350 Found per-CPU symbol 'cpu_loops_per_jiffy' at address 0x18a08 351 Found per-CPU symbol 'perf_nmi_tstamp' at address 0x19f70 352 Found per-CPU symbol 'kvm_running_vcpu' at address 0x19f80 353 Found per-CPU symbol 'cpu_kick_mask' at address 0x19f78 354 Found per-CPU symbol 'cpu_tsc_khz' at address 0x19f88 355 Found per-CPU symbol 'cpu_loops_per_jiffy' at address 0x18a08 356 Found per-CPU symbol 'cpu_loops_per_jiffy' at address 0x18a08 357 Found per-CPU symbol 'perf_nmi_tstamp' at address 0x19f70 358 Found per-CPU symbol 'perf_nmi_tstamp' at address 0x19f70 359 Found per-CPU symbol 'current_tsc_ratio' at address 0x19fa0 360 Found per-CPU symbol 'cpu_loops_per_jiffy' at address 0x18a08 361 Found per-CPU symbol 'cpu_loops_per_jiffy' at address 0x18a08 362 Found per-CPU symbol 'kvm_running_vcpu' at address 0x19f80Quoted 2 lines
If the full debug files are useful or a target grep or diff is better let me know.
I managed to reproduce this too with IBT enabled; one thing I noticed is with pahole built with an up-to-date libbpf and the changes in https://github.com/acmel/dwarves/tree/next, the problem went away. I didn't have time to root-cause it yet however.
Not sure if you're in a position to do this, but if you can, would you mind building pahole from
https://github.com/acmel/dwarves/tree/next
...and re-testing to see if that helps? Thanks!
Quoted 8 lines
Quoted 3 lines
Alan
Quoted 2 lines
Thanks,
I tried with libbpf compiled from master
https://github.com/libbpf/libbpf.git and pahole compiled from next branch on
https://github.com/acmel/dwarve with the same result.
With IBT enabled pahole fails and removing it results in a successful kernel.
Quoted 7 lines
hi,
in case it slipped, you also need to add new options for pahole:
https://lore.kernel.org/bpf/[email protected]/should be added for version 124 for now
jirka
Added the patch to include options on pahole but same problem.
$ pahole --version v1.25 $ ls -l /usr/lib64/libbpf.so.1.2.0 -rwxr-xr-x 1 root root 422088 Feb 9 13:23 /usr/lib64/libbpf.so.1.2.0
UPD include/generated/utsversion.h CC init/version-timestamp.o LD .tmp_vmlinux.btf BTF .btf.vmlinux.bin.o
LLVM_OBJCOPY=objcopy pahole -J --btf_gen_floats -j --skip_encoding_btf_inconsistent_proto --btf_gen_optimized .tmp_vmlinux.btfbtf_encoder__encode: btf__dedup failed!
Failed to encode BTF
Thanks,
Hi Alex and Jiri,
Quoted 281 lines · Alexandre Ferreira
Jiri,
Quoted 260 lines · Jiri Olsa
Quoted 251 lines · Alexandre Peixoto Ferreira
Alam,
Quoted 248 lines · Alan Maguire
Quoted 233 lines · Alexandre Peixoto Ferreira
Jiri,
Quoted 104 lines · Jiri Olsa
Quoted 94 lines · Alexandre Peixoto Ferreira
Jirka and Daniel,
Quoted 61 lines · Jiri Olsa
Quoted 60 lines · Alexandre Peixoto Ferreira
Quoted 59 lines · Daniel Xu
Hi Jiri,
Quoted 42 lines · Jiri Olsa
Quoted 41 lines · Daniel Xu
Hi,
I'm getting the following error during build:
$ ./tools/testing/selftests/bpf/vmtest.sh -j30 [...] BTF .btf.vmlinux.bin.o btf_encoder__encode: btf__dedup failed! Failed to encode BTF LD .tmp_vmlinux.kallsyms1 NM .tmp_vmlinux.kallsyms1.syms KSYMS .tmp_vmlinux.kallsyms1.S AS .tmp_vmlinux.kallsyms1.S LD .tmp_vmlinux.kallsyms2 NM .tmp_vmlinux.kallsyms2.syms KSYMS .tmp_vmlinux.kallsyms2.S AS .tmp_vmlinux.kallsyms2.S LD .tmp_vmlinux.kallsyms3 NM .tmp_vmlinux.kallsyms3.syms KSYMS .tmp_vmlinux.kallsyms3.S AS .tmp_vmlinux.kallsyms3.S LD vmlinux BTFIDS vmlinux FAILED: load BTF from vmlinux: No such file or directory make[1]: *** [scripts/Makefile.vmlinux:35: vmlinux] Error 255 make[1]: *** Deleting file 'vmlinux' make: *** [Makefile:1264: vmlinux] Error 2This happens on both bpf-next/master (
84150795a49) and 6.2-rc5 (2241ab53cb).I've also tried arch linux pahole 1:1.24+r29+g02d67c5-1 as well as upstream pahole on master (
02d67c5176) and upstream pahole on next (2ca56f4c6f659).Of the above 6 combinations, I think I've tried all of them (maybe missing 1 or 2).
Looks like GCC got updated recently on my machine, so perhaps it's related?
Quoted 8 lines
Quoted 3 lines
CONFIG_CC_VERSION_TEXT="gcc (GCC) 12.2.1 20230111"I'll try some debugging, but just wanted to report it first.
hi,
I can't reproduce that.. can you reproduce it outsidevmtest.sh?there will be lot of output with patch below, but could contain some more error output
Thanks for the hints. Doing a regular build outside of
vmtest.shseems to work ok. So maybe it's a difference in the build config.I'll put a little more time into debugging to see if it goes anywhere. But I'll have to get back to the regularly scheduled programming soon.
Quoted 7 lines
Quoted 2 lines
6.2-rc5 compiles correctly when
CONFIG_X86_KERNEL_IBTis commented but fails in pahole whenCONFIG_X86_KERNEL_IBTis set.could you plese attach your config and the build error? I can't reproduce that
thanks,
jirkaMy working .config is available at https://pastebin.pl/view/bef3765c
changeCONFIG_X86_KERNEL_IBTto y to get the error.The error is similar to Daniel's and is shown below:
LD .tmp_vmlinux.btf
BTF .btf.vmlinux.bin.obtf_encoder__encode:btf__dedupfailed!
Failed to encode BTFLD .tmp_vmlinux.kallsyms1 NM .tmp_vmlinux.kallsyms1.syms KSYMS .tmp_vmlinux.kallsyms1.S AS .tmp_vmlinux.kallsyms1.S LD .tmp_vmlinux.kallsyms2 NM .tmp_vmlinux.kallsyms2.syms KSYMS .tmp_vmlinux.kallsyms2.S AS .tmp_vmlinux.kallsyms2.S LD .tmp_vmlinux.kallsyms3 NM .tmp_vmlinux.kallsyms3.syms KSYMS .tmp_vmlinux.kallsyms3.S AS .tmp_vmlinux.kallsyms3.S LD vmlinux BTFIDS vmlinuxQuoted 4 lines
FAILED: load BTF from vmlinux: No such file or directory make[1]: *** [
scripts/Makefile.vmlinux:35: vmlinux] Error 255 make[1]: *** Deleting file 'vmlinux'
make: *** [Makefile:1264: vmlinux] Error 2I can't reproduce that.. I tried with gcc versions:
gcc (GCC) 13.0.1 20230117 (Red Hat 13.0.1-0) gcc (GCC) 12.2.1 20221121 (Red Hat 12.2.1-4)Quoted 8 lines
I haven't found fedora setup with 12.2.1 20230111 yet
I tried alsa with latest pahole master branch
were you guys able to get any more verbose output
that I suggested earlier?jirka
I compiled with and without IBT using the -V on pahole (LLVM_OBJCOPY=objcopy pahole -V -J --btf_gen_floats -j .tmp_vmlinux.btf) and the outfiles are a little too big (540MB). The error happens with this CONST type pointing to itself. That does not happen with the IBT option removed.
$ grep -n "CONST (anon) type_id" /tmp/with_IBT | more 346:[2] CONST (anon) type_id=2 349:[5] CONST (anon) type_id=5 351:[7] CONST (anon) type_id=7 356:[12] CONST (anon) type_id=12 363:[19] CONST (anon) type_id=19 373:[29] CONST (anon) type_id=29 375:[31] CONST (anon) type_id=31 409:[63] CONST (anon) type_id=63 444:[89] CONST (anon) type_id=0 472:[97] CONST (anon) type_id=97 616:[129] CONST (anon) type_id=129 652:[131] CONST (anon) type_id=131 1319:[234] CONST (anon) type_id=234 1372:[246] CONST (anon) type_id=246 ....$diff -ru
with_IBTwithout_IBTwithout_IBT 2023-01-31 09:46:23.456005278 -0600 renamed from with_IBT 2023-01-31 09:39:24.915912735 -0600 +39
-1@@ -340,346 +340,14800 @@ Found per-CPU symbol 'cpu_tlbstate_shared' at address 0x2c040 Found per-CPU symbol 'mce_poll_banks' at address 0x1ad20 Found 341 per-CPU variables! -Found 61470 functions! +Found 61462 functions! +File .tmp_vmlinux.btf: +[1] FUNC_PROTO (anon) return=0 args=(void) +[2] FUNC verify_cpu type_id=1 +[3] FUNC_PROTO (anon) return=0 args=(void) +[4] FUNC sev_verify_cbit type_id=3 +search cu 'arch/x86/kernel/head_64.S' for percpu global variables. +Found per-CPU symbol 'cpu_loops_per_jiffy' at address 0x18a08 +Found per-CPU symbol 'perf_nmi_tstamp' at address 0x19f70 +Found per-CPU symbol 'kvm_running_vcpu' at address 0x19f80 +Found per-CPU symbol 'cpu_kick_mask' at address 0x19f78 +Found per-CPU symbol 'cpu_tsc_khz' at address 0x19f88 +Found per-CPU symbol 'cpu_loops_per_jiffy' at address 0x18a08 +Found per-CPU symbol 'cpu_loops_per_jiffy' at address 0x18a08 +Found per-CPU symbol 'perf_nmi_tstamp' at address 0x19f70 +Found per-CPU symbol 'perf_nmi_tstamp' at address 0x19f70 +Found per-CPU symbol 'current_tsc_ratio' at address 0x19fa0 +Found per-CPU symbol 'cpu_loops_per_jiffy' at address 0x18a08 +Found per-CPU symbol 'cpu_loops_per_jiffy' at address 0x18a08 +Found per-CPU symbol 'kvm_running_vcpu' at address 0x19f80 +Found per-CPU symbol 'kvm_running_vcpu' at address 0x19f80 +Found per-CPU symbol 'cpu_kick_mask' at address 0x19f78 +Found per-CPU symbol 'cpu_kick_mask' at address 0x19f78 +Found per-CPU symbol 'perf_nmi_tstamp' at address 0x19f70 +Found per-CPU symbol 'perf_nmi_tstamp' at address 0x19f70 +Found per-CPU symbol 'cpu_loops_per_jiffy' at address 0x18a08 +Found per-CPU symbol 'perf_nmi_tstamp' at address 0x19f70 +Found per-CPU symbol 'cpu_tsc_khz' at address 0x19f88 +Found per-CPU symbol 'last_nmi_rip' at address 0x1a018 +Found per-CPU symbol 'nmi_stats' at address 0x1a030 +Found per-CPU symbol 'swallow_nmi' at address 0x1a020 +Found per-CPU symbol 'nmi_state' at address 0x1a010 +Found per-CPU symbol 'kvm_running_vcpu' at address 0x19f80 +Found per-CPU symbol 'nmi_cr2' at address 0x1a008 +Found per-CPU symbol 'kvm_running_vcpu' at address 0x19f80 +Found per-CPU symbol 'cpu_tsc_khz' at address 0x19f88 +Found per-CPU symbol 'cpu_kick_mask' at address 0x19f78 +Found per-CPU symbol 'cpu_kick_mask' at address 0x19f78 +Found per-CPU symbol 'cpu_loops_per_jiffy' at address 0x18a08And the lines 342-365 of the
with_IBTresult:342 Found 341 per-CPU variables! 343 Found 61470 functions! 344 File .tmp_vmlinux.btf: 345 [1] INT long unsigned int size=8 nr_bits=64 encoding=(none) 346 [2] CONST (anon) type_id=2 347 [3] PTR (anon) type_id=6 348 [4] INT char size=1 nr_bits=8 encoding=(none) 349 [5] CONST (anon) type_id=5 350 [6] INT unsigned int size=4 nr_bits=32 encoding=(none) 351 [7] CONST (anon) type_id=7 352 [8] TYPEDEF __s8 type_id=10 353 [9] INT signed char size=1 nr_bits=8 encoding=SIGNED 354 [10] TYPEDEF __u8 type_id=12 355 [11] INT unsigned char size=1 nr_bits=8 encoding=(none) 356 [12] CONST (anon) type_id=12 357 [13] TYPEDEF __s16 type_id=15 358 [14] INT short int size=2 nr_bits=16 encoding=SIGNED 359 [15] TYPEDEF __u16 type_id=17 360 [16] INT short unsigned int size=2 nr_bits=16 encoding=(none) 361 [17] TYPEDEF __s32 type_id=19 362 [18] INT int size=4 nr_bits=32 encoding=SIGNED 363 [19] CONST (anon) type_id=19 364 [20] TYPEDEF __u32 type_id=7 365 [21] TYPEDEF __s64 type_id=23lines 342-362 of
without_IBT342 Found 341 per-CPU variables! 343 Found 61462 functions! 344 File .tmp_vmlinux.btf: 345 [1] FUNC_PROTO (anon) return=0 args=(void) 346 [2] FUNC verify_cpu type_id=1 347 [3] FUNC_PROTO (anon) return=0 args=(void) 348 [4] FUNC sev_verify_cbit type_id=3 349 search cu 'arch/x86/kernel/head_64.S' for percpu global variables. 350 Found per-CPU symbol 'cpu_loops_per_jiffy' at address 0x18a08 351 Found per-CPU symbol 'perf_nmi_tstamp' at address 0x19f70 352 Found per-CPU symbol 'kvm_running_vcpu' at address 0x19f80 353 Found per-CPU symbol 'cpu_kick_mask' at address 0x19f78 354 Found per-CPU symbol 'cpu_tsc_khz' at address 0x19f88 355 Found per-CPU symbol 'cpu_loops_per_jiffy' at address 0x18a08 356 Found per-CPU symbol 'cpu_loops_per_jiffy' at address 0x18a08 357 Found per-CPU symbol 'perf_nmi_tstamp' at address 0x19f70 358 Found per-CPU symbol 'perf_nmi_tstamp' at address 0x19f70 359 Found per-CPU symbol 'current_tsc_ratio' at address 0x19fa0 360 Found per-CPU symbol 'cpu_loops_per_jiffy' at address 0x18a08 361 Found per-CPU symbol 'cpu_loops_per_jiffy' at address 0x18a08 362 Found per-CPU symbol 'kvm_running_vcpu' at address 0x19f80Quoted 2 lines
If the full debug files are useful or a target grep or diff is better let me know.
I managed to reproduce this too with IBT enabled; one thing I noticed is with pahole built with an up-to-date libbpf and the changes in https://github.com/acmel/dwarves/tree/next, the problem went away. I didn't have time to root-cause it yet however.
Not sure if you're in a position to do this, but if you can, would you mind building pahole from
https://github.com/acmel/dwarves/tree/next
...and re-testing to see if that helps? Thanks!
Quoted 8 lines
Quoted 3 lines
Alan
Quoted 2 lines
Thanks,
I tried with libbpf compiled from master
https://github.com/libbpf/libbpf.git and pahole compiled from next branch on
https://github.com/acmel/dwarve with the same result.
With IBT enabled pahole fails and removing it results in a successful kernel.Quoted 7 lines
hi,
in case it slipped, you also need to add new options for pahole:https://lore.kernel.org/bpf/[email protected]/should be added for version 124 for now
jirka
Added the patch to include options on pahole but same problem.
$ pahole --version v1.25 $ ls -l /usr/lib64/libbpf.so.1.2.0 -rwxr-xr-x 1 root root 422088 Feb 9 13:23 /usr/lib64/libbpf.so.1.2.0UPD include/generated/utsversion.h CC init/version-timestamp.o LD .tmp_vmlinux.btf BTF .btf.vmlinux.bin.o
Quoted 8 lines
LLVM_OBJCOPY=objcopy pahole -J --btf_gen_floats -j --skip_encoding_btf_inconsistent_proto --btf_gen_optimized .tmp_vmlinux.btf
btf_encoder__encode:btf__dedupfailed!
Failed to encode BTFThanks,
I encountered the same problem when building a new kernel and I found some reasons for the error.
In short, enabling CONFIG_X86_KERNEL_IBT will change the order of records in .notes section. In addition, due to historical problems, the alignment of records in the .notes section is not unified, which leads to the inability of gelf_getnote() to read the records after the wrong one.
For example:
$readelf -n linux-6.2-rc7-with-IBT/.tmp_vmlinux.btf Displaying notes found in: .notes
Owner Data size Description
GNU 0x00000020 NT_GNU_PROPERTY_TYPE_0
Properties: x86 feature used: x86, x87, MMX, XMM, FXSR, XSAVE
x86 ISA used: x86-64-baseline, x86-64-v2, x86-64-v3
Linux 0x00000004 func
description data: 06 00 00 00
readelf: Warning: note with invalid namesz and/or descsz found at offset 0x50
readelf: Warning: type: 0x78, namesize: 0x100, descsize: 0x756e694c, alignment: 8
$readelf -n linux-6.2-rc7-no-IBT/.tmp_vmlinux.btf Displaying notes found in: .notes
Owner Data size Description
GNU 0x00000020 NT_GNU_PROPERTY_TYPE_0
Properties: x86 feature used: x86, x87, MMX, XMM, FXSR, XSAVE
x86 ISA used: x86-64-baseline, x86-64-v2, x86-64-v3
GNU 0x00000014 NT_GNU_BUILD_ID (unique build ID bitstring)
Build ID: 073b8e5b0373cdc806fac20a9559461be75570a8
readelf: Warning: note with invalid namesz and/or descsz found at offset 0x58
readelf: Warning: type: 0x756e694c, namesize: 0x4, descsize: 0x101, alignment: 8
As shown above, whether IBT is enabled or not, readelf can't read all records in the .notes section. And gelf_getnote() has the same behaviour.
In dwarf_loader.c:3001, cus__merging_cu() determines whether cu(compile unit) should be merged by detecting the value of LINUX_ELFNOTE_LTO_INFO. It is from
https://github.com/torvalds/linux/blob/master/include/linux/elfnote-lto.h#L9,
and its value must be 0 or 1. But in the above output from readelf, it reads "06 00 00 00"(=6), which is impossible. This confirms that the .notes record has format compatibility problems. There's also something similar at
https://lore.kernel.org/linux-arm-kernel/[email protected]/
dwarf_loader.c:3001 uses "!= 0" for judgement. So with IBT=y, gelf_getnote() reads "0x6" and return "true"; while gelf_getnote() crushed before reading the LINUX_ELFNOTE_LTO_INFO with IBT=n, and returns the right result("false") coincidently. Since the kernel is not built with CONFIG_LTO, merging compile units will lead to undefined behaviors.
Specifically, there are tags such as DW_TAG_unspecified_type in the origin cus, but were filtered out in BTF encders. This causes the small_id(dwarf reader assigned) is malposed with the offset(which btf encoder uses), and finally leads to the "btf__dedup failed!" error.
There's an simple fix for pahole. To some extent, this prevents cus__merging_cu() from being disturbed by alignment errors, but the fundamental solution is to fix the alignment problem of .notes section.
--- dwarf_loader.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
dwarf_loader.c +1 -1
@@ -2998,7 +2998,7 @@ static bool cus__merging_cu(Dwarf *dw, Elf *elf)if (strcmp ((char *)data->d_buf + name_off,"Linux" ) !=0 )continue ; -return *(int *)(data->d_buf + desc_off) !=0 ; +return *(int *)(data->d_buf + desc_off) ==1 ; } } }
Signature · 1 line
2.39.1
PATCH 1/1 vmlinux.lds.h: Force-align ELF notes section to four bytes
Quoted 9 lines · Tianyi Liu
Quoted 8 lines
LLVM_OBJCOPY=objcopy pahole -J --btf_gen_floats -j --skip_encoding_btf_inconsistent_proto --btf_gen_optimized .tmp_vmlinux.btf
btf_encoder__encode:btf__dedupfailed!
Failed to encode BTFThanks,
Quoted 7 lines
I encountered the same problem when building a new kernel and I found some reasons for the error.
In short, enabling
CONFIG_X86_KERNEL_IBTwill change the order of records in .notes section. In addition, due to historical problems, the alignment of records in the .notes section is not unified, which leads to the inability ofgelf_getnote()to read the records after the wrong one.
Alexandre, Tianyi, are you still seeing this issue with the latest dwarves? If so can you confirm the below patch fixes it?
Apparently the latest dwarves release fixes it on Fedora Rawhide [1], does anybody know if there a specific dwarves and/or libbpf change for this?
[1] https://gitlab.com/cki-project/kernel-ark/-/merge_requests/2346#note_1348057786
---8<---
From: Josh Poimboeuf <[email protected]>
Subject: [PATCH] vmlinux.lds.h: Force-align ELF notes section to four bytes
When tooling reads ELF notes, it assumes each note entry is aligned to the value listed in the .note section header's sh_addralign field.
The kernel-created ELF notes in the .note.Linux and .note.Xen sections are aligned to 4 bytes. This causes the toolchain to set those sections' sh_addralign values to 4.
On the other hand, the GCC-created .note.gnu.property section has an sh_addralign value of 8 for some reason, despite being based on struct Elf32_Nhdr which only needs 4-byte alignment.
When the mismatched input sections get linked together into the vmlinux .notes output section, the higher alignment "wins", resulting in an sh_addralign of 8, which confuses tooling. For example:
$ readelf -n .tmp_vmlinux.btf ... readelf: .tmp_vmlinux.btf: Warning: note with invalid namesz and/or descsz found at offset 0x170 readelf: .tmp_vmlinux.btf: Warning: type: 0x4, namesize: 0x006e6558, descsize: 0x00008801, alignment: 8
In this case readelf thinks there's alignment padding where there is none, so it starts reading an ELF note in the middle.
With newer toolchains (e.g., latest Fedora Rawhide), a similar mismatch triggers a build failure when combined with CONFIG_X86_KERNEL_IBT:
btf_encoder__encode: btf__dedup failed!
Failed to encode BTF
libbpf: failed to find '.BTF' ELF section in vmlinux
FAILED: load BTF from vmlinux: No data available make[1]: *** [scripts/Makefile.vmlinux:35: vmlinux] Error 255
Fix it by forcing the .notes section input and output alignments to 4 to match the kernel's note entry alignments.
Note this doesn't break the 8-byte-aligned .note.gnu.property entries because their internal data representations fill the entire 8-byte alignment boundary, so there's no padding between entries to be misinterpreted. And there's only a single entry in that section anyway.
--- include/asm-generic/vmlinux.lds.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/asm-generic/vmlinux.lds.h +1 -1
@@ -894,7 +894,7 @@*/ #define NOTES \ /DISCARD/ : { *(.note.GNU-stack) } \ - .notes : AT(ADDR(.notes) - LOAD_OFFSET) { \ + .notes ALIGN(4) : AT(ADDR(.notes) - LOAD_OFFSET) SUBALIGN(4) { \ BOUNDED_SECTION_BY(.note.*, _notes) \ } NOTES_HEADERS \ NOTES_HEADERS_RESTORE
Signature · 1 line
2.39.2
Re: [PATCH] vmlinux.lds.h: Force-align ELF notes section to four bytes
Quoted 13 lines · Josh Poimboeuf
Quoted 12 lines · Tianyi Liu
Quoted 8 lines
LLVM_OBJCOPY=objcopy pahole -J --btf_gen_floats -j --skip_encoding_btf_inconsistent_proto --btf_gen_optimized .tmp_vmlinux.btf
btf_encoder__encode:btf__dedupfailed!
Failed to encode BTFThanks,
I encountered the same problem when building a new kernel and I found some reasons for the error.
Quoted 8 lines
Quoted 4 lines
In short, enabling
CONFIG_X86_KERNEL_IBTwill change the order of records in .notes section. In addition, due to historical problems, the alignment of records in the .notes section is not unified, which leads to the inability ofgelf_getnote()to read the records after the wrong one.Alexandre, Tianyi, are you still seeing this issue with the latest dwarves? If so can you confirm the below patch fixes it?
Josh, first of all, thank you very much for your help. However, this patch doesn't work in my environment. I am using gcc 12.2.1 20230201. After compiling, when I use readelf -S to view ELF sections, the align of .notes section is still 8:
$ readelf -S .tmp_vmlinux.btf
[20] .notes NOTE ffffffff8250b570 0170b570
0000000000000084 0000000000000000 A 0 0 8Quoted 4 lines
Apparently the latest dwarves release fixes it on Fedora Rawhide [1], does anybody know if there a specific dwarves and/or libbpf change for this?
It has been fixed in dwarves[1], but it may just be a coincidence.
Quoted 68 lines
[1] https://gitlab.com/cki-project/kernel-ark/-/merge_requests/2346#note_1348057786
---8<---
From: Josh Poimboeuf <[email protected]>
Subject: [PATCH]vmlinux.lds.h: Force-align ELF notes section to four bytesWhen tooling reads ELF notes, it assumes each note entry is aligned to the value listed in the .note section header's
sh_addralignfield.The kernel-created ELF notes in the .note.Linux and .note.Xen sections are aligned to 4 bytes. This causes the toolchain to set those sections'
sh_addralignvalues to 4.On the other hand, the GCC-created .note.gnu.property section has an
sh_addralignvalue of 8 for some reason, despite being based on structElf32_Nhdrwhich only needs 4-byte alignment.When the mismatched input sections get linked together into the vmlinux .notes output section, the higher alignment "wins", resulting in an
sh_addralignof 8, which confuses tooling. For example:$ readelf -n .tmp_vmlinux.btf ... readelf: .tmp_vmlinux.btf: Warning: note with invalid namesz and/or descsz found at offset 0x170 readelf: .tmp_vmlinux.btf: Warning: type: 0x4, namesize: 0x006e6558, descsize: 0x00008801, alignment: 8In this case readelf thinks there's alignment padding where there is none, so it starts reading an ELF note in the middle.
With newer toolchains (e.g., latest Fedora Rawhide), a similar mismatch triggers a build failure when combined with
CONFIG_X86_KERNEL_IBT:
btf_encoder__encode:btf__dedupfailed!
Failed to encode BTF
libbpf: failed to find '.BTF' ELF section in vmlinux
FAILED: load BTF from vmlinux: No data available make[1]: *** [scripts/Makefile.vmlinux:35: vmlinux] Error 255Fix it by forcing the .notes section input and output alignments to 4 to match the kernel's note entry alignments.
Note this doesn't break the 8-byte-aligned .note.gnu.property entries because their internal data representations fill the entire 8-byte alignment boundary, so there's no padding between entries to be misinterpreted. And there's only a single entry in that section anyway.
Reported-by Daniel Xu <[email protected]>Debugged-by Tianyi Liu <[email protected]>Signed-off-by Josh Poimboeuf <[email protected]>--- include/asm-generic/vmlinux.lds.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)include/asm-generic/vmlinux.lds.h +1
-2@@ -894,7 +894,7 @@*/ #define NOTES \ /DISCARD/ : { *(.note.GNU-stack) } \ - .notes : AT(ADDR(.notes) - LOAD_OFFSET) { \ + .notes ALIGN(4) : AT(ADDR(.notes) - LOAD_OFFSET) SUBALIGN(4) { \ BOUNDED_SECTION_BY(.note.*, _notes) \ } NOTES_HEADERS \ NOTES_HEADERS_RESTORE --
Quoted 1 line
2.39.2
[1] https://github.com/acmel/dwarves/commit/a9498899109d3be14f17abbc322a8f55a1067bee
Re: [PATCH] vmlinux.lds.h: Force-align ELF notes section to four bytes
Quoted 23 lines · Tianyi Liu
Quoted 13 lines · Josh Poimboeuf
Quoted 12 lines · Tianyi Liu
Quoted 8 lines
LLVM_OBJCOPY=objcopy pahole -J --btf_gen_floats -j --skip_encoding_btf_inconsistent_proto --btf_gen_optimized .tmp_vmlinux.btf
btf_encoder__encode:btf__dedupfailed!
Failed to encode BTFThanks,
I encountered the same problem when building a new kernel and I found some reasons for the error.
Quoted 8 lines
Quoted 4 lines
In short, enabling
CONFIG_X86_KERNEL_IBTwill change the order of records in .notes section. In addition, due to historical problems, the alignment of records in the .notes section is not unified, which leads to the inability ofgelf_getnote()to read the records after the wrong one.Alexandre, Tianyi, are you still seeing this issue with the latest dwarves? If so can you confirm the below patch fixes it?
Quoted 8 lines
Josh, first of all, thank you very much for your help. However, this patch doesn't work in my environment. I am using gcc 12.2.1 20230201. After compiling, when I use readelf -S to view ELF sections, the align of .notes section is still 8:
$ readelf -S .tmp_vmlinux.btf [20] .notes NOTE ffffffff8250b570 0170b570 0000000000000084 0000000000000000 A 0 0 8
Hm, weird.
Quoted 6 lines
Quoted 4 lines
Apparently the latest dwarves release fixes it on Fedora Rawhide [1], does anybody know if there a specific dwarves and/or libbpf change for this?
It has been fixed in dwarves[1], but it may just be a coincidence.
So just to confirm, the btf__dedup error is gone for you with the latest dwarves?
Signature · 1 line
Josh
Re: [PATCH] vmlinux.lds.h: Force-align ELF notes section to four bytes
I have done some tests with Arch Linux which is also affected by this issue:
Base scenario: Running Arch Linux updated as of 2023-04-13.
Building the linux-mainline 6.3rc6-1 from AUR
(https://aur.archlinux.org/packages/linux-mainline)
with CONFIG_X86_KERNEL_IBT changed to 'y'
Result: Build fails with the "btf__dedup failed!" error
Test 1: Update dwarves (=pahole package on Arch Linux) from the current version
(1:1.24+r29+g02d67c5-1) to the staging version (1:1.25-1).
Result: The build works correctly.
However, the notes section is still not parsed correctly, as confirmed by readelf -n or adding a printf near the code on cus__merging_cu (on dwarf_loader.c) pointed to by Tianyi.
A bisect shows the commit that fixes the build is a9498899109d3be14f17abbc322a8f55a1067bee
"dwarf_loader: Fix for BTF id drift caused by adding unspecified types" I don't know why though.
Test 2: Applying Josh's patch to force-align the ELF notes section to 4 bytes
(clarification: using the base pahole version again here)
Result: The build works correctly.
I can read the notes correctly using readelf -n as well, and they are aligned to 4 bytes instead of 8.
Test 3: Similar to Josh's patch, but instead of force-aligning the sections,
I added .note.gnu.property to the /DISCARD/ list in the line above.
Result: The build works correctly.
I can read the notes correctly using readelf -n as well (of course, the GNU notes which made the alignment be 8 bytes are gone;
I don't know if this has any negative effect).
So, in summary, either upgrading dwarves/pahole from 1.24 to (not yet fully released?) 1.25, or applying Josh's patch fixes the issue for me. Despite the new dwarves/pahole version fixing the build, Josh's patch or something else to fix the notes alignment is needed.
Re: [PATCH] vmlinux.lds.h: Force-align ELF notes section to four bytes
Quoted 7 lines · Joan Bruguera Micó
I have done some tests with Arch Linux which is also affected by this issue:
Base scenario: Running Arch Linux updated as of 2023-04-13.
Building the linux-mainline 6.3rc6-1 from AUR
(https://aur.archlinux.org/packages/linux-mainline)
withCONFIG_X86_KERNEL_IBTchanged to 'y'
Result: Build fails with the "btf__dedupfailed!" error
I use MANJARO with kernel version 6.2.10-1. We should be using the same kernel.
Quoted 4 lines
Test 1: Update dwarves (=pahole package on Arch Linux) from the current version
(1:1.24+r29+g02d67c5-1) to the staging version (1:1.25-1).Result: The build works correctly.
Quoted 8 lines
However, the notes section is still not parsed correctly, as confirmed by
readelf -nor adding a printf near the code oncus__merging_cu(ondwarf_loader.c) pointed to by Tianyi.A bisect shows the commit that fixes the build is
a9498899109d3be14f17abbc322a8f55a1067bee
"dwarf_loader: Fix for BTF id drift caused by adding unspecified types" I don't know why though.
Pahole reads .notes to look for LINUX_ELFNOTE_BUILD_LTO. When LTO is enabled, pahole needs to call cus__merge_and_process_cu to merge compile units, at which point there should only be one unspecified type (used to represent some compilation information) in the global context.
However, when the kernel is compiled without LTO, if pahole calls cus__merge_and_process_cu due to alignment issues with notes, multiple unspecified types may appear after merging the cus, and older versions of pahole only support up to one. This is why pahole 1.24 crashes, while newer versions support multiple. However, the latest version of pahole still does not solve the problem of incorrect LTO recognition, so compiling the kernel may be slower than normal.
If the only objective is to fix the bug of incorrect LTO recognition, perhaps this naive patch[1] could be sufficient.
Quoted 5 lines
Test 2: Applying Josh's patch to force-align the ELF notes section to 4 bytes
(clarification: using the base pahole version again here)
Result: The build works correctly.
I can read the notes correctly usingreadelf -nas well, and they are aligned to 4 bytes instead of 8.
I'm still currently unable to reproduce this fix, but it may just be an issue with my environment.
Quoted 6 lines
Test 3: Similar to Josh's patch, but instead of force-aligning the sections,
I added.note.gnu.propertyto the/DISCARD/list in the line above.
Result: The build works correctly.
I can read the notes correctly usingreadelf -nas well (of course, the GNU notes which made the alignment be 8 bytes are gone;
I don't know if this has any negative effect).
I think discarding .note.gnu.property will not have side effects. For some reason, this note does not exist in my final vmlinux. I also did not find any usage of this property in the later steps of compiling the kernel.
Quoted 4 lines
So, in summary, either upgrading dwarves/pahole from 1.24 to (not yet fully released?) 1.25, or applying Josh's patch fixes the issue for me. Despite the new dwarves/pahole version fixing the build, Josh's patch or something else to fix the notes alignment is needed.
PATCH 1/1 vmlinux.lds.h: Discard .note.gnu.property section
Quoted 18 lines · Tianyi Liu
Quoted 4 lines
Test 1: Update dwarves (=pahole package on Arch Linux) from the current version
(1:1.24+r29+g02d67c5-1) to the staging version (1:1.25-1).Result: The build works correctly.
Quoted 8 lines
However, the notes section is still not parsed correctly, as confirmed by
readelf -nor adding a printf near the code oncus__merging_cu(ondwarf_loader.c) pointed to by Tianyi.A bisect shows the commit that fixes the build is
a9498899109d3be14f17abbc322a8f55a1067bee
"dwarf_loader: Fix for BTF id drift caused by adding unspecified types" I don't know why though.Pahole reads .notes to look for
LINUX_ELFNOTE_BUILD_LTO. When LTO is enabled, pahole needs to callcus__merge_and_process_cuto merge compile units, at which point there should only be one unspecified type (used to represent some compilation information) in the global context.
Quoted 7 lines
However, when the kernel is compiled without LTO, if pahole calls
cus__merge_and_process_cudue to alignment issues with notes, multiple unspecified types may appear after merging the cus, and older versions of pahole only support up to one. This is why pahole 1.24 crashes, while newer versions support multiple. However, the latest version of pahole still does not solve the problem of incorrect LTO recognition, so compiling the kernel may be slower than normal.
Thanks for the explanation. So pahole is still mis-reading the LTO note, it just doesn't crash now.
Quoted 4 lines
If the only objective is to fix the bug of incorrect LTO recognition, perhaps this naive patch[1] could be sufficient.
I think we still need to fix the underlying issue (corrupt .notes section).
Quoted 16 lines
Quoted 5 lines
Test 2: Applying Josh's patch to force-align the ELF notes section to 4 bytes
(clarification: using the base pahole version again here)
Result: The build works correctly.
I can read the notes correctly usingreadelf -nas well, and they are aligned to 4 bytes instead of 8.I'm still currently unable to reproduce this fix, but it may just be an issue with my environment.
Quoted 6 lines
Test 3: Similar to Josh's patch, but instead of force-aligning the sections,
I added.note.gnu.propertyto the/DISCARD/list in the line above.
Result: The build works correctly.
I can read the notes correctly usingreadelf -nas well (of course, the GNU notes which made the alignment be 8 bytes are gone;
I don't know if this has any negative effect).
Quoted 3 lines
I think discarding .note.gnu.property will not have side effects. For some reason, this note does not exist in my final vmlinux. I also did not find any usage of this property in the later steps of compiling the kernel.
It looks like CONFIG_DEBUG_INFO_BTF is already (inadvertently) stripping it from vmlinux due to how GNU properties are merged by the linker (see "How GNU properties are merged" in the ld man page).
The btf data is extracted from vmlinux.o with "objcopy --only-section=.BTF" into .btf.vmlinux.bin.o. That file doesn't have .note.gnu.property, so when it gets modified and linked back into the main object, the linker strips it.
GNU properties are important for user space but they don't seem to have a purpose for vmlinux. So yeah, let's just discard .note.gnu.property.
---8<---
From: Josh Poimboeuf <[email protected]>
Subject: [PATCH] vmlinux.lds.h: Discard .note.gnu.property section
When tooling reads ELF notes, it assumes each note entry is aligned to the value listed in the .note section header's sh_addralign field.
The kernel-created ELF notes in the .note.Linux and .note.Xen sections are aligned to 4 bytes. This causes the toolchain to set those sections' sh_addralign values to 4.
On the other hand, the GCC-created .note.gnu.property section has an sh_addralign value of 8 for some reason, despite being based on struct Elf32_Nhdr which only needs 4-byte alignment.
When the mismatched input sections get linked together into the vmlinux .notes output section, the higher alignment "wins", resulting in an sh_addralign of 8, which confuses tooling. For example:
$ readelf -n .tmp_vmlinux.btf ... readelf: .tmp_vmlinux.btf: Warning: note with invalid namesz and/or descsz found at offset 0x170 readelf: .tmp_vmlinux.btf: Warning: type: 0x4, namesize: 0x006e6558, descsize: 0x00008801, alignment: 8
In this case readelf thinks there's alignment padding where there is none, so it starts reading an ELF note in the middle.
With newer toolchains (e.g., latest Fedora Rawhide), a similar mismatch triggers a build failure when combined with CONFIG_X86_KERNEL_IBT:
btf_encoder__encode: btf__dedup failed!
Failed to encode BTF
libbpf: failed to find '.BTF' ELF section in vmlinux
FAILED: load BTF from vmlinux: No data available make[1]: *** [scripts/Makefile.vmlinux:35: vmlinux] Error 255
This latter error was caused by pahole crashing when it encountered the corrupt .notes section. This crash has been fixed in dwarves version 1.25. As Tianyi Liu describes:
"Pahole reads .notes to look for LINUX_ELFNOTE_BUILD_LTO. When LTO is
enabled, pahole needs to call cus__merge_and_process_cu to merge compile units, at which point there should only be one unspecified type (used to represent some compilation information) in the global context.
However, when the kernel is compiled without LTO, if pahole calls cus__merge_and_process_cu due to alignment issues with notes, multiple unspecified types may appear after merging the cus, and older versions of pahole only support up to one. This is why pahole 1.24 crashes, while newer versions support multiple. However, the latest version of pahole still does not solve the problem of incorrect LTO recognition, so compiling the kernel may be slower than normal."
Even with the newer pahole, the note section misaligment issue still exists and pahole is misinterpreting the LTO note. Fix it by discarding the .note.gnu.property section. While GNU properties are important for user space (and VDSO), they don't seem to have any use for vmlinux.
(In fact, they're already getting (inadvertently) stripped from vmlinux when CONFIG_DEBUG_INFO_BTF is enabled. The BTF data is extracted from vmlinux.o with "objcopy --only-section=.BTF" into .btf.vmlinux.bin.o. That file doesn't have .note.gnu.property, so when it gets modified and linked back into the main object, the linker automatically strips it (see "How GNU properties are merged" in the ld man page).)
--- include/asm-generic/vmlinux.lds.h | 1 + 1 file changed, 1 insertion(+)
include/asm-generic/vmlinux.lds.h +1 -0
@@ -894,6 +894,7 @@*/ #define NOTES \ /DISCARD/ : { *(.note.GNU-stack) } \ + /DISCARD/ : { *(.note.gnu.property) } \ .notes : AT(ADDR(.notes) - LOAD_OFFSET) { \ BOUNDED_SECTION_BY(.note.*, _notes) \ } NOTES_HEADERS \
Signature · 1 line
2.39.2
PATCH 1/1 vmlinux.lds.h: Discard .note.gnu.property section
Two small nitpicks:
Quoted 1 line
This link is "semi-broken", it should go to /bpf/ instead of /lkml/.
include/asm-generic/vmlinux.lds.h line 897
Quoted 2 lines
include/asm-generic/vmlinux.lds.h +1
-0/DISCARD/ : { *(.note.GNU-stack) } \ + /DISCARD/ : { *(.note.gnu.property) } \
Both discards can go in the same DISCARD block.
(just style; it's how it's most often done in other linker scripts)
Re: [PATCH] vmlinux.lds.h: Discard .note.gnu.property section
Quoted 11 lines · Joan Bruguera Micó
Two small nitpicks:
Quoted 1 line
This link is "semi-broken", it should go to /bpf/ instead of /lkml/.
include/asm-generic/vmlinux.lds.h line 897
Quoted 2 lines
include/asm-generic/vmlinux.lds.h +1
-0/DISCARD/ : { *(.note.GNU-stack) } \ + /DISCARD/ : { *(.note.gnu.property) } \Both discards can go in the same DISCARD block.
(just style; it's how it's most often done in other linker scripts)
Thanks. I also noticed the comment above the change needs an update. Posting v2 shortly.
Signature · 1 line
Josh
PATCH v2 1/1 vmlinux.lds.h: Discard .note.gnu.property section
When tooling reads ELF notes, it assumes each note entry is aligned to the value listed in the .note section header's sh_addralign field.
The kernel-created ELF notes in the .note.Linux and .note.Xen sections are aligned to 4 bytes. This causes the toolchain to set those sections' sh_addralign values to 4.
On the other hand, the GCC-created .note.gnu.property section has an sh_addralign value of 8 for some reason, despite being based on struct Elf32_Nhdr which only needs 4-byte alignment.
When the mismatched input sections get linked together into the vmlinux .notes output section, the higher alignment "wins", resulting in an sh_addralign of 8, which confuses tooling. For example:
$ readelf -n .tmp_vmlinux.btf ... readelf: .tmp_vmlinux.btf: Warning: note with invalid namesz and/or descsz found at offset 0x170 readelf: .tmp_vmlinux.btf: Warning: type: 0x4, namesize: 0x006e6558, descsize: 0x00008801, alignment: 8
In this case readelf thinks there's alignment padding where there is none, so it starts reading an ELF note in the middle.
With newer toolchains (e.g., latest Fedora Rawhide), a similar mismatch triggers a build failure when combined with CONFIG_X86_KERNEL_IBT:
btf_encoder__encode: btf__dedup failed!
Failed to encode BTF
libbpf: failed to find '.BTF' ELF section in vmlinux
FAILED: load BTF from vmlinux: No data available make[1]: *** [scripts/Makefile.vmlinux:35: vmlinux] Error 255
This latter error was caused by pahole crashing when it encountered the corrupt .notes section. This crash has been fixed in dwarves version 1.25. As Tianyi Liu describes:
"Pahole reads .notes to look for LINUX_ELFNOTE_BUILD_LTO. When LTO is
enabled, pahole needs to call cus__merge_and_process_cu to merge compile units, at which point there should only be one unspecified type (used to represent some compilation information) in the global context.
However, when the kernel is compiled without LTO, if pahole calls cus__merge_and_process_cu due to alignment issues with notes, multiple unspecified types may appear after merging the cus, and older versions of pahole only support up to one. This is why pahole 1.24 crashes, while newer versions support multiple. However, the latest version of pahole still does not solve the problem of incorrect LTO recognition, so compiling the kernel may be slower than normal."
Even with the newer pahole, the note section misaligment issue still exists and pahole is misinterpreting the LTO note. Fix it by discarding the .note.gnu.property section. While GNU properties are important for user space (and VDSO), they don't seem to have any use for vmlinux.
(In fact, they're already getting (inadvertently) stripped from vmlinux when CONFIG_DEBUG_INFO_BTF is enabled. The BTF data is extracted from vmlinux.o with "objcopy --only-section=.BTF" into .btf.vmlinux.bin.o. That file doesn't have .note.gnu.property, so when it gets modified and linked back into the main object, the linker automatically strips it (see "How GNU properties are merged" in the ld man page).)
---
v2:
- fixed link
- combined discards
- updated comment
include/asm-generic/vmlinux.lds.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
include/asm-generic/vmlinux.lds.h +8 -1
@@ -891,9 +891,16 @@/* * Discard .note.GNU-stack, which is emitted as PROGBITS by the compiler. * Otherwise, the type of .notes section would become PROGBITS instead of NOTES. +* +* Also, discard .note.gnu.property, otherwise it forces the notes section to +* be 8-byte aligned which causes alignment mismatches with the kernel's custom +* 4-byte aligned notes. */ #define NOTES \ - /DISCARD/ : { *(.note.GNU-stack) } \ + /DISCARD/ : { \ + *(.note.GNU-stack) \ + *(.note.gnu.property) \ + } \ .notes : AT(ADDR(.notes) - LOAD_OFFSET) { \ BOUNDED_SECTION_BY(.note.*, _notes) \ } NOTES_HEADERS \
Signature · 1 line
2.39.2
Re: [PATCH] vmlinux.lds.h: Force-align ELF notes section to four bytes
In reply to Josh PoimboeufQuoted 29 lines · Josh Poimboeuf
Quoted 28 lines · Tianyi Liu
Quoted 13 lines · Josh Poimboeuf
Quoted 12 lines · Tianyi Liu
Quoted 8 lines
LLVM_OBJCOPY=objcopy pahole -J --btf_gen_floats -j --skip_encoding_btf_inconsistent_proto --btf_gen_optimized .tmp_vmlinux.btf
btf_encoder__encode:btf__dedupfailed!
Failed to encode BTFThanks,
I encountered the same problem when building a new kernel and I found some reasons for the error.
Quoted 8 lines
Quoted 4 lines
In short, enabling
CONFIG_X86_KERNEL_IBTwill change the order of records in .notes section. In addition, due to historical problems, the alignment of records in the .notes section is not unified, which leads to the inability ofgelf_getnote()to read the records after the wrong one.Alexandre, Tianyi, are you still seeing this issue with the latest dwarves? If so can you confirm the below patch fixes it?
Josh, first of all, thank you very much for your help. However, this patch doesn't work in my environment. I am using gcc 12.2.1 20230201. After compiling, when I use readelf -S to view ELF sections, the align of .notes section is still 8:
Quoted 5 lines
Quoted 3 lines
$ readelf -S .tmp_vmlinux.btf [20] .notes NOTE ffffffff8250b570 0170b570 0000000000000084 0000000000000000 A 0 0 8Hm, weird.
I have consulted some materials and found that using ALIGN() in linker scripts can only "increase" alignment, not decrease it.
Perhaps could you try modifying your patch to use ALIGN(2) and SUBALIGN(2) and see if the .notes section in the output file is aligned to 2? In my tests, this had no effect.
[1] https://sourceware.org/binutils/docs/ld/Forced-Output-Alignment.html
Quoted 10 lines
Quoted 7 lines
Quoted 5 lines
Apparently the latest dwarves release fixes it on Fedora Rawhide [1], does anybody know if there a specific dwarves and/or libbpf change for this?
It has been fixed in dwarves[1], but it may just be a coincidence.
So just to confirm, the
btf__deduperror is gone for you with the latest dwarves?
Yes, this issue was fixed after a9498899109d3be14f17abbc322a8f55a1067bee ("dwarf_loader: Fix for BTF id drift caused by adding unspecified types"), which will be included in version 1.25.
Re: [PATCH] vmlinux.lds.h: Force-align ELF notes section to four bytes
Quoted 36 lines · Tianyi Liu
Quoted 29 lines · Josh Poimboeuf
Quoted 28 lines · Tianyi Liu
Quoted 13 lines · Josh Poimboeuf
Quoted 12 lines · Tianyi Liu
Quoted 8 lines
LLVM_OBJCOPY=objcopy pahole -J --btf_gen_floats -j --skip_encoding_btf_inconsistent_proto --btf_gen_optimized .tmp_vmlinux.btf
btf_encoder__encode:btf__dedupfailed!
Failed to encode BTFThanks,
I encountered the same problem when building a new kernel and I found some reasons for the error.
Quoted 8 lines
Quoted 4 lines
In short, enabling
CONFIG_X86_KERNEL_IBTwill change the order of records in .notes section. In addition, due to historical problems, the alignment of records in the .notes section is not unified, which leads to the inability ofgelf_getnote()to read the records after the wrong one.Alexandre, Tianyi, are you still seeing this issue with the latest dwarves? If so can you confirm the below patch fixes it?
Josh, first of all, thank you very much for your help. However, this patch doesn't work in my environment. I am using gcc 12.2.1 20230201. After compiling, when I use readelf -S to view ELF sections, the align of .notes section is still 8:
Quoted 5 lines
Quoted 3 lines
$ readelf -S .tmp_vmlinux.btf [20] .notes NOTE ffffffff8250b570 0170b570 0000000000000084 0000000000000000 A 0 0 8Hm, weird.
Quoted 8 lines
I have consulted some materials and found that using
ALIGN()in linker scripts can only "increase" alignment, not decrease it.Perhaps could you try modifying your patch to use ALIGN(2) and SUBALIGN(2) and see if the .notes section in the output file is aligned to 2? In my tests, this had no effect.
[1] https://sourceware.org/binutils/docs/ld/Forced-Output-Alignment.html
Not sure about the ld documentation (it may just be ambiguous wording) but while doing some tests, I have found that Josh's ALIGN/SUBALIGN(4) patch only works for certain kernel configs and fails for others. This likely explains why Josh's patch worked for me but not for Tianyi.
I haven't investigated why or when it works though, but here's a config where Josh's ALIGN(4) patch works and or where it doesn't (for me):
https://zealcharm.com/20230416-btf-dedup-bug-sample-configs/align-4-working
https://zealcharm.com/20230416-btf-dedup-bug-sample-configs/align-4-not-working
OTOH the new patch to discard .note.gnu.property works in both cases.
Re: [PATCH] vmlinux.lds.h: Force-align ELF notes section to four bytes
PS: As additional information for posterity, there are various conditions that explain why this is/was only a problem on some specific distributions:
* In addition to dwarves/pahole 1.24, binutils 2.40 seems to also be required for the problem to occur (in Arch, downgrading to binutils 2.39 fixes it).
* Debian (and thus derived distributions) configures binutils with --disable-x86-used-note, which by default disables emitting the GNU notes which ultimately cause the .notes section to be aligned to 8 bytes.
On Debian Bookworm & Ubuntu 23.04, the problem reproduces when building like:
``` export KCFLAGS="-Xassembler -mx86-used-note=yes" export KAFLAGS="-Xassembler -mx86-used-note=yes" make ```
Finally, here's a smaller .config to reproduce the problem on affected systems:
https://zealcharm.com/20230416-btf-dedup-bug-sample-configs/minimal-repro
[tip: objtool/urgent] vmlinux.lds.h: Discard .note.gnu.property section
In reply to Daniel XuThe following commit has been merged into the objtool/urgent branch of tip:
The following commit has been merged into the objtool/urgent branch of tip:
Commit-ID: f7ba52f302fdc392e0047f38e50841483d997144 Gitweb: https://git.kernel.org/tip/f7ba52f302fdc392e0047f38e50841483d997144 Author: Josh Poimboeuf <[email protected]> AuthorDate: Tue, 18 Apr 2023 14:49:25 -07:00 Committer: Josh Poimboeuf <[email protected]> CommitterDate: Tue, 16 May 2023 06:30:50 -07:00
vmlinux.lds.h: Discard .note.gnu.property section
When tooling reads ELF notes, it assumes each note entry is aligned to the value listed in the .note section header's sh_addralign field.
The kernel-created ELF notes in the .note.Linux and .note.Xen sections are aligned to 4 bytes. This causes the toolchain to set those sections' sh_addralign values to 4.
On the other hand, the GCC-created .note.gnu.property section has an sh_addralign value of 8 for some reason, despite being based on struct Elf32_Nhdr which only needs 4-byte alignment.
When the mismatched input sections get linked together into the vmlinux .notes output section, the higher alignment "wins", resulting in an sh_addralign of 8, which confuses tooling. For example:
$ readelf -n .tmp_vmlinux.btf ... readelf: .tmp_vmlinux.btf: Warning: note with invalid namesz and/or descsz found at offset 0x170 readelf: .tmp_vmlinux.btf: Warning: type: 0x4, namesize: 0x006e6558, descsize: 0x00008801, alignment: 8
In this case readelf thinks there's alignment padding where there is none, so it starts reading an ELF note in the middle.
With newer toolchains (e.g., latest Fedora Rawhide), a similar mismatch triggers a build failure when combined with CONFIG_X86_KERNEL_IBT:
btf_encoder__encode: btf__dedup failed!
Failed to encode BTF
libbpf: failed to find '.BTF' ELF section in vmlinux
FAILED: load BTF from vmlinux: No data available make[1]: *** [scripts/Makefile.vmlinux:35: vmlinux] Error 255
This latter error was caused by pahole crashing when it encountered the corrupt .notes section. This crash has been fixed in dwarves version 1.25. As Tianyi Liu describes:
"Pahole reads .notes to look for LINUX_ELFNOTE_BUILD_LTO. When LTO is
enabled, pahole needs to call cus__merge_and_process_cu to merge compile units, at which point there should only be one unspecified type (used to represent some compilation information) in the global context.
However, when the kernel is compiled without LTO, if pahole calls cus__merge_and_process_cu due to alignment issues with notes, multiple unspecified types may appear after merging the cus, and older versions of pahole only support up to one. This is why pahole 1.24 crashes, while newer versions support multiple. However, the latest version of pahole still does not solve the problem of incorrect LTO recognition, so compiling the kernel may be slower than normal."
Even with the newer pahole, the note section misaligment issue still exists and pahole is misinterpreting the LTO note. Fix it by discarding the .note.gnu.property section. While GNU properties are important for user space (and VDSO), they don't seem to have any use for vmlinux.
(In fact, they're already getting (inadvertently) stripped from vmlinux when CONFIG_DEBUG_INFO_BTF is enabled. The BTF data is extracted from vmlinux.o with "objcopy --only-section=.BTF" into .btf.vmlinux.bin.o. That file doesn't have .note.gnu.property, so when it gets modified and linked back into the main object, the linker automatically strips it (see "How GNU properties are merged" in the ld man page).)
--- include/asm-generic/vmlinux.lds.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
include/asm-generic/vmlinux.lds.h +8 -1
@@ -891,9 +891,16 @@/* * Discard .note.GNU-stack, which is emitted as PROGBITS by the compiler. * Otherwise, the type of .notes section would become PROGBITS instead of NOTES. +* +* Also, discard .note.gnu.property, otherwise it forces the notes section to +* be 8-byte aligned which causes alignment mismatches with the kernel's custom +* 4-byte aligned notes. */ #define NOTES \ - /DISCARD/ : { *(.note.GNU-stack) } \ + /DISCARD/ : { \ + *(.note.GNU-stack) \ + *(.note.gnu.property) \ + } \ .notes : AT(ADDR(.notes) - LOAD_OFFSET) { \ BOUNDED_SECTION_BY(.note.*, _notes) \ } NOTES_HEADERS \