aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/aflow/flow/patching
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2026-01-28 17:26:58 +0100
committerDmitry Vyukov <dvyukov@google.com>2026-01-29 08:30:11 +0000
commit91694b98010e509dc770dc9cd3ff04c9724eab92 (patch)
tree64bb04c0dd9e804ce1a8ce54a833f4c858cd86b3 /pkg/aflow/flow/patching
parentb78a7341979245ec72840af68695cb23b98dc2cb (diff)
pkg/aflow/flow/patching: find maintainers for patches
Provide base kernel repo/commit and recipients (to/cc) for patches.
Diffstat (limited to 'pkg/aflow/flow/patching')
-rw-r--r--pkg/aflow/flow/patching/actions.go (renamed from pkg/aflow/flow/patching/base_commit.go)38
-rw-r--r--pkg/aflow/flow/patching/patching.go11
2 files changed, 49 insertions, 0 deletions
diff --git a/pkg/aflow/flow/patching/base_commit.go b/pkg/aflow/flow/patching/actions.go
index 9ae848aec..162de4de9 100644
--- a/pkg/aflow/flow/patching/base_commit.go
+++ b/pkg/aflow/flow/patching/actions.go
@@ -4,8 +4,14 @@
package patching
import (
+ "os/exec"
+ "path/filepath"
+ "strings"
+ "time"
+
"github.com/google/syzkaller/pkg/aflow"
"github.com/google/syzkaller/pkg/aflow/action/kernel"
+ "github.com/google/syzkaller/pkg/osutil"
"github.com/google/syzkaller/pkg/vcs"
)
@@ -59,3 +65,35 @@ func pickBaseCommit(ctx *aflow.Context, args baseCommitArgs) (baseCommitResult,
})
return res, err
}
+
+var getMaintainers = aflow.NewFuncAction("get-maintainers", maintainers)
+
+type maintainersArgs struct {
+ KernelSrc string
+ PatchDiff string
+}
+
+type maintainersResult struct {
+ Recipients []Recipient
+}
+
+func maintainers(ctx *aflow.Context, args maintainersArgs) (maintainersResult, error) {
+ res := maintainersResult{}
+ // See #1441 re --git-min-percent.
+ script := filepath.Join(args.KernelSrc, "scripts/get_maintainer.pl")
+ cmd := exec.Command(script, "--git-min-percent=15")
+ cmd.Dir = args.KernelSrc
+ cmd.Stdin = strings.NewReader(args.PatchDiff)
+ output, err := osutil.Run(time.Minute, cmd)
+ if err != nil {
+ return res, err
+ }
+ for _, recipient := range vcs.ParseMaintainersLinux(output) {
+ res.Recipients = append(res.Recipients, Recipient{
+ Name: recipient.Address.Name,
+ Email: recipient.Address.Address,
+ To: recipient.Type == vcs.To,
+ })
+ }
+ return res, nil
+}
diff --git a/pkg/aflow/flow/patching/patching.go b/pkg/aflow/flow/patching/patching.go
index cacbba9b5..9ec36ec3f 100644
--- a/pkg/aflow/flow/patching/patching.go
+++ b/pkg/aflow/flow/patching/patching.go
@@ -36,8 +36,18 @@ type Inputs struct {
}
type Outputs struct {
+ // Base repo/commit for the patch.
+ KernelRepo string
+ KernelCommit string
PatchDescription string
PatchDiff string
+ Recipients []Recipient
+}
+
+type Recipient struct {
+ Name string
+ Email string
+ To bool // whether the recipient should be on the To or Cc line
}
func init() {
@@ -80,6 +90,7 @@ func init() {
While: "TestError",
MaxIterations: 10,
},
+ getMaintainers,
&aflow.LLMAgent{
Name: "description-generator",
Model: aflow.BestExpensiveModel,