Skip to content

Add randomized fuzzer selection to Fuchsia runs.#471

Merged
oliverchang merged 20 commits into
google:masterfrom
flowerhack:int-build-manager2
May 27, 2019
Merged

Add randomized fuzzer selection to Fuchsia runs.#471
oliverchang merged 20 commits into
google:masterfrom
flowerhack:int-build-manager2

Conversation

@flowerhack

Copy link
Copy Markdown
Contributor

Apologies for the length of the CL; I promise it's shorter than it looks
(though I can chop it up further).

Also apologies for the delay; there was a Fuchsia hack-it week, and some
instability/thrashing on the Fuchsia side of things.

This PR does the following:

  • Adds the fuchsia_utils directory, which contains a (hopefully) stable
    interface for working with Fuchsia. This includes logic for extracting
    Fuzzers from a Fuchsia build.

  • Moves the Fuchsia build logic into build_manager. While it's a very
    tiny class right now, and doesn't take much advantage of build_manager
    features, this should allow it to e.g. use the weighted random selection
    in future CLs, handle revision # logic more gracefully, etc.

  • Adds the ability to choose a fuzzer at random, and run it. (Left
    for a future CL is extracting the crash log from the device and placing
    it someplace useful, though writing the log should be handled
    automagically by our wrapper class.)

My only question is the license headers: I added the standard Google LLC
license header to the files we're yoinking from Fuchsia, but also left
the Fuchsia license header in place. I do not know whether we can just
merge these, if there's an elegant way to handle it, etc--I would've
just left the files totally intact, but the linter complained about the
header not looking right :) So yeah, let me know.

@googlebot googlebot added the cla: yes CLA signed. label May 21, 2019
@flowerhack

Copy link
Copy Markdown
Contributor Author

@oliverchang @nopsledder

@flowerhack

Copy link
Copy Markdown
Contributor Author

/gcbrun

1 similar comment
@flowerhack

Copy link
Copy Markdown
Contributor Author

/gcbrun

@oliverchang oliverchang left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Nice! some initial comments

Comment thread src/python/bot/fuzzers/libfuzzer.py
Comment thread src/python/bot/fuzzers/libfuzzer.py Outdated
self.host = Host.from_dir(
os.path.join(fuchsia_resources_dir, 'build', 'out', 'default'))
self.device = Device(self.host, 'localhost', fuchsia_portnum)
pkg, tgt = environment.get_value('FUZZ_TARGET').split('/')

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

s/pkg/package/ and s/tgt/target/

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Also, what's the format of "FUZZ_TARGET" ? I'm assuming package_name/binary_name ?

@inferno-chromium Seems like another case where we need to support / in a fuzz target name. Seems like we need to normalize the binary name too (and not just project).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yep, that's the expected format of FUZZ_TARGET.

Completed s/pkg/package/ and s/tgt/target/.

