aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/vcs/linux.go
diff options
context:
space:
mode:
authorSimone Weiß <simone.weiss@elektrobit.com>2024-03-04 20:00:40 +0100
committerAleksandr Nogikh <nogikh@google.com>2024-03-18 10:58:57 +0000
commitee397bf91e9742f2d410282306456afde4efea02 (patch)
treeaa665d2c0572d4d2a30ca69697c561fd56ab0cd4 /pkg/vcs/linux.go
parentfc090d205d8c3d58f190659a98795d89421b7e6b (diff)
pkg/bisect: make bisection more robust
Bisection should not fail if the Kconfig or the baseline config have issues. Broken kernel sources might lead to issues when parsing Kconfig, ignore this and proceed with the original config. If the baseline config is not parseable, proceed anyway as this is an optional parameter to begin with.
Diffstat (limited to 'pkg/vcs/linux.go')
-rw-r--r--pkg/vcs/linux.go9
1 files changed, 7 insertions, 2 deletions
diff --git a/pkg/vcs/linux.go b/pkg/vcs/linux.go
index 98ae07cda..d5a4d138c 100644
--- a/pkg/vcs/linux.go
+++ b/pkg/vcs/linux.go
@@ -5,6 +5,7 @@ package vcs
import (
"bytes"
+ "errors"
"fmt"
"net/mail"
"path/filepath"
@@ -274,6 +275,8 @@ func ParseMaintainersLinux(text []byte) Recipients {
return mtrs
}
+var ErrBadKconfig = errors.New("failed to parse Kconfig")
+
const configBisectTag = "# Minimized by syzkaller"
// Minimize() attempts to drop Linux kernel configs that are unnecessary(*) for bug reproduction.
@@ -289,7 +292,7 @@ func (ctx *linux) Minimize(target *targets.Target, original, baseline []byte, ty
}
kconf, err := kconfig.Parse(target, filepath.Join(ctx.git.dir, "Kconfig"))
if err != nil {
- return nil, fmt.Errorf("failed to parse Kconfig: %w", err)
+ return nil, fmt.Errorf("%w: %w", ErrBadKconfig, err)
}
config, err := kconfig.ParseConfigData(original, "original")
if err != nil {
@@ -324,8 +327,10 @@ func (ctx *linux) Minimize(target *targets.Target, original, baseline []byte, ty
}
if len(baseline) > 0 {
baselineConfig, err := kconfig.ParseConfigData(baseline, "baseline")
+ // If we fail to parse the baseline config proceed with original one as baseline config
+ // is an optional parameter.
if err != nil {
- return nil, err
+ return nil, fmt.Errorf("%w: %w", ErrBadKconfig, err)
}
err = minimizeCtx.minimizeAgainst(baselineConfig)
if err != nil {