aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAleksandr Nogikh <nogikh@google.com>2022-12-15 23:44:08 +0100
committerAleksandr Nogikh <wp32pw@gmail.com>2022-12-16 10:22:43 +0100
commitbd797b29e63755f6d6fceb2b8ef5430e7def9551 (patch)
tree106c02973b58e75c0e1ddcf9177f6fea8d0a99f5
parentf78ac52957d6ecf72abfb80047e95d1057a78fad (diff)
dashboard: test the new fs bug routing flow
-rw-r--r--dashboard/app/app_test.go46
-rw-r--r--dashboard/app/config_linux_test.go136
2 files changed, 182 insertions, 0 deletions
diff --git a/dashboard/app/app_test.go b/dashboard/app/app_test.go
index 26924ef47..3fa2e8499 100644
--- a/dashboard/app/app_test.go
+++ b/dashboard/app/app_test.go
@@ -15,6 +15,7 @@ import (
"github.com/google/go-cmp/cmp"
"github.com/google/syzkaller/dashboard/dashapi"
"github.com/google/syzkaller/pkg/auth"
+ "github.com/google/syzkaller/pkg/subsystem"
"github.com/google/syzkaller/sys/targets"
"google.golang.org/appengine/v2/user"
)
@@ -317,6 +318,49 @@ var testConfig = &GlobalConfig{
},
},
},
+ "fs-bugs-reporting": {
+ AccessLevel: AccessPublic,
+ Key: "fspublickeypublickeypublickey",
+ Clients: map[string]string{
+ clientPublicFs: keyPublicFs,
+ },
+ Repos: []KernelRepo{
+ {
+ URL: "git://syzkaller.org/fs-bugs.git",
+ Branch: "fs-bugs",
+ Alias: "fs-bugs",
+ },
+ },
+ Reporting: []Reporting{
+ {
+ Name: "wait-repro",
+ DailyLimit: 1000,
+ Filter: func(bug *Bug) FilterResult {
+ if canBeVfsBug(bug) &&
+ bug.ReproLevel == dashapi.ReproLevelNone {
+ return FilterReport
+ }
+ return FilterSkip
+ },
+ Config: &TestConfig{Index: 1},
+ },
+ {
+ AccessLevel: AccessPublic,
+ Name: "public",
+ DailyLimit: 1000,
+ Config: &EmailConfig{
+ Email: "test@syzkaller.com",
+ HandleListEmails: true,
+ DefaultMaintainers: []string{"linux-kernel@vger.kernel.org"},
+ MailMaintainers: true,
+ SubjectPrefix: "[syzbot]",
+ },
+ },
+ },
+ Subsystems: &SubsystemsConfig{
+ SubsystemCc: subsystem.LinuxGetMaintainers,
+ },
+ },
},
}
@@ -335,6 +379,8 @@ const (
keyPublicEmail = "clientpublicemailkeyclientpublicemailkey"
clientPublicEmail2 = "client-public-email2"
keyPublicEmail2 = "clientpublicemailkeyclientpublicemailkey2"
+ clientPublicFs = "client-public-fs"
+ keyPublicFs = "keypublicfskeypublicfskeypublicfs"
restrictedManager = "restricted-manager"
noFixBisectionManager = "no-fix-bisection-manager"
diff --git a/dashboard/app/config_linux_test.go b/dashboard/app/config_linux_test.go
index c95204de3..595f4b47a 100644
--- a/dashboard/app/config_linux_test.go
+++ b/dashboard/app/config_linux_test.go
@@ -2,3 +2,139 @@
// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
package main
+
+import (
+ "testing"
+
+ "github.com/google/syzkaller/dashboard/dashapi"
+)
+
+func TestFsSubsystemFlow(t *testing.T) {
+ // Test that we can do the following:
+ // 1. Delay the reporting of possible vfs bugs until we have found a reproducer.
+ // 2. Once the reproducer comes, extract the extra subsystems and report it.
+
+ c := NewCtx(t)
+ defer c.Close()
+
+ client := c.makeClient(clientPublicFs, keyPublicFs, true)
+ build := testBuild(1)
+ client.UploadBuild(build)
+
+ // A. Make sure non-fs bugs are not affected.
+ // -----------------------------------------
+
+ crash := testCrash(build, 1)
+ crash.Title = "WARNING: abcd"
+ crash.Log = []byte("log log log")
+ crash.GuiltyFiles = []string{"kernel/kernel.c"}
+ crash.Maintainers = []string{"maintainer@kernel.org"}
+ client.ReportCrash(crash)
+
+ // We skip the first stage and report the bug right away.
+ reply := c.pollEmailBug()
+ c.expectEQ(reply.Subject, "[syzbot] WARNING: abcd")
+
+ // B. Send a non-vfs bug without a reproducer.
+ // -----------------------------------------
+
+ crash = testCrash(build, 2)
+ crash.Title = "WARNING in nilfs_dat_commit_end"
+ crash.GuiltyFiles = []string{"fs/nilfs2/dat.c"}
+ crash.Log = []byte("log log log")
+ crash.Maintainers = []string{"maintainer@kernel.org"}
+ client.ReportCrash(crash)
+
+ reply = c.pollEmailBug()
+ // We have no means to determine the subsystem now, so it shouldn't be anywhere.
+ c.expectEQ(reply.Subject, "[syzbot] WARNING in nilfs_dat_commit_end")
+
+ // C. Send a possibly vfs bug without a reproducer.
+ // -----------------------------------------
+
+ crash = testCrash(build, 3)
+ crash.Title = "WARNING in do_mkdirat"
+ crash.GuiltyFiles = []string{"fs/namei.c"}
+ crash.Log = []byte("log log log")
+ crash.Maintainers = []string{"maintainer@kernel.org"}
+ client.ReportCrash(crash)
+
+ // As there's no other information, the bug is left at the first reporting.
+ c.client.pollNotifs(0)
+ vfsBug := client.pollBug()
+
+ // D. Now report a reproducer for the (C) bug that does image mounting.
+ // -----------------------------------------
+
+ crash = testCrash(build, 4)
+ crash.Title = "WARNING in do_mkdirat"
+ crash.GuiltyFiles = []string{"fs/namei.c"}
+ crash.Log = []byte("log log log")
+ // nolint: lll
+ crash.ReproSyz = []byte(`syz_mount_image$ntfs3(&(0x7f0000000240), &(0x7f000001f3c0)='./file0\x00', 0xc40, &(0x7f00000005c0)=ANY=[@ANYBLOB="0032"], 0x3, 0x1f398, &(0x7f000003e7c0)="111")
+r0 = openat(0xffffffffffffff9c, &(0x7f0000000040)='.\x00', 0x0, 0x0)
+mkdirat(r0, &(0x7f0000000180)='./bus\x00', 0x0)
+mkdirat(r0, &(0x7f0000000280)='./bus/file0\x00', 0x0)
+renameat2(r0, &(0x7f00000004c0)='./file0\x00', r0, &(0x7f0000000500)='./bus/file0/file0\x00', 0x0)`)
+ crash.Maintainers = []string{"maintainer@kernel.org"}
+ client.ReportCrash(crash)
+
+ // Check that we're ready for upstreaming.
+ c.client.pollNotifs(1)
+ client.updateBug(vfsBug.ID, dashapi.BugStatusUpstream, "")
+ // .. and poll the email.
+ reply = c.pollEmailBug()
+ c.expectEQ(reply.Subject, "[syzbot] [vfs?] [ntfs3?] WARNING in do_mkdirat")
+ // Make sure ntfs3 maintainers are in the recipients.
+ c.expectEQ(reply.To, []string{"almaz.alexandrovich@paragon-software.com",
+ "linux-kernel@vger.kernel.org", "maintainer@kernel.org",
+ "ntfs3@lists.linux.dev", "test@syzkaller.com"})
+}
+
+func TestVfsSubsystemFlow(t *testing.T) {
+ // Test that we can do the following:
+ // 1. Delay the reporting of possible vfs bugs until we have found a reproducer.
+ // 2. Once the reproducer comes, extract the extra subsystems and report it.
+
+ c := NewCtx(t)
+ defer c.Close()
+
+ client := c.makeClient(clientPublicFs, keyPublicFs, true)
+ build := testBuild(1)
+ client.UploadBuild(build)
+
+ // A. Send a possibly vfs bug without a reproducer.
+ // -----------------------------------------
+
+ crash := testCrash(build, 1)
+ crash.Title = "WARNING in do_mkdirat2"
+ crash.GuiltyFiles = []string{"fs/namei.c"}
+ crash.Log = []byte("log log log")
+ crash.Maintainers = []string{"maintainer@kernel.org"}
+ client.ReportCrash(crash)
+
+ // As there's no other information, the bug is left at the first reporting.
+ c.client.pollNotifs(0)
+ vfsBug := client.pollBug()
+
+ // B. Now report a reproducer for the (C) bug that does NO image mounting.
+ // -----------------------------------------
+
+ crash = testCrash(build, 2)
+ crash.Title = "WARNING in do_mkdirat2"
+ crash.GuiltyFiles = []string{"fs/namei.c"}
+ crash.Log = []byte("log log log")
+ crash.ReproSyz = []byte(`r0 = openat(0xffffffffffffff9c, &(0x7f0000000040)='.\x00', 0x0, 0x0)
+mkdirat(r0, &(0x7f0000000180)='./bus\x00', 0x0)
+mkdirat(r0, &(0x7f0000000280)='./bus/file0\x00', 0x0)
+renameat2(r0, &(0x7f00000004c0)='./file0\x00', r0, &(0x7f0000000500)='./bus/file0/file0\x00', 0x0)`)
+ crash.Maintainers = []string{"maintainer@kernel.org"}
+ client.ReportCrash(crash)
+
+ // Check that we're ready for upstreaming.
+ c.client.pollNotifs(1)
+ client.updateBug(vfsBug.ID, dashapi.BugStatusUpstream, "")
+ // .. and poll the email.
+ reply := c.pollEmailBug()
+ c.expectEQ(reply.Subject, "[syzbot] [vfs?] WARNING in do_mkdirat2")
+}