Make all no_mangle fns extern "C" (#1369)
This commit is contained in:
parent
eb362c5c77
commit
003b219826
@ -1,7 +1,7 @@
|
||||
use libafl_targets::{map_shared_memory, start_forkserver};
|
||||
|
||||
#[no_mangle]
|
||||
pub fn libafl_start_forkserver() {
|
||||
pub extern "C" fn libafl_start_forkserver() {
|
||||
// Map shared memory region for the edge coverage map
|
||||
map_shared_memory();
|
||||
// Start the forkserver
|
||||
|
@ -57,7 +57,7 @@ use nix::{self, unistd::dup};
|
||||
|
||||
/// The fuzzer main (as `no_mangle` C function)
|
||||
#[no_mangle]
|
||||
pub fn libafl_main() {
|
||||
pub extern "C" fn libafl_main() {
|
||||
// Registry the metadata types used in this fuzzer
|
||||
// Needed only on no_std
|
||||
//RegistryBuilder::register::<Tokens>();
|
||||
|
@ -64,7 +64,7 @@ use nix::{self, unistd::dup};
|
||||
/// The fuzzer main (as `no_mangle` C function)
|
||||
#[no_mangle]
|
||||
#[allow(clippy::too_many_lines)]
|
||||
pub fn libafl_main() {
|
||||
pub extern "C" fn libafl_main() {
|
||||
// Registry the metadata types used in this fuzzer
|
||||
// Needed only on no_std
|
||||
//RegistryBuilder::register::<Tokens>();
|
||||
|
@ -48,7 +48,7 @@ use libafl_targets::{
|
||||
|
||||
/// Set up our coverage map.
|
||||
#[no_mangle]
|
||||
pub fn __sanitizer_cov_8bit_counters_init(start: *mut u8, stop: *mut u8) {
|
||||
pub extern "C" fn __sanitizer_cov_8bit_counters_init(start: *mut u8, stop: *mut u8) {
|
||||
unsafe {
|
||||
EDGES_MAP_PTR = start;
|
||||
MAX_EDGES_NUM = (stop as usize - start as usize) / 8;
|
||||
@ -58,7 +58,7 @@ pub fn __sanitizer_cov_8bit_counters_init(start: *mut u8, stop: *mut u8) {
|
||||
/// `pcs` tables seem to be unused by `Atheris`, so we can ignore this setup function,
|
||||
/// but the symbol is still being called and, hence, required.
|
||||
#[no_mangle]
|
||||
pub fn __sanitizer_cov_pcs_init(_pcs_beg: *mut u8, _pcs_end: *mut u8) {
|
||||
pub extern "C" fn __sanitizer_cov_pcs_init(_pcs_beg: *mut u8, _pcs_end: *mut u8) {
|
||||
// noop
|
||||
}
|
||||
|
||||
@ -66,7 +66,7 @@ pub fn __sanitizer_cov_pcs_init(_pcs_beg: *mut u8, _pcs_end: *mut u8) {
|
||||
/// This is a PoC implementation and could be improved.
|
||||
/// For example, it only takes up to 8 bytes into consideration.
|
||||
#[no_mangle]
|
||||
pub fn __sanitizer_weak_hook_memcmp(
|
||||
pub extern "C" fn __sanitizer_weak_hook_memcmp(
|
||||
_caller_pc: *const c_void,
|
||||
s1: *const c_void,
|
||||
s2: *const c_void,
|
||||
@ -104,7 +104,7 @@ pub fn __sanitizer_weak_hook_memcmp(
|
||||
/// and jumps back into `Atheris'` instrumented python code.
|
||||
#[no_mangle]
|
||||
#[allow(non_snake_case)]
|
||||
pub fn LLVMFuzzerRunDriver(
|
||||
pub extern "C" fn LLVMFuzzerRunDriver(
|
||||
_argc: *const c_int,
|
||||
_argv: *const *const c_char,
|
||||
harness_fn: Option<extern "C" fn(*const u8, usize) -> c_int>,
|
||||
|
@ -42,7 +42,7 @@ extern "C" {
|
||||
|
||||
/// The main fn, usually parsing parameters, and starting the fuzzer
|
||||
#[no_mangle]
|
||||
pub fn libafl_main() {
|
||||
pub extern "C" fn libafl_main() {
|
||||
// Registry the metadata types used in this fuzzer
|
||||
// Needed only on no_std
|
||||
//RegistryBuilder::register::<Tokens>();
|
||||
|
@ -41,7 +41,7 @@ use libafl_targets::{libfuzzer_initialize, libfuzzer_test_one_input, EDGES_MAP,
|
||||
/// The main fn, `no_mangle` as it is a C main
|
||||
#[cfg(not(test))]
|
||||
#[no_mangle]
|
||||
pub fn libafl_main() {
|
||||
pub extern "C" fn libafl_main() {
|
||||
// Registry the metadata types used in this fuzzer
|
||||
// Needed only on no_std
|
||||
//RegistryBuilder::register::<Tokens>();
|
||||
|
@ -113,7 +113,7 @@ struct Opt {
|
||||
|
||||
/// The main fn, `no_mangle` as it is a C symbol
|
||||
#[no_mangle]
|
||||
pub fn libafl_main() {
|
||||
pub extern "C" fn libafl_main() {
|
||||
// Registry the metadata types used in this fuzzer
|
||||
// Needed only on no_std
|
||||
//RegistryBuilder::register::<Tokens>();
|
||||
|
@ -112,7 +112,7 @@ struct Opt {
|
||||
|
||||
/// The main fn, `no_mangle` as it is a C symbol
|
||||
#[no_mangle]
|
||||
pub fn libafl_main() {
|
||||
pub extern "C" fn libafl_main() {
|
||||
env_logger::init();
|
||||
|
||||
// Registry the metadata types used in this fuzzer
|
||||
|
@ -44,7 +44,7 @@ use libafl_targets::{libfuzzer_initialize, libfuzzer_test_one_input, std_edges_m
|
||||
/// The main fn, `no_mangle` as it is a C main
|
||||
#[cfg(not(test))]
|
||||
#[no_mangle]
|
||||
pub fn libafl_main() {
|
||||
pub extern "C" fn libafl_main() {
|
||||
// Registry the metadata types used in this fuzzer
|
||||
// Needed only on no_std
|
||||
//RegistryBuilder::register::<Tokens>();
|
||||
|
@ -108,7 +108,7 @@ struct Opt {
|
||||
|
||||
/// The main fn, `no_mangle` as it is a C symbol
|
||||
#[no_mangle]
|
||||
pub fn libafl_main() {
|
||||
pub extern "C" fn libafl_main() {
|
||||
// Registry the metadata types used in this fuzzer
|
||||
// Needed only on no_std
|
||||
//RegistryBuilder::register::<Tokens>();
|
||||
|
@ -111,7 +111,7 @@ struct Opt {
|
||||
|
||||
/// The main fn, `no_mangle` as it is a C symbol
|
||||
#[no_mangle]
|
||||
pub fn libafl_main() {
|
||||
pub extern "C" fn libafl_main() {
|
||||
// Registry the metadata types used in this fuzzer
|
||||
// Needed only on no_std
|
||||
//RegistryBuilder::register::<Tokens>();
|
||||
|
@ -129,7 +129,7 @@ struct Opt {
|
||||
|
||||
/// The main fn, `no_mangle` as it is a C symbol
|
||||
#[no_mangle]
|
||||
pub fn libafl_main() {
|
||||
pub extern "C" fn libafl_main() {
|
||||
// Registry the metadata types used in this fuzzer
|
||||
// Needed only on no_std
|
||||
//RegistryBuilder::register::<Tokens>();
|
||||
|
@ -32,7 +32,7 @@ extern "C" {
|
||||
|
||||
/// The main fn, `no_mangle` as it is a C symbol
|
||||
#[no_mangle]
|
||||
pub fn libafl_main() {
|
||||
pub extern "C" fn libafl_main() {
|
||||
// Registry the metadata types used in this fuzzer
|
||||
// Needed only on no_std
|
||||
//RegistryBuilder::register::<Tokens>();
|
||||
|
@ -27,7 +27,7 @@ use libafl::{
|
||||
};
|
||||
use libafl_targets::{libfuzzer_initialize, libfuzzer_test_one_input, std_edges_map_observer};
|
||||
#[no_mangle]
|
||||
pub fn libafl_main() {
|
||||
pub extern "C" fn libafl_main() {
|
||||
println!(
|
||||
"Workdir: {:?}",
|
||||
env::current_dir().unwrap().to_string_lossy().to_string()
|
||||
|
@ -100,7 +100,7 @@ struct Opt {
|
||||
|
||||
/// The main fn, `no_mangle` as it is a C symbol
|
||||
#[no_mangle]
|
||||
pub fn libafl_main() {
|
||||
pub extern "C" fn libafl_main() {
|
||||
// Registry the metadata types used in this fuzzer
|
||||
// Needed only on no_std
|
||||
//RegistryBuilder::register::<Tokens>();
|
||||
|
@ -36,7 +36,7 @@ use metadata::*;
|
||||
/// The main fn, `no_mangle` as it is a C main
|
||||
#[cfg(not(test))]
|
||||
#[no_mangle]
|
||||
pub fn libafl_main() {
|
||||
pub extern "C" fn libafl_main() {
|
||||
// Registry the metadata types used in this fuzzer
|
||||
// Needed only on no_std
|
||||
//RegistryBuilder::register::<Tokens>();
|
||||
|
Loading…
x
Reference in New Issue
Block a user