Skip to content

Conversation

rmalmain
Copy link
Member

@rmalmain rmalmain commented Jan 2, 2025

it does not support all API calls yet, but now it should be easy to add remaining ones by following the same pattern.
minimal linux kernel example runs locally.

@@ -5,6 +5,7 @@ authors = ["Romain Malmain <[email protected]>"]
edition = "2021"

[features]
nyx = []
Copy link
Member

Choose a reason for hiding this comment

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

Time to add some comments here to explain the features? We're using this for the other crates.

Specifically, I would explain that this adds API compatibility but isn't doing the same as nyx

Copy link
Member Author

Choose a reason for hiding this comment

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

makes sense, didn't know about this crate.

Copy link
Member Author

Choose a reason for hiding this comment

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

maybe we should put the precision in the nyx module doc then, this feature is only for the example fuzzer.

/// Fast hash function for 64 bits integers minimizing collisions.
/// Adapted from <https://xorshift.di.unimi.it/splitmix64.c>
#[must_use]
pub fn hash_me(mut x: u64) -> u64 {
Copy link
Member

Choose a reason for hiding this comment

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

I would either use the hashing function from libafl_bolts here, or move this guy to bolts

Copy link
Member Author

Choose a reason for hiding this comment

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

i checked quickly the xxh implementation, i think they have better hashing properties but require more ops.
we use it for some performance-critical things, i'd prefer to keep it as-is for now before we can do proper benchmarking. i can add it to bolts if it makes more sense as a faster alternative to std.

Copy link
Member

Choose a reason for hiding this comment

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

I don't get why you want to hash a 64 bit value to a 64 bit variable anyway? Isn't the best hash ... the value itself? It's a perfect 1:1 mapping :D

Copy link
Member Author

Choose a reason for hiding this comment

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

because the 64 bit values in the input space are usually very close to each other, which means they are more likely to collide than hashed (unbiased) values in the bitmap.
i didn't measure this precisely, though.

@rmalmain rmalmain changed the title Nyx API support for LibAFL QEMU Nyx hypercall API support for LibAFL QEMU Jan 6, 2025
@rmalmain rmalmain merged commit 17336dc into main Jan 6, 2025
102 of 103 checks passed
@rmalmain rmalmain deleted the nyx_api branch January 6, 2025 15:58
mzfr pushed a commit to mzfr/LibAFL that referenced this pull request Jan 19, 2025
* Nyx hypercall API support

* fix linux kernel fuzzer

* hash_me -> hash_64_fast

* fix multiple bug in kernel harness

* do not check libmozjpeg's C files format.
Comment on lines +35 to +36
#[cfg(any(cpu_target = "i386", cpu_target = "x86_64"))]
pub mod nyx;
Copy link
Contributor

Choose a reason for hiding this comment

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

Hello, can we have a proper feature for this?

Copy link
Member Author

Choose a reason for hiding this comment

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

yes, it's already implemented in #3366. btw, it's better to open a new issue than comment on a closed pr. it's not really easy to notice the new comments otherwise

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.

3 participants