(Leaving comment open--I don't have context on the question of "supporting slashes in target names" but I assume @inferno-chromium may need to peek :) )

@@ -0,0 +1,13 @@
# Copyright 2019 Google LLC

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

For discussion:

It seems better to include these scripts with the build, rather than copying them to CF as-is since the Fuchsia SDK is unstable. That way, for each build we should be guaranteed to have a set of scripts that work. This is important for regression task etc where we do bisects.

We're also in the midst of doing PY2->PY3, and copying things here may complicate things. Do these scripts work with PY3 already?

If we go with that, we also can't import the scripts as-is, because importing is fairly permanent and we shouldn't try to reimport if we set up a build for another revision. We may need something like a stable CLI interface here for the necessary functionality.

@flowerhack flowerhack May 22, 2019

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Discussed during meeting today.

Consensus seems to be:

  • we're hard-forking these scripts from Fuchsia, feel free to request changes s.t. they meet ClusterFuzz's style guide

  • we agreed that the Fuchsia team will be responsible for validating that "whatever is placed in the build bucket" is run-able via these scripts

  • we accept the risk that, should we need to change/modify these scripts (which we're hoping is rather unlikely!), performing bisects for older builds will become either impossible or require a cumbersome hack

Finally, I think these scripts work with Python 3, but I'm not sure how to test such a thing. Guidance would be very appreciated! :D

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

we accept the risk that, should we need to change/modify these scripts (which we're hoping is rather unlikely!), performing bisects for older builds will become either impossible or require a cumbersome hack

We also brought up the idea of having a minimal "input pusher" utility with every build for this purpose, since that's the part that is most likely to change. Did we reach a decision on whether or not to do this? @nopsledder

@flowerhack

Copy link
Copy Markdown
Contributor Author

/gcbrun

Apologies for the length of the CL; I promise it's shorter than it looks
(though I can chop it up further).

Also apologies for the delay; there was a Fuchsia hack-it week, and some
instability/thrashing on the Fuchsia side of things.

This PR does the following:

* Adds the fuchsia_utils directory, which contains a (hopefully) stable
interface for working with Fuchsia. This includes logic for extracting
Fuzzers from a Fuchsia build.

* Moves the Fuchsia build logic into build_manager.  While it's a very
tiny class right now, and doesn't take much advantage of build_manager
features, this should allow it to e.g. use the weighted random selection
in future CLs, handle revision # logic more gracefully, etc.

* Adds the ability to *choose* a fuzzer at random, and run it.  (Left
for a future CL is extracting the crash log from the device and placing
it someplace useful, though *writing* the log should be handled
automagically by our wrapper class.)

My only question is the license headers: I added the standard Google LLC
license header to the files we're yoinking from Fuchsia, but *also* left
the Fuchsia license header in place.  I do not know whether we can just
merge these, if there's an elegant way to handle it, etc--I would've
just left the files totally intact, but the linter complained about the
header not looking right :)  So yeah, let me know.
@flowerhack flowerhack force-pushed the int-build-manager2 branch from 5824cee to 53d482a Compare May 22, 2019 00:00
@flowerhack

Copy link
Copy Markdown
Contributor Author

/gcbrun

@flowerhack

Copy link
Copy Markdown
Contributor Author

/gcbrun

@oliverchang oliverchang left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

nice! sorry for the delay, but here some additional comments.

Comment thread src/python/bot/fuzzers/libfuzzer.py Outdated
Comment thread src/python/build_management/build_manager.py Outdated
Comment thread src/python/build_management/build_manager.py Outdated
Comment thread src/python/build_management/build_manager.py
Comment thread src/python/build_management/build_manager.py
Comment thread src/python/build_management/build_manager.py Outdated
Comment thread src/python/tests/core/build_management/build_manager_test.py Outdated
@flowerhack

Copy link
Copy Markdown
Contributor Author

/gcbrun

@inferno-chromium

Copy link
Copy Markdown
Collaborator

/gcbrun

@oliverchang oliverchang left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looking great! Thanks for addressing all the comments.

Comment thread src/python/tests/core/build_management/build_manager_test.py Outdated
Comment thread src/python/bot/fuzzers/libfuzzer.py
@flowerhack

Copy link
Copy Markdown
Contributor Author

/gcbrun

@flowerhack

Copy link
Copy Markdown
Contributor Author

/gcbrun

Comment thread src/python/platforms/fuchsia/device.py Outdated
@flowerhack

Copy link
Copy Markdown
Contributor Author

/gcbrun

Comment thread src/python/platforms/fuchsia/util/host.py Outdated
@flowerhack

Copy link
Copy Markdown
Contributor Author

/gcbrun

@flowerhack

Copy link
Copy Markdown
Contributor Author

/gcbrun

@oliverchang

Copy link
Copy Markdown
Collaborator

Everything seems to work on App Engine, merging.

@oliverchang oliverchang merged commit df8a187 into google:master May 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla: yes CLA signed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants