Skip to content
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

bpf-linker core dump in aya-template generated project #7

Closed
cfeitong opened this issue Nov 26, 2021 · 2 comments
Closed

bpf-linker core dump in aya-template generated project #7

cfeitong opened this issue Nov 26, 2021 · 2 comments

Comments

@cfeitong
Copy link

This is my rustc version:

Default host: x86_64-unknown-linux-gnu
rustup home:  /home/cfeitong/.rustup

nightly-x86_64-unknown-linux-gnu (default)
rustc 1.58.0-nightly (dd549dcab 2021-11-25)

I just run cargo xtask build-ebpf and come across following error:

cargo xtask build-ebpf
    Finished dev [unoptimized + debuginfo] target(s) in 0.03s
     Running `target/debug/xtask build-ebpf`
       Fresh core v0.0.0 (/home/cfeitong/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core)
       Fresh unicode-xid v0.2.2
       Fresh rustc-std-workspace-core v1.99.0 (/home/cfeitong/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/rustc-std-workspace-core)
       Fresh compiler_builtins v0.1.52
       Fresh proc-macro2 v1.0.32
       Fresh quote v1.0.10
       Fresh aya-bpf-cty v0.2.1 (http://github.com/aya-rs/aya?branch=main#98b36b23)
       Fresh aya-try-common v0.1.0 (/home/cfeitong/aya-try/aya-try-common)
       Fresh syn v1.0.82
       Fresh aya-bpf-bindings v0.1.0 (http://github.com/aya-rs/aya?branch=main#98b36b23)
       Fresh aya-bpf-macros v0.1.0 (http://github.com/aya-rs/aya?branch=main#98b36b23)
       Fresh aya-bpf v0.1.0 (http://github.com/aya-rs/aya?branch=main#98b36b23)
   Compiling aya-try-ebpf v0.1.0 (/home/cfeitong/aya-try/aya-try-ebpf)
     Running `rustc --crate-name aya_try --edition=2018 src/main.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type bin --emit=dep-info,link -C opt-level=2 -C panic=abort -C embed-bitcode=no -C debuginfo=1 -C debug-assertions=on -C overflow-checks=off -C metadata=36fb82a4cf69a379 -C extra-filename=-36fb82a4cf69a379 --out-dir /home/cfeitong/aya-try/aya-try-ebpf/../target/bpfel-unknown-none/debug/deps --target bpfel-unknown-none -C incremental=/home/cfeitong/aya-try/aya-try-ebpf/../target/bpfel-unknown-none/debug/incremental -L dependency=/home/cfeitong/aya-try/aya-try-ebpf/../target/bpfel-unknown-none/debug/deps -L dependency=/home/cfeitong/aya-try/aya-try-ebpf/../target/debug/deps --extern aya_bpf=/home/cfeitong/aya-try/aya-try-ebpf/../target/bpfel-unknown-none/debug/deps/libaya_bpf-54640d6e071de353.rlib --extern aya_try_common=/home/cfeitong/aya-try/aya-try-ebpf/../target/bpfel-unknown-none/debug/deps/libaya_try_common-356f6b2922032732.rlib --extern 'noprelude:compiler_builtins=/home/cfeitong/aya-try/aya-try-ebpf/../target/bpfel-unknown-none/debug/deps/libcompiler_builtins-177c1b24e4b8b2db.rlib' --extern 'noprelude:core=/home/cfeitong/aya-try/aya-try-ebpf/../target/bpfel-unknown-none/debug/deps/libcore-2c13aef38b676b75.rlib' -Z unstable-options`
error: linking with `bpf-linker` failed: signal: 6 (core dumped)
  |
  = note: "bpf-linker" "--export-symbols" "/tmp/rustcgdWOgi/symbols" "/home/cfeitong/aya-try/aya-try-ebpf/../target/bpfel-unknown-none/debug/deps/aya_try-36fb82a4cf69a379.17dzbhexels5i7io.rcgu.o" "-L" "/home/cfeitong/aya-try/aya-try-ebpf/../target/bpfel-unknown-none/debug/deps" "-L" "/home/cfeitong/aya-try/aya-try-ebpf/../target/debug/deps" "-L" "/home/cfeitong/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/bpfel-unknown-none/lib" "/home/cfeitong/aya-try/target/bpfel-unknown-none/debug/deps/libaya_bpf-54640d6e071de353.rlib" "/home/cfeitong/aya-try/target/bpfel-unknown-none/debug/deps/libaya_bpf_bindings-be43530adef294a6.rlib" "/home/cfeitong/aya-try/target/bpfel-unknown-none/debug/deps/libaya_bpf_cty-b7d399661acdd31b.rlib" "/home/cfeitong/aya-try/target/bpfel-unknown-none/debug/deps/librustc_std_workspace_core-51eb0738dcf81a45.rlib" "/home/cfeitong/aya-try/target/bpfel-unknown-none/debug/deps/libcore-2c13aef38b676b75.rlib" "/home/cfeitong/aya-try/target/bpfel-unknown-none/debug/deps/libcompiler_builtins-177c1b24e4b8b2db.rlib" "--cpu" "generic" "--cpu-features" "" "-L" "/home/cfeitong/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/bpfel-unknown-none/lib" "-o" "/home/cfeitong/aya-try/aya-try-ebpf/../target/bpfel-unknown-none/debug/deps/aya_try-36fb82a4cf69a379" "-O2" "--debug"
  = note: 09:11:02 [ERROR] fatal error: "Cannot select: 0x55f68fc8fd58: i64,ch = AtomicLoad<(load unordered (s64) from %ir.45)> 0x55f68e76e978, 0x55f68fc90100\n  0x55f68fc90100: i64,ch = CopyFromReg 0x55f68e76e978, Register:i64 %19\n    0x55f68fc904a8: i64 = Register %19\nIn function: memcpy"
          PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace.
          Stack dump:
          0.    Running pass 'Function Pass Manager' on module 'aya_try-36fb82a4cf69a379'.
          1.    Running pass 'BPF DAG->DAG Pattern Instruction Selection' on function '@memcpy'
          

error: could not compile `aya-try-ebpf` due to previous error

Caused by:
  process didn't exit successfully: `rustc --crate-name aya_try --edition=2018 src/main.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type bin --emit=dep-info,link -C opt-level=2 -C panic=abort -C embed-bitcode=no -C debuginfo=1 -C debug-assertions=on -C overflow-checks=off -C metadata=36fb82a4cf69a379 -C extra-filename=-36fb82a4cf69a379 --out-dir /home/cfeitong/aya-try/aya-try-ebpf/../target/bpfel-unknown-none/debug/deps --target bpfel-unknown-none -C incremental=/home/cfeitong/aya-try/aya-try-ebpf/../target/bpfel-unknown-none/debug/incremental -L dependency=/home/cfeitong/aya-try/aya-try-ebpf/../target/bpfel-unknown-none/debug/deps -L dependency=/home/cfeitong/aya-try/aya-try-ebpf/../target/debug/deps --extern aya_bpf=/home/cfeitong/aya-try/aya-try-ebpf/../target/bpfel-unknown-none/debug/deps/libaya_bpf-54640d6e071de353.rlib --extern aya_try_common=/home/cfeitong/aya-try/aya-try-ebpf/../target/bpfel-unknown-none/debug/deps/libaya_try_common-356f6b2922032732.rlib --extern 'noprelude:compiler_builtins=/home/cfeitong/aya-try/aya-try-ebpf/../target/bpfel-unknown-none/debug/deps/libcompiler_builtins-177c1b24e4b8b2db.rlib' --extern 'noprelude:core=/home/cfeitong/aya-try/aya-try-ebpf/../target/bpfel-unknown-none/debug/deps/libcore-2c13aef38b676b75.rlib' -Z unstable-options` (exit status: 1)
thread 'main' panicked at 'assertion failed: status.success()', xtask/src/build_ebpf.rs:62:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
@alessandrod
Copy link
Collaborator

Thanks for the report and sorry about the trouble! This is a known bug that is getting fixed in the rust compiler, see rust-lang/compiler-builtins#440.

In the meantime you can workaround the problem building the ebpf code with:

cd aya-try-ebpf
cargo rustc -- -C link-arg=--disable-memory-builtins

instead of running cargo xtask build-ebpf.

@alessandrod
Copy link
Collaborator

This is now fixed in rust nightly rust-lang/rust#91248

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants