diff options
| author | Jouni Hogander <jouni.hogander@unikie.com> | 2020-04-12 11:24:12 +0300 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2020-07-02 09:32:57 +0200 |
| commit | f8885dc4ce82fa10a22671a0b33dc1ee34cde388 (patch) | |
| tree | 9388ceab872735895cabf519cb1d5e919807c9d1 /pkg/vcs/testdata/linux | |
| parent | d42301aa2fcaa64823b3ece21f2a9c83335471f5 (diff) | |
pkg/bisect: Implement config bisection
Implement Linux kernel configuration bisection. Use bisected minimalistic
configuration in commit bisection. Utilizes config_bisect.pl script from Linux
kernel tree in bisection.
Modify syz-bisect to read in kernel.baseline_config. This is used as a "good"
configuration when bisection is run.
Diffstat (limited to 'pkg/vcs/testdata/linux')
| -rwxr-xr-x | pkg/vcs/testdata/linux/config-bisect.pl | 53 | ||||
| -rwxr-xr-x | pkg/vcs/testdata/linux/merge_config.sh | 11 |
2 files changed, 64 insertions, 0 deletions
diff --git a/pkg/vcs/testdata/linux/config-bisect.pl b/pkg/vcs/testdata/linux/config-bisect.pl new file mode 100755 index 000000000..5cecb8b6d --- /dev/null +++ b/pkg/vcs/testdata/linux/config-bisect.pl @@ -0,0 +1,53 @@ +#!/bin/bash +# Copyright 2020 syzkaller project authors. All rights reserved. +# Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. +# config-bisect.pl -l ctx.git.dir -r -b ctx.git.dir kernelBaselineConfig kernelConfig + +if [ "$3" == "-r" ] +then + baseline=`cat $6` + outdir=$5 + echo $baseline > $outdir/.config + exit 0 +fi + +# config-bisect.pl -l ctx.git.dir -b ctx.git.dir kernelBaselineConfig kernelConfig verdict +baseline=`cat $5` + +# Test baseline file contains string CONFIG_FAILING -> fail +if [ "$baseline" == "CONFIG_FAILING=y" ] +then + exit 1 +fi + +# Generate end results which "reproduces" the crash +if [ $baseline == "CONFIG_REPRODUCES_CRASH=y" ] +then + echo "%%%%%%%% FAILED TO FIND SINGLE BAD CONFIG %%%%%%%%" + echo "Hmm, can't make any more changes without making good == bad?" + echo "Difference between good (+) and bad (-)" + echo "REPRODUCES_CRASH n -> y" + echo "-DISABLED_OPTION=n" + echo "+ONLY_IN_ORIGINAL_OPTION=y" + echo "See good and bad configs for details:" + echo "good: /mnt/work/config_bisect_evaluation/out/config_bisect/kernel.baseline_config.tmp" + echo "bad: /mnt/work/config_bisect_evaluation/out/config_bisect/kernel.config.tmp" + echo "%%%%%%%% FAILED TO FIND SINGLE BAD CONFIG %%%%%%%%" + exit 2 +fi + +# Generate end result which doesn't "reproduce" the crash +if [ $baseline == "CONFIG_NOT_REPRODUCE_CRASH=y" ] +then + echo "%%%%%%%% FAILED TO FIND SINGLE BAD CONFIG %%%%%%%%" + echo "Hmm, can't make any more changes without making good == bad?" + echo "Difference between good (+) and bad (-)" + echo "NOT_REPRODUCE_CRASH n -> y" + echo "See good and bad configs for details:" + echo "good: /mnt/work/config_bisect_evaluation/out/config_bisect/kernel.baseline_config.tmp" + echo "bad: /mnt/work/config_bisect_evaluation/out/config_bisect/kernel.config.tmp" + echo "%%%%%%%% FAILED TO FIND SINGLE BAD CONFIG %%%%%%%%" + exit 2 +fi + + diff --git a/pkg/vcs/testdata/linux/merge_config.sh b/pkg/vcs/testdata/linux/merge_config.sh new file mode 100755 index 000000000..1ab10d379 --- /dev/null +++ b/pkg/vcs/testdata/linux/merge_config.sh @@ -0,0 +1,11 @@ +#!/bin/bash +# Copyright 2020 syzkaller project authors. All rights reserved. +# Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. + +# merge_config.sh -m -O outdir baseline kernelAdditionsConfig +OUTDIR=$3 + +echo `cat $4` > $OUTDIR/.config +echo `cat $5` >> $OUTDIR/.config + +exit 0 |
