-
-
Notifications
You must be signed in to change notification settings - Fork 330
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into python/pyproject-toml
- Loading branch information
Showing
6 changed files
with
21 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,21 @@ | ||
//! [`LLVM` `8-bi-counters`](https://clang.llvm.org/docs/SanitizerCoverage.html#tracing-pcs-with-guards) runtime for `LibAFL`. | ||
use alloc::vec::Vec; | ||
use core::slice::from_raw_parts_mut; | ||
|
||
use libafl::bolts::ownedref::OwnedMutSlice; | ||
|
||
/// A [`Vec`] of `8-bit-counters` maps for multiple modules. | ||
/// They are initialized by calling [`__sanitizer_cov_8bit_counters_init`]( | ||
pub static mut COUNTERS_MAPS: Vec<&'static mut [u8]> = Vec::new(); | ||
pub static mut COUNTERS_MAPS: Vec<OwnedMutSlice<'static, u8>> = Vec::new(); | ||
|
||
/// Initialize the sancov `8-bit-counters` - usually called by `llvm`. | ||
#[no_mangle] | ||
#[allow(clippy::cast_sign_loss)] | ||
#[allow(clippy::not_unsafe_ptr_arg_deref)] | ||
pub extern "C" fn __sanitizer_cov_8bit_counters_init(start: *mut u8, stop: *mut u8) { | ||
unsafe { COUNTERS_MAPS.push(from_raw_parts_mut(start, stop.offset_from(start) as usize)) } | ||
unsafe { | ||
COUNTERS_MAPS.push(OwnedMutSlice::from_raw_parts_mut( | ||
start, | ||
stop.offset_from(start) as usize, | ||
)); | ||
} | ||
} |