Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow failed afl mapping to allow non-forkserver usage #3087

Draft
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

wtdcode
Copy link
Contributor

@wtdcode wtdcode commented Mar 18, 2025

Description

Current implementation blocks "non-forkserver" usage due to exit(1) immediately. This PR fixes it.

Common usages include building binaries for both fuzzing and replaying crashes. My usage is rewriting unicornafl to rust.

Checklist

  • I have run ./scripts/precommit.sh and addressed all comments

///
/// # Note
///
/// The function's logic is written in C and this code is a wrapper.
pub fn map_shared_memory() {
pub fn map_shared_memory() -> u8 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add

let ret = unsafe {__afl_map_shm()};
if ret == 0 {
 log::info!("running fuzzer in replay mode");
}

or any log you want

@tokatoka
Copy link
Member

wait but you sure this really works?
won't __afl_area_ptr point to nothing without shmem setup?

@tokatoka
Copy link
Member

Or it simply points to a global array by default? in that case yeah it works.

@wtdcode
Copy link
Contributor Author

wtdcode commented Mar 18, 2025

Or it simply points to a global array by default? in that case yeah it works.

Oh sorry, I should set the PR as draft.

I expect everything to get merged once I port-ed unicornafl to rust.

@wtdcode wtdcode marked this pull request as draft March 18, 2025 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants