fix: Change all static variables to thread when fuzzing#1867
fix: Change all static variables to thread when fuzzing#1867hathach merged 3 commits intohathach:masterfrom
Conversation
hathach
left a comment
There was a problem hiding this comment.
thank you very much for your PR and sorry for the delay, I was too busy with other paid works. I back off a bit on using TU_STATIC, instead I would prefer to add _fuzz_thread as additional keyword. Even though it is a bit more verbose, the static keyword is more apparent to other user and easier to read.
I also rename macro FUZZ to _FUZZ to avoid if user application define it in the future .
Note: we could change _fuzz_thread to less verbose word in the future if you have any other suggestion. For now, I think this is good for merge
|
Personally I prefer to use For most people who doesn't use fuzzing it's confusing what this keyword does, and I feel also the code is less neat putting a test keyword inside the stack. For anyone who contribute they also need to learn what fuzzer does instead of copy |
|
_fuzz_thread is |
Make one of the messages more accurate, in the event that the user changes `PICO_DEFAULT_RP2350_PLATFORM`
Describe the PR
Currently the AFL fuzzing engine makes the assumption that it can run a library in multiple threads without any shared state. To make this assumption consistent with tinyusb we need to make static globals thread local when fuzzing.
Additional context
Discussed here:
#1715 (comment)
Actual issue here (see stability)
https://oss-fuzz.com/fuzzer-stats?project=tinyusb&fuzzer=afl&job=afl_asan_tinyusb&group_by=by-fuzzer