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

[Fuzz] Show fuzzy-stack-hash for crashes in debug build. #1099

Closed
wants to merge 1 commit into from

Conversation

NikLeberg
Copy link
Contributor

Hi there,

this is something that helped me to quickly see if different reproducers result in the same crash. Source of the idea is: https://argp.github.io/2014/12/29/fuzzy-stack-hash/

Basically the symbol names of the N last stack frames of the backtrace are hashed. Usually for crashes the text Please report this bug is shown. For debug builds this text is omitted. This PR would add the output of a crash hash in the following form for debug builds:

<other stack frames>
[0x565027925c4a] ../src/nvc.c:2193 process_command
       case 'a':
-->       return analyse(argc, argv, state);
       case 'e':
[0x56502792618d] ../src/nvc.c:2355 main
-->    const int ret = process_command(argc, argv, &state);

Crash hash: 79505df7

Please feel no obligation to merge this. I simply wanted to offer it. If you deem it useful, you are of course more than welcome to merge it.

Cheers

Copy link
Owner

@nickg nickg left a comment

Choose a reason for hiding this comment

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

I'm ok with this but I'm a bit nervous that moving the hashing code to util.c means it won't be inlined into ident_new, etc. any more (I haven't checked whether LTO does this or not). Since it's only a few lines of code I'd rather just copy and paste it into debug_hash directly.

src/util.c Show resolved Hide resolved
src/debug.h Outdated Show resolved Hide resolved
@NikLeberg
Copy link
Contributor Author

Can this be #ifdef FUZZER_IS_ENABLED or something like that?

I don't want to pollute your codebase with fuzzing-only code. If we are gonna hide the crash hash behind a fuzzing specific flag, then I can also just put this feature as a manual patch file in NikLeberg/nvc-fuzz.

I'll close this for now.

BTW, if you put -Winline, then GCC will warn about functions marked with inline that it did not inline. If I do that, then it warns, that e.g. p_expression, lvn_can_fold or split_nexus cannot be inlined. There are also others that were not inlined.

@NikLeberg NikLeberg closed this Dec 16, 2024
@NikLeberg NikLeberg deleted the crash_hash branch December 16, 2024 23:30
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