google / syzkaller

syzkaller is an unsupervised coverage-guided kernel fuzzer
Apache License 2.0
5.4k stars 1.23k forks source link

pkg/bisect: rollback the guilty commit and test #4373

Open a-nogikh opened 12 months ago

a-nogikh commented 12 months ago

Suggested by Pengfei Xu. It was also mentioned during LPC'23.

After completing a bisection, we can rollback the guilty commit and test the kernel again to double-check the correctness of our conclusions.

For cause bisections (also applies for fix bisections with corresponding changes):

Open question is at what base to revert the commit:

dvyukov commented 12 months ago

Take the kernel at the identified revision and revert it.

We already done this check during bisection.

Reverting at HEAD may give some additional info, but not sure if it will be useful. Kernel commits are not reverted often. We also don't know the tree maintainer is interested in, e.g. maintainer may consider reverting on sound tree, but we tested on usb. Or it may not revert cleanly, or trap on another bug, or the automatic revert may introduce a new bug.

a-nogikh commented 11 months ago

We already done this check during bisection.

You mean in detectNoopChange()? We compare kernel signatures, but we don't run the reproducer.

dvyukov commented 11 months ago

I mean the bisection itself. It's literally what bisection is checking: the bug happens on the resulting commit, but not on the previous one (which is effectively reverting the guilty commit).

a-nogikh commented 11 months ago

It's literally what bisection is checking: the bug happens on the resulting commit

Yes, but it's only true assuming that we were able to give a 100% correct answer at every bisection step, which is not always the case.

dvyukov commented 11 months ago

I assumed bisection cannot point to a commit w/o testing on that commit with positive results and testing on the previous one with negative result, regardless of results on all previous steps. And that's effectively testing a revert. In all other cases bisection points to multiple commits, which we don't report.

a-nogikh commented 11 months ago

Hmm, indeed! Thanks.

a-nogikh commented 2 months ago

I assumed bisection cannot point to a commit w/o testing on that commit with positive results and testing on the previous one with negative result, regardless of results on all previous steps.

On second thought, I'm actually not quite sure that it's working that way. Bisections on a DAG are of course more tricky, but say in case of an ordinary bisection on some linear sequence of items, we are assumed to have ensured the verdicts of the first and the last elements before starting the process. The bisection reduces that range on every step, still assuming that the range covers the element after which the verdict changes from true to false (or vice versa).

If we made a mistake on any single step, we may switch to a range of elements that already do not cover the element we're looking for. But the algorithm still thinks it's there, so e.g. if all of the following verdicts are false, then the result would just be the last element of the range. From the algorithm's perspective, it makes no sense to retest whether it's really the guilty commit -- it was the invariant it relied on all along the way.

So re-checking the result may actually make sense with our not 100% reliable verdicts.