Skip to content

Commit

Permalink
Collect envs in AsanModuleBuilder::default() (AFLplusplus#2921)
Browse files Browse the repository at this point in the history
* collect envs in AsanModuleBuilder::default

* migration

* fmt
  • Loading branch information
tokatoka authored Feb 1, 2025
1 parent 84702d1 commit 6648bc9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
1 change: 1 addition & 0 deletions MIGRATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
- `EventProcessor` is responsible for evaluating the testcases passed by the `EventReceiver`.
- Since we don't evaluate testcases in the `EventManager` anymore. `on_fire` and `post_exec` have been deleted from `EventManagerHook`.
- Similarly `pre_exec` has been renamed to `pre_receive`.
- `AsanModule` now uses a `builder()` method for constructing its instances.

# 0.14.1 -> 0.15.0
- `MmapShMem::new` and `MmapShMemProvider::new_shmem_with_id` now take `AsRef<Path>` instead of a byte array for the filename/id.
Expand Down
14 changes: 9 additions & 5 deletions libafl_qemu/src/modules/usermode/asan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ pub enum AsanError {
}

pub struct AsanModuleBuilder {
env: Option<Vec<(String, String)>>,
env: Vec<(String, String)>,
detect_leaks: bool,
snapshot: bool,
filter: StdAddressFilter,
Expand Down Expand Up @@ -234,7 +234,7 @@ impl Debug for AsanGiovese {
impl AsanModuleBuilder {
#[must_use]
pub fn new(
env: Option<Vec<(String, String)>>,
env: Vec<(String, String)>,
detect_leaks: bool,
snapshot: bool,
filter: StdAddressFilter,
Expand All @@ -252,7 +252,7 @@ impl AsanModuleBuilder {
#[must_use]
pub fn env(self, env: &[(String, String)]) -> Self {
Self::new(
Some(env.to_vec()),
env.to_vec(),
self.detect_leaks,
self.snapshot,
self.filter,
Expand Down Expand Up @@ -324,7 +324,7 @@ impl AsanModuleBuilder {
#[must_use]
pub fn build(self) -> AsanModule {
AsanModule::new(
self.env.unwrap().as_ref(),
self.env.as_ref(),
self.detect_leaks,
self.snapshot,
self.filter,
Expand All @@ -335,7 +335,11 @@ impl AsanModuleBuilder {

impl Default for AsanModuleBuilder {
fn default() -> Self {
Self::new(None, false, true, StdAddressFilter::default(), None)
let env = env::vars()
.filter(|(k, _v)| k != "LD_LIBRARY_PATH")
.collect::<Vec<(String, String)>>();

Self::new(env, false, true, StdAddressFilter::default(), None)
}
}

Expand Down

0 comments on commit 6648bc9

Please sign in to comment.