Skip to content

Commit 6648bc9

Browse files
authored
Collect envs in AsanModuleBuilder::default() (#2921)
* collect envs in AsanModuleBuilder::default * migration * fmt
1 parent 84702d1 commit 6648bc9

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

MIGRATION.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
- `EventProcessor` is responsible for evaluating the testcases passed by the `EventReceiver`.
66
- Since we don't evaluate testcases in the `EventManager` anymore. `on_fire` and `post_exec` have been deleted from `EventManagerHook`.
77
- Similarly `pre_exec` has been renamed to `pre_receive`.
8+
- `AsanModule` now uses a `builder()` method for constructing its instances.
89

910
# 0.14.1 -> 0.15.0
1011
- `MmapShMem::new` and `MmapShMemProvider::new_shmem_with_id` now take `AsRef<Path>` instead of a byte array for the filename/id.

libafl_qemu/src/modules/usermode/asan.rs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ pub enum AsanError {
133133
}
134134

135135
pub struct AsanModuleBuilder {
136-
env: Option<Vec<(String, String)>>,
136+
env: Vec<(String, String)>,
137137
detect_leaks: bool,
138138
snapshot: bool,
139139
filter: StdAddressFilter,
@@ -234,7 +234,7 @@ impl Debug for AsanGiovese {
234234
impl AsanModuleBuilder {
235235
#[must_use]
236236
pub fn new(
237-
env: Option<Vec<(String, String)>>,
237+
env: Vec<(String, String)>,
238238
detect_leaks: bool,
239239
snapshot: bool,
240240
filter: StdAddressFilter,
@@ -252,7 +252,7 @@ impl AsanModuleBuilder {
252252
#[must_use]
253253
pub fn env(self, env: &[(String, String)]) -> Self {
254254
Self::new(
255-
Some(env.to_vec()),
255+
env.to_vec(),
256256
self.detect_leaks,
257257
self.snapshot,
258258
self.filter,
@@ -324,7 +324,7 @@ impl AsanModuleBuilder {
324324
#[must_use]
325325
pub fn build(self) -> AsanModule {
326326
AsanModule::new(
327-
self.env.unwrap().as_ref(),
327+
self.env.as_ref(),
328328
self.detect_leaks,
329329
self.snapshot,
330330
self.filter,
@@ -335,7 +335,11 @@ impl AsanModuleBuilder {
335335

336336
impl Default for AsanModuleBuilder {
337337
fn default() -> Self {
338-
Self::new(None, false, true, StdAddressFilter::default(), None)
338+
let env = env::vars()
339+
.filter(|(k, _v)| k != "LD_LIBRARY_PATH")
340+
.collect::<Vec<(String, String)>>();
341+
342+
Self::new(env, false, true, StdAddressFilter::default(), None)
339343
}
340344
}
341345

0 commit comments

Comments
 (0)