aboutsummaryrefslogtreecommitdiffstats
path: root/syz-cluster/pkg
diff options
context:
space:
mode:
authorAleksandr Nogikh <nogikh@google.com>2025-07-16 12:03:55 +0200
committerAleksandr Nogikh <nogikh@google.com>2025-07-17 08:32:04 +0000
commit89164500ce728563dd5d65356180c49e63e885a9 (patch)
tree5e84f73d2c9f2c61d390e3919f43e2d7071697a5 /syz-cluster/pkg
parent1aa190bb0c108bacd9f30931abfd0ea1a7bca4b9 (diff)
syz-cluster: remember and share kernel tree URLs
Share not just the tree name (mainline, net, etc), but also the full URL to check out the repository. For that, add one more field to the Build entity and adjust email reporting templates.
Diffstat (limited to 'syz-cluster/pkg')
-rw-r--r--syz-cluster/pkg/api/api.go5
-rw-r--r--syz-cluster/pkg/controller/api_test.go6
-rw-r--r--syz-cluster/pkg/controller/testutil.go8
-rw-r--r--syz-cluster/pkg/db/entities.go4
-rw-r--r--syz-cluster/pkg/db/migrations/3_add_tree_url.down.sql1
-rw-r--r--syz-cluster/pkg/db/migrations/3_add_tree_url.up.sql2
-rw-r--r--syz-cluster/pkg/report/template.txt7
-rw-r--r--syz-cluster/pkg/report/testdata/1.in.json6
-rw-r--r--syz-cluster/pkg/report/testdata/1.moderation.txt6
-rw-r--r--syz-cluster/pkg/report/testdata/1.upstream.txt6
-rw-r--r--syz-cluster/pkg/report/testdata/2.in.json3
-rw-r--r--syz-cluster/pkg/report/testdata/2.moderation.txt3
-rw-r--r--syz-cluster/pkg/report/testdata/2.upstream.txt3
-rw-r--r--syz-cluster/pkg/reporter/api_test.go11
-rw-r--r--syz-cluster/pkg/service/build.go6
15 files changed, 50 insertions, 27 deletions
diff --git a/syz-cluster/pkg/api/api.go b/syz-cluster/pkg/api/api.go
index d48175199..95cf73ae5 100644
--- a/syz-cluster/pkg/api/api.go
+++ b/syz-cluster/pkg/api/api.go
@@ -39,6 +39,7 @@ type Tree struct {
type BuildRequest struct {
Arch string `json:"arch"`
TreeName string `json:"tree_name"`
+ TreeURL string `json:"tree_url"`
CommitHash string `json:"commit_hash"`
ConfigName string `json:"config_name"` // These are known to both the triage and build steps.
SeriesID string `json:"series_id"`
@@ -53,6 +54,7 @@ type BuildResult struct {
type Build struct {
Arch string `json:"arch"`
TreeName string `json:"tree_name"`
+ TreeURL string `json:"tree_url"`
CommitHash string `json:"commit_hash"`
CommitDate time.Time `json:"commit_date"`
ConfigName string `json:"config_name"`
@@ -144,7 +146,8 @@ type Finding struct {
}
type BuildInfo struct {
- Repo string `json:"repo"`
+ TreeName string `json:"tree_name"`
+ TreeURL string `json:"tree_url"`
BaseCommit string `json:"base_commit"`
Arch string `json:"arch"`
Compiler string `json:"compiler"`
diff --git a/syz-cluster/pkg/controller/api_test.go b/syz-cluster/pkg/controller/api_test.go
index c086f31ce..9e709e089 100644
--- a/syz-cluster/pkg/controller/api_test.go
+++ b/syz-cluster/pkg/controller/api_test.go
@@ -5,12 +5,11 @@ package controller
import (
"bytes"
- "testing"
- "time"
-
"github.com/google/syzkaller/syz-cluster/pkg/api"
"github.com/google/syzkaller/syz-cluster/pkg/app"
"github.com/stretchr/testify/assert"
+ "testing"
+ "time"
)
func TestAPIGetSeries(t *testing.T) {
@@ -124,6 +123,7 @@ var testSeries = &api.Series{
var testBuild = &api.Build{
Arch: "amd64",
TreeName: "mainline",
+ TreeURL: "https://git/tree",
ConfigName: "config",
CommitHash: "abcd",
CommitDate: time.Date(2020, time.January, 1, 3, 0, 0, 0, time.UTC),
diff --git a/syz-cluster/pkg/controller/testutil.go b/syz-cluster/pkg/controller/testutil.go
index c1ab8b6f5..9ec90f190 100644
--- a/syz-cluster/pkg/controller/testutil.go
+++ b/syz-cluster/pkg/controller/testutil.go
@@ -6,14 +6,13 @@ package controller
import (
"context"
"fmt"
- "net/http/httptest"
- "testing"
- "time"
-
"github.com/google/syzkaller/syz-cluster/pkg/api"
"github.com/google/syzkaller/syz-cluster/pkg/app"
"github.com/google/syzkaller/syz-cluster/pkg/db"
"github.com/stretchr/testify/assert"
+ "net/http/httptest"
+ "testing"
+ "time"
)
type EntityIDs struct {
@@ -74,6 +73,7 @@ func DummyBuild() *api.Build {
return &api.Build{
Arch: "amd64",
TreeName: "mainline",
+ TreeURL: "https://git/repo",
ConfigName: "config",
CommitHash: "abcd",
Compiler: "compiler",
diff --git a/syz-cluster/pkg/db/entities.go b/syz-cluster/pkg/db/entities.go
index 9959e81b2..77c066b5e 100644
--- a/syz-cluster/pkg/db/entities.go
+++ b/syz-cluster/pkg/db/entities.go
@@ -4,9 +4,8 @@
package db
import (
- "time"
-
"cloud.google.com/go/spanner"
+ "time"
)
type Series struct {
@@ -39,6 +38,7 @@ type Patch struct {
type Build struct {
ID string `spanner:"ID"`
TreeName string `spanner:"TreeName"`
+ TreeURL string `spanner:"TreeURL"`
CommitHash string `spanner:"CommitHash"`
CommitDate time.Time `spanner:"CommitDate"`
SeriesID spanner.NullString `spanner:"SeriesID"`
diff --git a/syz-cluster/pkg/db/migrations/3_add_tree_url.down.sql b/syz-cluster/pkg/db/migrations/3_add_tree_url.down.sql
new file mode 100644
index 000000000..c37546a27
--- /dev/null
+++ b/syz-cluster/pkg/db/migrations/3_add_tree_url.down.sql
@@ -0,0 +1 @@
+ALTER TABLE Builds DROP COLUMN TreeURL;
diff --git a/syz-cluster/pkg/db/migrations/3_add_tree_url.up.sql b/syz-cluster/pkg/db/migrations/3_add_tree_url.up.sql
new file mode 100644
index 000000000..468b238d3
--- /dev/null
+++ b/syz-cluster/pkg/db/migrations/3_add_tree_url.up.sql
@@ -0,0 +1,2 @@
+ALTER TABLE Builds ADD COLUMN TreeURL STRING(512) DEFAULT('');
+ALTER TABLE Builds ALTER COLUMN TreeURL STRING(512) NOT NULL;
diff --git a/syz-cluster/pkg/report/template.txt b/syz-cluster/pkg/report/template.txt
index f22666967..3778ad3f6 100644
--- a/syz-cluster/pkg/report/template.txt
+++ b/syz-cluster/pkg/report/template.txt
@@ -27,7 +27,12 @@ Full report is available here:
{{.Title}}
-tree: {{.Build.Repo}}
+{{if .Build.TreeName -}}
+tree: {{.Build.TreeName}}
+{{- end}}
+{{- if .Build.TreeURL}}
+URL: {{.Build.TreeURL}}
+{{- end}}
base: {{.Build.BaseCommit}}
{{- if .Build.Arch}}
arch: {{.Build.Arch}}
diff --git a/syz-cluster/pkg/report/testdata/1.in.json b/syz-cluster/pkg/report/testdata/1.in.json
index 41ac3947a..0cc8e7261 100644
--- a/syz-cluster/pkg/report/testdata/1.in.json
+++ b/syz-cluster/pkg/report/testdata/1.in.json
@@ -20,7 +20,8 @@
"c_repro": "http://link/to/c/repro",
"syz_repro": "http://link/to/syz/repro",
"build": {
- "repo": "http://kernel/repo1",
+ "tree_name": "mainline",
+ "tree_url": "http://kernel/repo1",
"base_commit": "base_commit1",
"arch": "amd64",
"config_link": "http://link/to/config/1",
@@ -32,7 +33,8 @@
"report": "Report Line D\nReport Line E\nReport Line F",
"syz_repro": "http://link/to/syz/repro2",
"build": {
- "repo": "http://kernel/repo1",
+ "tree_name": "mainline",
+ "tree_url": "http://kernel/repo1",
"base_commit": "base_commit1",
"arch": "arm64",
"config_link": "http://link/to/config/2",
diff --git a/syz-cluster/pkg/report/testdata/1.moderation.txt b/syz-cluster/pkg/report/testdata/1.moderation.txt
index 1ba7d79bf..84351f50f 100644
--- a/syz-cluster/pkg/report/testdata/1.moderation.txt
+++ b/syz-cluster/pkg/report/testdata/1.moderation.txt
@@ -16,7 +16,8 @@ http://some/link/to/report
WARNING in abcd
-tree: http://kernel/repo1
+tree: mainline
+URL: http://kernel/repo1
base: base_commit1
arch: amd64
compiler: clang
@@ -32,7 +33,8 @@ Report Line C
KASAN: use-after-free Write in abcd
-tree: http://kernel/repo1
+tree: mainline
+URL: http://kernel/repo1
base: base_commit1
arch: arm64
compiler: clang
diff --git a/syz-cluster/pkg/report/testdata/1.upstream.txt b/syz-cluster/pkg/report/testdata/1.upstream.txt
index 327d1fcb1..75da6f026 100644
--- a/syz-cluster/pkg/report/testdata/1.upstream.txt
+++ b/syz-cluster/pkg/report/testdata/1.upstream.txt
@@ -16,7 +16,8 @@ http://some/link/to/report
WARNING in abcd
-tree: http://kernel/repo1
+tree: mainline
+URL: http://kernel/repo1
base: base_commit1
arch: amd64
compiler: clang
@@ -32,7 +33,8 @@ Report Line C
KASAN: use-after-free Write in abcd
-tree: http://kernel/repo1
+tree: mainline
+URL: http://kernel/repo1
base: base_commit1
arch: arm64
compiler: clang
diff --git a/syz-cluster/pkg/report/testdata/2.in.json b/syz-cluster/pkg/report/testdata/2.in.json
index 527f50a61..22ca8c943 100644
--- a/syz-cluster/pkg/report/testdata/2.in.json
+++ b/syz-cluster/pkg/report/testdata/2.in.json
@@ -20,7 +20,8 @@
"c_repro": "http://link/to/c/repro",
"syz_repro": "http://link/to/syz/repro",
"build": {
- "repo": "http://kernel/repo1",
+ "tree_name": "mainline",
+ "tree_url": "http://kernel/repo1",
"base_commit": "base_commit1",
"arch": "amd64",
"config_link": "http://link/to/config/1",
diff --git a/syz-cluster/pkg/report/testdata/2.moderation.txt b/syz-cluster/pkg/report/testdata/2.moderation.txt
index a614f691e..0693c81e1 100644
--- a/syz-cluster/pkg/report/testdata/2.moderation.txt
+++ b/syz-cluster/pkg/report/testdata/2.moderation.txt
@@ -15,7 +15,8 @@ http://some/link/to/report
WARNING in abcd
-tree: http://kernel/repo1
+tree: mainline
+URL: http://kernel/repo1
base: base_commit1
arch: amd64
compiler: clang
diff --git a/syz-cluster/pkg/report/testdata/2.upstream.txt b/syz-cluster/pkg/report/testdata/2.upstream.txt
index adddb20af..04b798613 100644
--- a/syz-cluster/pkg/report/testdata/2.upstream.txt
+++ b/syz-cluster/pkg/report/testdata/2.upstream.txt
@@ -15,7 +15,8 @@ http://some/link/to/report
WARNING in abcd
-tree: http://kernel/repo1
+tree: mainline
+URL: http://kernel/repo1
base: base_commit1
arch: amd64
compiler: clang
diff --git a/syz-cluster/pkg/reporter/api_test.go b/syz-cluster/pkg/reporter/api_test.go
index 69ee0c604..74068139b 100644
--- a/syz-cluster/pkg/reporter/api_test.go
+++ b/syz-cluster/pkg/reporter/api_test.go
@@ -4,13 +4,12 @@
package reporter
import (
- "testing"
- "time"
-
"github.com/google/syzkaller/syz-cluster/pkg/api"
"github.com/google/syzkaller/syz-cluster/pkg/app"
"github.com/google/syzkaller/syz-cluster/pkg/controller"
"github.com/stretchr/testify/assert"
+ "testing"
+ "time"
)
func TestAPIReportFlow(t *testing.T) {
@@ -68,7 +67,8 @@ func TestAPIReportFlow(t *testing.T) {
Title: "finding 0",
Report: "report 0",
Build: api.BuildInfo{
- Repo: "mainline",
+ TreeName: "mainline",
+ TreeURL: "https://git/repo",
BaseCommit: "abcd",
Arch: "amd64",
Compiler: "compiler",
@@ -78,7 +78,8 @@ func TestAPIReportFlow(t *testing.T) {
Title: "finding 1",
Report: "report 1",
Build: api.BuildInfo{
- Repo: "mainline",
+ TreeName: "mainline",
+ TreeURL: "https://git/repo",
BaseCommit: "abcd",
Arch: "amd64",
Compiler: "compiler",
diff --git a/syz-cluster/pkg/service/build.go b/syz-cluster/pkg/service/build.go
index b6dcdb620..44409f7fc 100644
--- a/syz-cluster/pkg/service/build.go
+++ b/syz-cluster/pkg/service/build.go
@@ -7,7 +7,6 @@ import (
"bytes"
"context"
"fmt"
-
"github.com/google/syzkaller/syz-cluster/pkg/api"
"github.com/google/syzkaller/syz-cluster/pkg/app"
"github.com/google/syzkaller/syz-cluster/pkg/blob"
@@ -33,6 +32,7 @@ func (s *BuildService) Upload(ctx context.Context, req *api.UploadBuildReq) (*ap
Arch: req.Arch,
ConfigName: req.ConfigName,
TreeName: req.TreeName,
+ TreeURL: req.TreeURL,
CommitHash: req.CommitHash,
CommitDate: req.CommitDate,
Compiler: req.Compiler,
@@ -82,6 +82,7 @@ func (s *BuildService) LastBuild(ctx context.Context, req *api.LastBuildReq) (*a
resp := &api.Build{
Arch: build.Arch,
TreeName: build.TreeName,
+ TreeURL: build.TreeURL,
ConfigName: build.ConfigName,
CommitHash: build.CommitHash,
CommitDate: build.CommitDate,
@@ -95,7 +96,8 @@ func (s *BuildService) LastBuild(ctx context.Context, req *api.LastBuildReq) (*a
func makeBuildInfo(url *api.URLGenerator, build *db.Build) api.BuildInfo {
return api.BuildInfo{
- Repo: build.TreeName, // TODO: we actually want to use repo URI here.
+ TreeName: build.TreeName,
+ TreeURL: build.TreeURL,
BaseCommit: build.CommitHash,
Arch: build.Arch,
Compiler: build.Compiler,