This is an archive of the discontinued Mercurial Phabricator instance.

fuzz: new fuzzer for cext/manifest.c
ClosedPublic

Authored by durin42 on Oct 4 2018, 11:23 AM.

Details

Summary

This is a bit messy, because lazymanifest is tightly coupled to the
cpython API for performance reasons. As a result, we have to build a
whole Python without pymalloc (so ASAN can help us out) and link
against that. Then we have to use an embedded Python interpreter. We
could manually drive the lazymanifest in C from that point, but
experimentally just using PyEval_EvalCode isn't really any slower so
we may as well do that and write the innermost guts of the fuzzer in
Python.

Leak detection is currently disabled for this fuzzer because there are
a few global-lifetime things in our extensions that we more or less
intentionally leak and I didn't want to take the detour to work around
that for now.

This should not be pushed to our repo until
https://github.com/google/oss-fuzz/pull/1853 is merged, as this
depends on having the Python tarball around.

Diff Detail

Repository
rHG Mercurial
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

durin42 created this revision.Oct 4 2018, 11:23 AM
indygreg accepted this revision.Oct 4 2018, 2:19 PM
indygreg added a subscriber: indygreg.
indygreg added inline comments.
contrib/fuzz/Makefile
75

As a follow-up, we may want to add "-j nproc" to the make invocations so this uses all available CPU cores to build.

This revision is now accepted and ready to land.Oct 4 2018, 2:19 PM
This revision was automatically updated to reflect the committed changes.
yuja added a subscriber: yuja.Oct 5 2018, 8:15 AM

I did clang-format -i over this patch to fix test failure.