Skip to content

FAILED unresolved symbol vfs_truncate #1297

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
nathanchance opened this issue Feb 9, 2021 · 12 comments
Closed

FAILED unresolved symbol vfs_truncate #1297

nathanchance opened this issue Feb 9, 2021 · 12 comments
Labels
[ARCH] arm64 This bug impacts ARCH=arm64 [BUG] linux A bug that should be fixed in the mainline kernel.

Comments

@nathanchance
Copy link
Member

Initially reported by @veruu: https://groups.google.com/g/clang-built-linux/c/de_mNh23FOc/m/E7cu5BwbBAAJ

Isolated set of configs:

$ make -skj"$(nproc)" ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- LLVM=1 O=build/aarch64 defconfig

$ scripts/config --file build/aarch64/.config -e BPF_SYSCALL -e DEBUG_INFO_BTF -e FTRACE -e FUNCTION_TRACER

$ make -skj"$(nproc)" ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- LLVM=1 O=build/aarch64 olddefconfig all
...
FAILED unresolved symbol vfs_truncate
...

I have reported this to the BPF folks upstream: https://lore.kernel.org/r/20210209034416.GA1669105@ubuntu-m3-large-x86/

@nathanchance nathanchance added [BUG] Untriaged Something isn't working [ARCH] arm64 This bug impacts ARCH=arm64 labels Feb 9, 2021
@dileks
Copy link
Collaborator

dileks commented Feb 9, 2021

I am not a BPF/BTF expert but I inspected my vmlinux on x86-64 where I have all above Kconfigs set:

$ /opt/llvm-toolchain/bin/llvm-objdump -Dr vmlinux

ffffffff8252ecfc <__BTF_ID__func__vfs_truncate__622>:
ffffffff8252ecfc: e0 76                 loopne  0xffffffff8252ed74 <__BTF_ID__struct__udp6_sock__1270>
ffffffff8252ecfe: 00 00                 addb    %al, (%rax)

ffffffff8252ed10 <bpf_d_path_btf_ids>:
ffffffff8252ed10: ca 00 00              lretl   $0
ffffffff8252ed13: 00 03                 addb    %al, (%rbx)

So, this seems to be arm64 specific.

@dileks
Copy link
Collaborator

dileks commented Feb 9, 2021

Playing with bpftool and ripgrep (rg):

$ /usr/sbin/bpftool btf dump file vmlinux | rg 'vfs_truncate|bpf_d_path'
[22284] TYPEDEF 'btf_bpf_d_path' type_id=22285
[29999] FUNC 'vfs_truncate' type_id=29998 linkage=static

@nathanchance nathanchance added [BUG] linux A bug that should be fixed in the mainline kernel. and removed [BUG] Untriaged Something isn't working labels Feb 10, 2021
@nathanchance
Copy link
Member Author

TL;DR of the upstream thread: This appears to be a pahole bug, exposed by arm64's BTI (which is why Sedat does not see anything). Jiri Olsa has posted a tentative pahole fix, which I have verified against Veronika's original config and the reduced one that I came up with.

@dileks
Copy link
Collaborator

dileks commented Feb 10, 2021

@nathanchance
Cool!

My selfmade LLVM toolchain v12.0.0-rc1 supports AArch64 arch:

$ /opt/llvm-toolchain/bin/llc --version
LLVM (http://llvm.org/):
  LLVM version 12.0.0
  Optimized build.
  Default target: x86_64-unknown-linux-gnu
  Host CPU: sandybridge

  Registered Targets:
    aarch64    - AArch64 (little endian)
    aarch64_32 - AArch64 (little endian ILP32)
    aarch64_be - AArch64 (big endian)
    arm64      - ARM64 (little endian)
    arm64_32   - ARM64 (little endian ILP32)
    bpf        - BPF (host endian)
    bpfeb      - BPF (big endian)
    bpfel      - BPF (little endian)
    x86        - 32-bit X86: Pentium-Pro and above
    x86-64     - 64-bit X86: EM64T and AMD64

Can I cross-build for Linux/arm64?
If yes, how?

Just curious - I wanted to throw out Aarch64 target in my next ThinLTO+PGO optimized LLVM toolchain build (version 12.0.0-rc2) as the Linux/arm64 defconfig build takes here 02:30 [hh:mm] (vs. 00:45 for Linux/x86_64 defconfig).

@veruu
Copy link
Member

veruu commented Feb 10, 2021

Can I cross-build for Linux/arm64?
If yes, how?

We do

export ARCH=arm64
export CROSS_COMPILE=aarch64-linux-gnu-
make LLVM=1 -j30 INSTALL_MOD_STRIP=1 targz-pkg

@dileks
Copy link
Collaborator

dileks commented Feb 10, 2021

@veruu

Is that your first comment in the CBL BTS :-)?

I normally build my LLVM toolchain with tc-build.

Kept the build-log - so I see:

$ grep aarch64-linux-gnu log_tc-build.txt | grep make
+ make -skj4 LLVM=1 O=out ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- KCONFIG_ALLCONFIG=/dev/fd/63 distclean defconfig Image.gz modules

That was my first Linux/arm64 cross-build :-).

Dunno, if I have time with this.
This Friday is milestone #2 of Debian/bullseye aka Debian-11 - that is of importance for Debianists.

[1] https://github.com/ClangBuiltLinux/tc-build

@veruu
Copy link
Member

veruu commented Feb 10, 2021

Is that your first comment in the CBL BTS :-)?

Hah possibly. I usually just annoy people on the mailing list and let them handle the rest (like with reporting this bug) 🙈

I'm a bit confused by your comment now as based on the question and issue I assumed you're asking about cross compiling the kernel to reproduce the problem/test the fix, but then linked LLVM building scripts. If you were asking about cross building LLVM and not the kernel then I'm sorry for misunderstanding!

@dileks
Copy link
Collaborator

dileks commented Feb 10, 2021

@veruu

Indeed, 1st I like to confuse people and 2nd I wanted to reproduce this issue for Linux/arm64 but was not sure if I have all toolchain requirement to do so.

@veruu
Copy link
Member

veruu commented Feb 10, 2021

Given that your target list contains both ARM and BPF targets you should be good to go :)

@dileks
Copy link
Collaborator

dileks commented Feb 10, 2021

/me gets red (hat).

@nathanchance nathanchance added the [PATCH] Submitted A patch has been submitted for review label Feb 14, 2021
@nathanchance
Copy link
Member Author

pahole patch posted: https://lore.kernel.org/r/[email protected]/

@nickdesaulniers
Copy link
Member

looks like pahole has this as 8e1f8c904e303d5d142d24e820f01b47a35bb72a which was in v1.21.

@nickdesaulniers nickdesaulniers removed the [PATCH] Submitted A patch has been submitted for review label Apr 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[ARCH] arm64 This bug impacts ARCH=arm64 [BUG] linux A bug that should be fixed in the mainline kernel.
Projects
None yet
Development

No branches or pull requests

4 participants