-
-
Notifications
You must be signed in to change notification settings - Fork 358
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
Update forkserver.rs #3138
base: main
Are you sure you want to change the base?
Update forkserver.rs #3138
Conversation
We're adding these comments in strategic spots where they'll be most useful - mainly at the public API boundaries like struct and function definitions. The style is concise but informative, focusing on explaining what each component does and how to use it properly.
can you run fmt and clippy? then it's good |
//! the program from scratch. | ||
//! | ||
//! Key features: | ||
//! - Support for LibAFL (libafl_cc/libafl_cxx) instrumented binaries |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
... if they use the [whatever its name was] feature
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wdym exactly? :)
/// * `Result<(), Error>` - Always returns `Err` with a descriptive error message | ||
/// that explains the failure and suggests possible solutions | ||
/// | ||
/// # Error Codes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does not return error codes but instead a string.
(Should these errors really return Error::unknown
, though? Probably that should be more precise)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could:
- Error::configuration() for map size issues
- Error::compilation() for code compilation-related errors
- Error::system() for system call failures
- Error::version() for version incompatibility issues
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
libafl/src/executors/forkserver.rs
Outdated
/// | ||
/// Shared memory feature is also available, but you have to set things up in your code. | ||
/// Please refer to AFL++'s docs. <https://github.com/AFLplusplus/AFLplusplus/blob/stable/instrumentation/README.persistent_mode.md> | ||
/// # Type Parameters |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think if we start documenting type parameters, they will eventually be refactored and forgotten.
Instead we should document common letters for things in a common place, and drop it from this function.
libafl/src/executors/forkserver.rs
Outdated
@@ -769,7 +840,17 @@ where | |||
} | |||
} | |||
|
|||
/// The builder for `ForkserverExecutor` | |||
/// Builder for `ForkserverExecutor` with a fluent interface for configuration |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you could write
[`ForkserverExecutor`]
with brackets
libafl/src/executors/forkserver.rs
Outdated
/// The builder for `ForkserverExecutor` | ||
/// Builder for `ForkserverExecutor` with a fluent interface for configuration | ||
/// | ||
/// Provides methods to customize all aspects of forkserver execution: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
forkserver instantiation
We're adding these comments in strategic spots where they'll be most useful - mainly at the public API boundaries like struct and function definitions. The style is concise but informative, focusing on explaining what each component does and how to use it properly.
I'm targeting places where a good comment saves users from having to dig through implementation details. The triple-slash style (///) ensures these show up in the generated documentation, making the library more approachable for new users.
The goal is to strike a balance - enough detail to be helpful without becoming overwhelming. Comments that focus on "why" and "how" tend to be more valuable than those that just restate what the code is doing.