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

symbol not found issue when building fuzz target with plugins #539

Open
0xalpharush opened this issue Oct 14, 2024 · 3 comments
Open

symbol not found issue when building fuzz target with plugins #539

0xalpharush opened this issue Oct 14, 2024 · 3 comments

Comments

@0xalpharush
Copy link

0xalpharush commented Oct 14, 2024

I ran cargo +nightly afl config --build --plugins successfully in order to use AFL++'s instrumentation passes. When I run cargo afl build, I get the following error:

error: failed to run LLVM passes: Could not load library '~/.local/share/afl.rs/rustc-1.83.0-nightly-6f4ae0f/afl.rs-0.15.10/afl-llvm/cmplog-instructions-pass.so': dlopen(~/.local/share/afl.rs/rustc-1.83.0-nightly-6f4ae0f/afl.rs-0.15.10/afl-llvm/cmplog-instructions-pass.so, 0x0009): symbol not found in flat namespace '__ZN4llvm17PreservedAnalyses14AllAnalysesKeyE'

There is a similarly named symbol in the share library:

$ llvm-nm ~/.local/share/afl.rs/rustc-1.83.0-nightly-6f4ae0f/afl.rs-0.15.10/afl-llvm/cmplog-instructions-pass.so | rustfilt | grep "PreservedAnalyses"
                 U _llvm::PreservedAnalyses::AllAnalysesKey

I'm not sure how to resolve this... Maybe I need to install a specific rustc/llvm/afl-rs for them to cooperate? Any help is greatly appreciated!

If I try to build with LLVM 18.1.8 I get: called `Result::unwrap()` on an `Err` value: llvm-config --version output does not contain expected major version (19)

Fwiw, here's where the name appears in the AFLPlusPlus codebase https://github.com/search?q=repo%3AAFLplusplus%2FAFLplusplus+PreservedAnalyses&type=code

Other background that may be useful:

$ llvm-config --version                                                            
19.1.1
$ rustup show
active toolchain
----------------

nightly-aarch64-apple-darwin (default)
rustc 1.83.0-nightly (6f4ae0f34 2024-10-08)
$ rustup component add llvm-tools-preview
info: component 'llvm-tools' for target 'aarch64-apple-darwin' is up to date
$ echo $LLVM_CONFIG 
llvm-config
@smoelius
Copy link
Member

Hi, @0xalpharush. Plugins are currently only supported on Linux (though this needs to be better documented).

We don't test the plugins on macOS in CI for this reason:

exclude:
- environment: macos-latest
plugins: true

I hope this hasn't caused you to lose too much time.

@michprev
Copy link

Hey @smoelius,
I am having a similar problem with Ubuntu ARM docker image (https://hub.docker.com/r/arm64v8/ubuntu/).

The error:

error: failed to run LLVM passes: Could not load library '/root/.local/share/afl.rs/rustc-1.84.0-nightly-03ee484/afl.rs-0.15.11/afl-llvm/cmplog-instructions-pass.so': /root/.local/share/afl.rs/rustc-1.84.0-nightly-03ee484/afl.rs-0.15.11/afl-llvm/cmplog-instructions-pass.so: undefined symbol: _ZTVN4llvm24IRBuilderDefaultInserterE

rustc -vV prints LLVM version: 19.1.3. I installed LLVM through apt install llvm-19 (which actually installs the version 19.1.1).

@smoelius
Copy link
Member

@michprev That doesn't surprise me, and I should have been more precise in #539 (comment).

LLVM plugins work for only x86_64-unknown-linux-gnu currently. This precludes ARM as well.

This issue is tracked here: rust-lang/rust#127577

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

3 participants