Re: Kernel build fail with 'btf_encoder__encode: btf__dedup failed!'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jan 27, 2023, at 5:21 PM, Daniel Xu wrote:
> Hi Jiri & Alexandre,
>
> On Fri, Jan 27, 2023, at 5:00 PM, Jiri Olsa wrote:
>> On Fri, Jan 27, 2023 at 04:28:54PM -0600, Alexandre Peixoto Ferreira wrote:
>>> 
>>> 
>>> On 1/24/23 00:13, Daniel Xu wrote:
>>> > Hi Jiri,
>>> > 
>>> > On Mon, Jan 23, 2023, at 1:06 AM, Jiri Olsa wrote:
>>> > > On Sun, Jan 22, 2023 at 10:48:44AM -0700, Daniel Xu wrote:
>>> > > > 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 2
>>> > > > 
>>> > > > This 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.
>>> > > 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
>>> > 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.
>>> 6.2-rc5 compiles correctly when CONFIG_X86_KERNEL_IBT is commented but fails
>>> in pahole when CONFIG_X86_KERNEL_IBT is 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

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@xxxxxxxxx>
From: Daniel Xu <dxu@xxxxxxxxx>
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").

Signed-off-by: Daniel Xu <dxu@xxxxxxxxx>
---
 tools/testing/selftests/bpf/config.x86_64 | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/testing/selftests/bpf/config.x86_64 b/tools/testing/selftests/bpf/config.x86_64
index dd97d61d325c..3026b1282cc7 100644
--- a/tools/testing/selftests/bpf/config.x86_64
+++ b/tools/testing/selftests/bpf/config.x86_64
@@ -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



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux