This is an archive of the discontinued LLVM Phabricator instance.

[libFuzzer] Don't use same seed for all parallel jobs
AbandonedPublic

Authored by vitalybuka on Mar 7 2017, 1:20 AM.

Details

Reviewers
kcc
Summary

If booth -seed and -jobs are set we could set deterministic but unique seed for
each jobs by combining input seed with a job number.

Event Timeline

vitalybuka created this revision.Mar 7 2017, 1:20 AM
kcc edited edge metadata.Mar 7 2017, 9:22 AM

rationale?

(BTW, I was going to delete this test, it's flaky and not very useful)

Rationlaly it exactly the same a for -seed. It's used to make execution deterministic (e.g. for debugging).
Currently it is deterministic, but -seed=1 and -jobs=24 pointlessly runs 24 exactly same fuzzers.

I don't care much about the test, I can undo this part, but

kcc added a comment.Mar 7 2017, 10:26 AM

You can not have deterministic execution with -jobs=N when running on the same corpus because the corpus is reloaded (i.e. you have concurrent execution).
If you want to run N deterministic executions in parallel, simply do a shell loop.

if you don't provide corpus, it's determenistic
i am using this just for benchmarks and just to look at coverage

vitalybuka added a comment.EditedMar 7 2017, 10:29 AM

Behavior with change makes more sense to me.
It's not something that make code complicated.

kcc added a comment.Mar 7 2017, 10:30 AM

imho this is a completely unnecessary complication.
To get what you need simply do this:

for((i=1;i<=20;i++)); do ./fuzz -seed=$i & done; wait

Then why do we need -jobs, it can be also emulated with some shell script

kcc added a comment.Mar 7 2017, 10:55 AM

it's not easy to emulate -jobs in a script, because -jobs=N works together with -workers=M and if N > M new jos start after some old die.

In D30684#694594, @kcc wrote:

it's not easy to emulate -jobs in a script, because -jobs=N works together with -workers=M and if N > M new jos start after some old die.

And user has to go this inconvenient way if jobs and seed both are desired.

I agree that
convenience(jobs+seed) < convenience(jobs)
complexity(jobs) < convenience(jobs)
but also
complexity(jobs+seed) < complexity(jobs)

It's still not clear to my why complexity(jobs+seed) > convenience(jobs+seed)

kcc added a comment.Mar 7 2017, 11:33 AM
In D30684#694594, @kcc wrote:

it's not easy to emulate -jobs in a script, because -jobs=N works together with -workers=M and if N > M new jos start after some old die.

And user has to go this inconvenient way if jobs and seed both are desired.

You are the first user to request this :)
And you are also not really a user, but a developer :)

I agree that
convenience(jobs+seed) < convenience(jobs)
complexity(jobs) < convenience(jobs)
but also
complexity(jobs+seed) < complexity(jobs)

It's still not clear to my why complexity(jobs+seed) > convenience(jobs+seed)

With you change, you will also need to document the non-intuitive behavior.
In all such cases it's easier to not have non-intuitive behavior

vitalybuka abandoned this revision.Apr 10 2017, 10:39 AM