This is an archive of the discontinued LLVM Phabricator instance.

[Bitcode] Add fuzzer for bitcode reading
ClosedPublic

Authored by nikic on Feb 4 2022, 7:46 AM.

Details

Reviewers
dblaikie
Summary

Inspired by the discussion on D118694, this adds a straightforward fuzzer for bitcode reading.

Diff Detail

Event Timeline

nikic created this revision.Feb 4 2022, 7:46 AM
nikic requested review of this revision.Feb 4 2022, 7:46 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 4 2022, 7:46 AM
nikic added a comment.Feb 4 2022, 8:37 AM

After fixing some issues in the bitstream reader to report errors using the right mechanism, this now quickly runs into OOM, because we do unconditional vector reservations. Can be fixed (a standard approach is to reject reservations larger than the input size for example), just not sure if making bitcode parsing more resilient is something I should invest time in.

If we check this in, does it start failing buildbots or anything if it's not clean? Do we have to address the OOMs for this to be clean, or are OOMs not considered failures by any buildbots/don't produce failmail?

nikic added a comment.Feb 4 2022, 11:21 AM

If we check this in, does it start failing buildbots or anything if it's not clean? Do we have to address the OOMs for this to be clean, or are OOMs not considered failures by any buildbots/don't produce failmail?

Nothing should use the fuzzer by default, it needs to be added to oss-fuzz to run. So just adding it is not problematic.

dblaikie accepted this revision.Feb 4 2022, 12:28 PM

If we check this in, does it start failing buildbots or anything if it's not clean? Do we have to address the OOMs for this to be clean, or are OOMs not considered failures by any buildbots/don't produce failmail?

Nothing should use the fuzzer by default, it needs to be added to oss-fuzz to run. So just adding it is not problematic.

Hmm, seems unfortunate to checkin dead code, though? But I guess if this is the normal way fuzzers are added/adopted/eventually integrated into oss-fuzz, fair enough.

This revision is now accepted and ready to land.Feb 4 2022, 12:28 PM