diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2026-01-02 17:10:21 +0100 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2026-01-09 12:51:45 +0000 |
| commit | 4b9e0bf8cad5aba3bbba29c7abd9fb1b643eea02 (patch) | |
| tree | af3aba7be289043cfbd8602fdfd7ce4d7cf57187 /pkg/aflow/flow/patching/base_commit.go | |
| parent | 963dd62f086e3885f11dd3700ef3cc56df2659e2 (diff) | |
pkg/aflow/flow/patching: add bug fix patching workflow
Diffstat (limited to 'pkg/aflow/flow/patching/base_commit.go')
| -rw-r--r-- | pkg/aflow/flow/patching/base_commit.go | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/pkg/aflow/flow/patching/base_commit.go b/pkg/aflow/flow/patching/base_commit.go new file mode 100644 index 000000000..f49aba3d6 --- /dev/null +++ b/pkg/aflow/flow/patching/base_commit.go @@ -0,0 +1,57 @@ +// Copyright 2025 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. + +package patching + +import ( + "github.com/google/syzkaller/pkg/aflow" + "github.com/google/syzkaller/pkg/aflow/action/kernel" + "github.com/google/syzkaller/pkg/vcs" +) + +var baseCommitPicker = aflow.NewFuncAction("base-commit-picker", pickBaseCommit) + +type baseCommitArgs struct { + // Can be used to override the selected base commit (for manual testing). + FixedBaseCommit string +} + +type baseCommitResult struct { + KernelRepo string + KernelCommit string +} + +func pickBaseCommit(ctx *aflow.Context, args baseCommitArgs) (baseCommitResult, error) { + // Currently we use the latest RC of the mainline tree as the base. + // This is a reasonable choice overall in lots of cases, and it enables good caching + // of all artifacts (we need to rebuild them only approx every week). + // Potentially we can use subsystem trees for few important, well-maintained subsystems + // (mm, net, etc). However, it will work poorly for all subsystems. First, there is no + // machine-usable mapping of subsystems to repo/branch; second, lots of them are poorly + // maintained (can be much older than latest RC); third, it will make artifact caching + // much worse. + // In the future we ought to support automated rebasing of patches to requested trees/commits. + // We need it anyway, but it will also alleviate imperfect base commit picking. + const ( + baseRepo = "git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git" + baseBranch = "master" + ) + + res := baseCommitResult{ + KernelRepo: baseRepo, + KernelCommit: args.FixedBaseCommit, + } + if args.FixedBaseCommit != "" { + return res, nil + } + + err := kernel.UseLinuxRepo(ctx, func(_ string, repo vcs.Repo) error { + head, err := repo.Poll(baseRepo, baseBranch) + if err != nil { + return err + } + res.KernelCommit, err = repo.ReleaseTag(head.Hash) + return err + }) + return res, err +} |
