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

Use external, custom time function for no_std environments #281

Merged
merged 3 commits into from
Sep 6, 2021

Conversation

bitwave
Copy link
Collaborator

@bitwave bitwave commented Aug 27, 2021

Added the possibility to create a custom current_millis function for no_std environments (e.g. custom OS, microcontroller, etc.)

@domenukk
Copy link
Member

The no_std build now needs a default implementation (for [cfg(unix)] we can use libc, for the rest - probably just return 1 all the time, or a global variable that counts up on each call?)
Similarly, the no_std testcases need... some solution. Hard code 1?

@bitwave
Copy link
Collaborator Author

bitwave commented Aug 28, 2021

Similar to this code, we can use an external fn:

    time::Duration::from_millis(1)

@bitwave
Copy link
Collaborator Author

bitwave commented Aug 28, 2021

Can you list me the points where this needs to be implemented?

@domenukk
Copy link
Member

Likely we need one inside a #[cfg(test)] in libafl, plus another one in the no_std testcase.
Btw. we could consider a more self-explanotary function name, like current_millis_no_std or something? Maybe @andreafioraldi has an opinion here

@bitwave
Copy link
Collaborator Author

bitwave commented Aug 29, 2021

Additionally we should provide documentation in docs/ folder how to do this?

@domenukk
Copy link
Member

A .md file about using libafl in no_std environments would be awesome!

@domenukk domenukk merged commit e7ed5be into AFLplusplus:main Sep 6, 2021
@bitwave bitwave deleted the fix-no-std-time branch September 16, 2021 11:56
khang06 pushed a commit to khang06/LibAFL that referenced this pull request Oct 11, 2022
…us#281)

* Use external, custom time function for no_std environments

* fixup! Use external, custom time function for no_std environments

* fixup! Use external, custom time function for no_std environments
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.

None yet

2 participants