Centralized build configuration for LibAFL #1334
Evian-Zhang
started this conversation in
Ideas
Replies: 1 comment 7 replies
-
Thanks for your interest! I think right now LibAFL's build.rs scripts make use regular environment variables at compiletime. Would it be a good first step to add an env variable for |
Beta Was this translation helpful? Give feedback.
7 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
First of all, thank you for building such extraordinary Rust crates for fuzzing!
For background, researchers may want to modify QEMU code when proposing novel ideas for binary-only fuzzing, and this can be easily done by modifying
build_qemu_support.sh
file when using AFL++. However, when using LibAFL, one should look intolibafl_qemu/libafl_qemu_build/src/build.rs
for environment variables to change the url of QEMU code to their self-modified version (Moreover, it is more complicated for editor's language server to observe this change, which is a bad experience to use vscode). I found these ad-hoc things (not only for QEMU, but also other configurations for LLVM mode/frida mode, etc.) hard to follow, and LibAFL has so many configurations across the whole source code.I am good at Rust and willing to help writing a centralized build configuration for LibAFL, but I have some questions about this after reading the source code of the build system in LibAFL.
Brief
In short, we may have a
libafl.toml
configuration file to centralize these environment variables which control the behavior of what and how to build LibAFL, its content may look like thisHow to implement
We may create a new member crate
libafl_conf
, which provide parsing of such configuration files lazily (i.e. In one build script, the configuration file will be parsed only once). And in each position where one configuration value is needed, we access such configuration and get the corresponding fields.Advantages
libafl_conf
crate itself can also be used as a code-as-doc for building LibAFL. And we may also provide many configuration templates for difference purposes.Drawbacks
Rerun
The
cargo:rerun-if-changed=xxx
things (docs here) should be re-considered.To clarify, let's re-think the purpose for re-running:
For developers
For users, never re-run the build script except for configuration changed
So current
cargo:rerun-if-changed=xxx
is not good enough for our purpose. I think we can do this in code-level rather than compiler level, i.e., we can add arerun
field in configuration to indicate whether this build script should be re-runned, and its default value is false. Note that this means the configuration file will be pared each time we run a build in each build script, and I believe this is not a heavy things so it may be acceptable.Compatibility
Current projects depending on LibAFL may adopt new configuration files
Questions
So before I implementing such features, some questions need to be settled
Whether we should keep current configuration methods for compatibility?
If so, for environment-based configurations, it is easy to do so; For cargo-feature-based configurations, it need extra efforts since it is compiler-related
Is the
rerun
thing mentioned above good?I am not familiar with LibAFL and I wonder if there are also some runtime configurations need to be unified like build configurations in
libafl-run.toml
?Other questions may be added in this discussion thread if I met.
Feel free to discuss this feature!:)
Beta Was this translation helpful? Give feedback.
All reactions