syzkaller/syz-ci/jobs.go

607 lines
18 KiB
Go
Raw Normal View History

2017-11-16 11:08:01 +01:00
// Copyright 2017 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 main
import (
dashboard/app, syz-ci: bisection support This adds bulk of support for bisection to dashboard/app and syz-ci: - APIs to send bisection jobs and accept results - syz-ci logic to execute bisection jobs - formatting of emails with results - showing of results on dashboard Some difficulties we have to overcome: - since linux is frequently build/boot broken, lots of bisections are inconclusive, need to present such results too - git bisect is poorly suitable for automation, have to resort to output parsing (is output stable?) - git bisect turns out to fail (exit with non-0 status) when bisection is inconclusive (multiple potential cause commits) - older syzkaller revisions can't be built with newer (broken) kernel header, e.g.: ebtables.h:197:19: error: invalid conversion from ‘void*’ to ‘ebt_entry_target*’ - newer compilers produce more warnings and break old syzkaller builds, e.g.: kvm.S.h:6:12: error: ‘kvm_asm64_vm86’ defined but not used [-Werror=unused-const-variable=] - figuring relevant emails to CC from a commit is non-trivial: besides commit author, there can be some emails in commit tags, or not, which tags to use is an interesting question (some may include irrelevant emails) we can also run get_maintainers.pl on the commit, but this can produce too wide list if commit touches lots of files, it can also produce too small list, and then we need to resort to blame - for inconclusive bisection we probably don't need to include emails referenced in the commits (there can be too many of these commits) - need to be careful to exclude own syzbot email from commit CC list, now syzbot emails are referenced in some commits (Reported-by/Tested-by/etc) (can cause some kind of infinite recursion) - lots of commits reference stable mailing list, we should not include it in CC because it's referenced for backports rather then bug reports - since we add new Bug entity fields which we use in queries, whole datastore need to be upgrades to add the new field to index - we must not discard the crash that was used for bisection (treat it as a reported crash) - bisection results need 2 forms of reports: one when we add bisection results to already reported bug another when we report a bug first time with bisection results - when reporting a bug with bisection results we need to use the crash that was used for bisection - some fraction of bisections will probably fail with various errors and we will need some mechanism to retry bisection after the root cause is resolved this is not implemented yet - linux-next is problematic for 2 reasons: fix bisection can't possibly run on linux-next as commits are not reachable from HEAD lots of commits are missing in linux-next (even in linux-next-history) e.g. we have some c63e9e91a254a52 which is now missing in linux-next/linux-next-history - older kernels can't be build with fresh gcc/binutils/perl/make/glibc for now we have to stop at v3.9 (this only requires switching gcc several times along the way) - kernels past v4.11 do not build with gcc 7 and 8 (undefined reference to `____ilog2_NaN') - v4.1 and back have only compiler-gcc5.h - v3.17 and back have only compiler-gcc4.h - v3.6 and back do not have make olddefconfig - compat socket calls can't be bisected past "x86/entry/syscalls: Wire up 32-bit direct socket calls" (v4.10) because of https://syzkaller.appspot.com/bug?id=b5b150e322d5f48c869bcf1528cdbee08d1421cb - v2.6.28 and below does not work with modern make: *** mixed implicit and normal rules: deprecated syntax - v3.8 build fails: Can't use 'defined(@array)' (Maybe you should just omit the defined()?) at kernel/timeconst.pl line 373. kernel/Makefile:134: recipe for target 'kernel/timeconst.h' failed - make 3.81 works for v2.6.28. 3.81 almost works with current HEAD, you need to run make twice because first run spuriously fails with: - v2.6.28 with gcc-4.9.4 broken with: include/linux/kvm.h:240:9: error: duplicate member ‘padding’ - but even defconfig fails: VDSO arch/x86/vdso/vdso.so.dbg gcc: error: elf_x86_64: No such file or directory gcc: error: unrecognized command line option ‘-m’ It seems that we also need old binutils. - for v3.8 and below we need perl-5.14.4. Unfortunately this or any manually built perl doesn't work for later kernels: Can't locate strict.pm in @INC - kernels starting from 4.14 and older are boot broken: https://lkml.org/lkml/2018/9/7/648 - kernels older than 4.12 are broken during netdev setup (fixed by commit 675c8da049fd6556eb2d6cdd745fe812752f07a8) Update #501
2019-03-02 09:45:27 +01:00
"bytes"
2017-11-16 11:08:01 +01:00
"fmt"
dashboard/app, syz-ci: bisection support This adds bulk of support for bisection to dashboard/app and syz-ci: - APIs to send bisection jobs and accept results - syz-ci logic to execute bisection jobs - formatting of emails with results - showing of results on dashboard Some difficulties we have to overcome: - since linux is frequently build/boot broken, lots of bisections are inconclusive, need to present such results too - git bisect is poorly suitable for automation, have to resort to output parsing (is output stable?) - git bisect turns out to fail (exit with non-0 status) when bisection is inconclusive (multiple potential cause commits) - older syzkaller revisions can't be built with newer (broken) kernel header, e.g.: ebtables.h:197:19: error: invalid conversion from ‘void*’ to ‘ebt_entry_target*’ - newer compilers produce more warnings and break old syzkaller builds, e.g.: kvm.S.h:6:12: error: ‘kvm_asm64_vm86’ defined but not used [-Werror=unused-const-variable=] - figuring relevant emails to CC from a commit is non-trivial: besides commit author, there can be some emails in commit tags, or not, which tags to use is an interesting question (some may include irrelevant emails) we can also run get_maintainers.pl on the commit, but this can produce too wide list if commit touches lots of files, it can also produce too small list, and then we need to resort to blame - for inconclusive bisection we probably don't need to include emails referenced in the commits (there can be too many of these commits) - need to be careful to exclude own syzbot email from commit CC list, now syzbot emails are referenced in some commits (Reported-by/Tested-by/etc) (can cause some kind of infinite recursion) - lots of commits reference stable mailing list, we should not include it in CC because it's referenced for backports rather then bug reports - since we add new Bug entity fields which we use in queries, whole datastore need to be upgrades to add the new field to index - we must not discard the crash that was used for bisection (treat it as a reported crash) - bisection results need 2 forms of reports: one when we add bisection results to already reported bug another when we report a bug first time with bisection results - when reporting a bug with bisection results we need to use the crash that was used for bisection - some fraction of bisections will probably fail with various errors and we will need some mechanism to retry bisection after the root cause is resolved this is not implemented yet - linux-next is problematic for 2 reasons: fix bisection can't possibly run on linux-next as commits are not reachable from HEAD lots of commits are missing in linux-next (even in linux-next-history) e.g. we have some c63e9e91a254a52 which is now missing in linux-next/linux-next-history - older kernels can't be build with fresh gcc/binutils/perl/make/glibc for now we have to stop at v3.9 (this only requires switching gcc several times along the way) - kernels past v4.11 do not build with gcc 7 and 8 (undefined reference to `____ilog2_NaN') - v4.1 and back have only compiler-gcc5.h - v3.17 and back have only compiler-gcc4.h - v3.6 and back do not have make olddefconfig - compat socket calls can't be bisected past "x86/entry/syscalls: Wire up 32-bit direct socket calls" (v4.10) because of https://syzkaller.appspot.com/bug?id=b5b150e322d5f48c869bcf1528cdbee08d1421cb - v2.6.28 and below does not work with modern make: *** mixed implicit and normal rules: deprecated syntax - v3.8 build fails: Can't use 'defined(@array)' (Maybe you should just omit the defined()?) at kernel/timeconst.pl line 373. kernel/Makefile:134: recipe for target 'kernel/timeconst.h' failed - make 3.81 works for v2.6.28. 3.81 almost works with current HEAD, you need to run make twice because first run spuriously fails with: - v2.6.28 with gcc-4.9.4 broken with: include/linux/kvm.h:240:9: error: duplicate member ‘padding’ - but even defconfig fails: VDSO arch/x86/vdso/vdso.so.dbg gcc: error: elf_x86_64: No such file or directory gcc: error: unrecognized command line option ‘-m’ It seems that we also need old binutils. - for v3.8 and below we need perl-5.14.4. Unfortunately this or any manually built perl doesn't work for later kernels: Can't locate strict.pm in @INC - kernels starting from 4.14 and older are boot broken: https://lkml.org/lkml/2018/9/7/648 - kernels older than 4.12 are broken during netdev setup (fixed by commit 675c8da049fd6556eb2d6cdd745fe812752f07a8) Update #501
2019-03-02 09:45:27 +01:00
"io"
2017-11-16 11:08:01 +01:00
"io/ioutil"
"os"
"path/filepath"
"strings"
2017-11-16 11:08:01 +01:00
"time"
"github.com/google/syzkaller/dashboard/dashapi"
dashboard/app, syz-ci: bisection support This adds bulk of support for bisection to dashboard/app and syz-ci: - APIs to send bisection jobs and accept results - syz-ci logic to execute bisection jobs - formatting of emails with results - showing of results on dashboard Some difficulties we have to overcome: - since linux is frequently build/boot broken, lots of bisections are inconclusive, need to present such results too - git bisect is poorly suitable for automation, have to resort to output parsing (is output stable?) - git bisect turns out to fail (exit with non-0 status) when bisection is inconclusive (multiple potential cause commits) - older syzkaller revisions can't be built with newer (broken) kernel header, e.g.: ebtables.h:197:19: error: invalid conversion from ‘void*’ to ‘ebt_entry_target*’ - newer compilers produce more warnings and break old syzkaller builds, e.g.: kvm.S.h:6:12: error: ‘kvm_asm64_vm86’ defined but not used [-Werror=unused-const-variable=] - figuring relevant emails to CC from a commit is non-trivial: besides commit author, there can be some emails in commit tags, or not, which tags to use is an interesting question (some may include irrelevant emails) we can also run get_maintainers.pl on the commit, but this can produce too wide list if commit touches lots of files, it can also produce too small list, and then we need to resort to blame - for inconclusive bisection we probably don't need to include emails referenced in the commits (there can be too many of these commits) - need to be careful to exclude own syzbot email from commit CC list, now syzbot emails are referenced in some commits (Reported-by/Tested-by/etc) (can cause some kind of infinite recursion) - lots of commits reference stable mailing list, we should not include it in CC because it's referenced for backports rather then bug reports - since we add new Bug entity fields which we use in queries, whole datastore need to be upgrades to add the new field to index - we must not discard the crash that was used for bisection (treat it as a reported crash) - bisection results need 2 forms of reports: one when we add bisection results to already reported bug another when we report a bug first time with bisection results - when reporting a bug with bisection results we need to use the crash that was used for bisection - some fraction of bisections will probably fail with various errors and we will need some mechanism to retry bisection after the root cause is resolved this is not implemented yet - linux-next is problematic for 2 reasons: fix bisection can't possibly run on linux-next as commits are not reachable from HEAD lots of commits are missing in linux-next (even in linux-next-history) e.g. we have some c63e9e91a254a52 which is now missing in linux-next/linux-next-history - older kernels can't be build with fresh gcc/binutils/perl/make/glibc for now we have to stop at v3.9 (this only requires switching gcc several times along the way) - kernels past v4.11 do not build with gcc 7 and 8 (undefined reference to `____ilog2_NaN') - v4.1 and back have only compiler-gcc5.h - v3.17 and back have only compiler-gcc4.h - v3.6 and back do not have make olddefconfig - compat socket calls can't be bisected past "x86/entry/syscalls: Wire up 32-bit direct socket calls" (v4.10) because of https://syzkaller.appspot.com/bug?id=b5b150e322d5f48c869bcf1528cdbee08d1421cb - v2.6.28 and below does not work with modern make: *** mixed implicit and normal rules: deprecated syntax - v3.8 build fails: Can't use 'defined(@array)' (Maybe you should just omit the defined()?) at kernel/timeconst.pl line 373. kernel/Makefile:134: recipe for target 'kernel/timeconst.h' failed - make 3.81 works for v2.6.28. 3.81 almost works with current HEAD, you need to run make twice because first run spuriously fails with: - v2.6.28 with gcc-4.9.4 broken with: include/linux/kvm.h:240:9: error: duplicate member ‘padding’ - but even defconfig fails: VDSO arch/x86/vdso/vdso.so.dbg gcc: error: elf_x86_64: No such file or directory gcc: error: unrecognized command line option ‘-m’ It seems that we also need old binutils. - for v3.8 and below we need perl-5.14.4. Unfortunately this or any manually built perl doesn't work for later kernels: Can't locate strict.pm in @INC - kernels starting from 4.14 and older are boot broken: https://lkml.org/lkml/2018/9/7/648 - kernels older than 4.12 are broken during netdev setup (fixed by commit 675c8da049fd6556eb2d6cdd745fe812752f07a8) Update #501
2019-03-02 09:45:27 +01:00
"github.com/google/syzkaller/pkg/bisect"
"github.com/google/syzkaller/pkg/build"
"github.com/google/syzkaller/pkg/instance"
"github.com/google/syzkaller/pkg/log"
"github.com/google/syzkaller/pkg/mgrconfig"
2017-11-16 11:08:01 +01:00
"github.com/google/syzkaller/pkg/osutil"
"github.com/google/syzkaller/pkg/report"
"github.com/google/syzkaller/pkg/vcs"
"github.com/google/syzkaller/vm"
2017-11-16 11:08:01 +01:00
)
const (
commitPollPeriod = time.Hour
)
2017-11-16 11:08:01 +01:00
type JobProcessor struct {
cfg *Config
name string
managers []*Manager
knownCommits map[string]bool
stop chan struct{}
shutdownPending chan struct{}
dash *dashapi.Dashboard
syzkallerRepo string
syzkallerBranch string
2017-11-16 11:08:01 +01:00
}
func newJobProcessor(cfg *Config, managers []*Manager, stop, shutdownPending chan struct{}) *JobProcessor {
return &JobProcessor{
cfg: cfg,
name: fmt.Sprintf("%v-job", cfg.Name),
managers: managers,
knownCommits: make(map[string]bool),
stop: stop,
shutdownPending: shutdownPending,
dash: dashapi.New(cfg.DashboardClient, cfg.DashboardAddr, cfg.DashboardKey),
syzkallerRepo: cfg.SyzkallerRepo,
syzkallerBranch: cfg.SyzkallerBranch,
2017-11-16 11:08:01 +01:00
}
}
func (jp *JobProcessor) loop() {
dashboard/app, syz-ci: bisection support This adds bulk of support for bisection to dashboard/app and syz-ci: - APIs to send bisection jobs and accept results - syz-ci logic to execute bisection jobs - formatting of emails with results - showing of results on dashboard Some difficulties we have to overcome: - since linux is frequently build/boot broken, lots of bisections are inconclusive, need to present such results too - git bisect is poorly suitable for automation, have to resort to output parsing (is output stable?) - git bisect turns out to fail (exit with non-0 status) when bisection is inconclusive (multiple potential cause commits) - older syzkaller revisions can't be built with newer (broken) kernel header, e.g.: ebtables.h:197:19: error: invalid conversion from ‘void*’ to ‘ebt_entry_target*’ - newer compilers produce more warnings and break old syzkaller builds, e.g.: kvm.S.h:6:12: error: ‘kvm_asm64_vm86’ defined but not used [-Werror=unused-const-variable=] - figuring relevant emails to CC from a commit is non-trivial: besides commit author, there can be some emails in commit tags, or not, which tags to use is an interesting question (some may include irrelevant emails) we can also run get_maintainers.pl on the commit, but this can produce too wide list if commit touches lots of files, it can also produce too small list, and then we need to resort to blame - for inconclusive bisection we probably don't need to include emails referenced in the commits (there can be too many of these commits) - need to be careful to exclude own syzbot email from commit CC list, now syzbot emails are referenced in some commits (Reported-by/Tested-by/etc) (can cause some kind of infinite recursion) - lots of commits reference stable mailing list, we should not include it in CC because it's referenced for backports rather then bug reports - since we add new Bug entity fields which we use in queries, whole datastore need to be upgrades to add the new field to index - we must not discard the crash that was used for bisection (treat it as a reported crash) - bisection results need 2 forms of reports: one when we add bisection results to already reported bug another when we report a bug first time with bisection results - when reporting a bug with bisection results we need to use the crash that was used for bisection - some fraction of bisections will probably fail with various errors and we will need some mechanism to retry bisection after the root cause is resolved this is not implemented yet - linux-next is problematic for 2 reasons: fix bisection can't possibly run on linux-next as commits are not reachable from HEAD lots of commits are missing in linux-next (even in linux-next-history) e.g. we have some c63e9e91a254a52 which is now missing in linux-next/linux-next-history - older kernels can't be build with fresh gcc/binutils/perl/make/glibc for now we have to stop at v3.9 (this only requires switching gcc several times along the way) - kernels past v4.11 do not build with gcc 7 and 8 (undefined reference to `____ilog2_NaN') - v4.1 and back have only compiler-gcc5.h - v3.17 and back have only compiler-gcc4.h - v3.6 and back do not have make olddefconfig - compat socket calls can't be bisected past "x86/entry/syscalls: Wire up 32-bit direct socket calls" (v4.10) because of https://syzkaller.appspot.com/bug?id=b5b150e322d5f48c869bcf1528cdbee08d1421cb - v2.6.28 and below does not work with modern make: *** mixed implicit and normal rules: deprecated syntax - v3.8 build fails: Can't use 'defined(@array)' (Maybe you should just omit the defined()?) at kernel/timeconst.pl line 373. kernel/Makefile:134: recipe for target 'kernel/timeconst.h' failed - make 3.81 works for v2.6.28. 3.81 almost works with current HEAD, you need to run make twice because first run spuriously fails with: - v2.6.28 with gcc-4.9.4 broken with: include/linux/kvm.h:240:9: error: duplicate member ‘padding’ - but even defconfig fails: VDSO arch/x86/vdso/vdso.so.dbg gcc: error: elf_x86_64: No such file or directory gcc: error: unrecognized command line option ‘-m’ It seems that we also need old binutils. - for v3.8 and below we need perl-5.14.4. Unfortunately this or any manually built perl doesn't work for later kernels: Can't locate strict.pm in @INC - kernels starting from 4.14 and older are boot broken: https://lkml.org/lkml/2018/9/7/648 - kernels older than 4.12 are broken during netdev setup (fixed by commit 675c8da049fd6556eb2d6cdd745fe812752f07a8) Update #501
2019-03-02 09:45:27 +01:00
ticker := time.NewTicker(10 * time.Second)
2017-11-16 11:08:01 +01:00
defer ticker.Stop()
var lastCommitPoll time.Time
loop:
2017-11-16 11:08:01 +01:00
for {
2019-03-20 13:55:27 +01:00
// Check jp.stop separately first, otherwise if stop signal arrives during a job execution,
// we can grab the next one with 50% probability.
select {
case <-jp.stop:
break loop
default:
}
2017-11-16 11:08:01 +01:00
select {
case <-ticker.C:
if len(kernelBuildSem) != 0 {
// If normal kernel build is in progress (usually on start), don't query jobs.
// Otherwise we claim a job, but can't start it for a while.
continue loop
}
jp.pollJobs()
if time.Since(lastCommitPoll) > commitPollPeriod {
jp.pollCommits()
lastCommitPoll = time.Now()
}
case <-jp.stop:
break loop
2017-11-16 11:08:01 +01:00
}
}
log.Logf(0, "job loop stopped")
2017-11-16 11:08:01 +01:00
}
func (jp *JobProcessor) pollCommits() {
for _, mgr := range jp.managers {
if !mgr.mgrcfg.Jobs.PollCommits {
continue
}
if err := jp.pollManagerCommits(mgr); err != nil {
jp.Errorf("failed to poll commits on %v: %v", mgr.name, err)
}
}
}
func brokenRepo(url string) bool {
// TODO(dvyukov): mmots contains weird squashed commits titled "linux-next" or "origin",
// which contain hundreds of other commits. This makes fix attribution totally broken.
return strings.Contains(url, "git.cmpxchg.org/linux-mmots")
}
func (jp *JobProcessor) pollManagerCommits(mgr *Manager) error {
resp, err := mgr.dash.CommitPoll()
if err != nil {
return err
}
log.Logf(0, "polling commits for %v: repos %v, commits %v", mgr.name, len(resp.Repos), len(resp.Commits))
if len(resp.Repos) == 0 {
return fmt.Errorf("no repos")
}
commits := make(map[string]*vcs.Commit)
for i, repo := range resp.Repos {
if brokenRepo(repo.URL) {
continue
}
if resp.ReportEmail != "" {
commits1, err := jp.pollRepo(mgr, repo.URL, repo.Branch, resp.ReportEmail)
if err != nil {
jp.Errorf("failed to poll %v %v: %v", repo.URL, repo.Branch, err)
continue
}
log.Logf(1, "got %v commits from %v/%v repo", len(commits1), repo.URL, repo.Branch)
for _, com := range commits1 {
// Only the "main" repo is the source of true hashes.
if i != 0 {
com.Hash = ""
}
// Not overwrite existing commits, in particular commit from the main repo with hash.
if _, ok := commits[com.Title]; !ok && !jp.knownCommits[com.Title] && len(commits) < 100 {
commits[com.Title] = com
jp.knownCommits[com.Title] = true
}
}
}
if i == 0 && len(resp.Commits) != 0 {
commits1, err := jp.getCommitInfo(mgr, repo.URL, repo.Branch, resp.Commits)
if err != nil {
jp.Errorf("failed to poll %v %v: %v", repo.URL, repo.Branch, err)
continue
}
log.Logf(1, "got %v commit infos from %v/%v repo", len(commits1), repo.URL, repo.Branch)
for _, com := range commits1 {
// GetCommitByTitle does not accept ReportEmail and does not return tags,
// so don't replace the existing commit.
if _, ok := commits[com.Title]; !ok {
commits[com.Title] = com
}
}
}
}
results := make([]dashapi.Commit, 0, len(commits))
for _, com := range commits {
results = append(results, dashapi.Commit{
Hash: com.Hash,
Title: com.Title,
Author: com.Author,
BugIDs: com.Tags,
Date: com.Date,
})
}
return mgr.dash.UploadCommits(results)
}
func (jp *JobProcessor) pollRepo(mgr *Manager, URL, branch, reportEmail string) ([]*vcs.Commit, error) {
dir := osutil.Abs(filepath.Join("jobs", mgr.managercfg.TargetOS, "kernel"))
repo, err := vcs.NewRepo(mgr.managercfg.TargetOS, mgr.managercfg.Type, dir)
if err != nil {
return nil, fmt.Errorf("failed to create kernel repo: %v", err)
}
if _, err = repo.CheckoutBranch(URL, branch); err != nil {
return nil, fmt.Errorf("failed to checkout kernel repo %v/%v: %v", URL, branch, err)
}
return repo.ExtractFixTagsFromCommits("HEAD", reportEmail)
}
func (jp *JobProcessor) getCommitInfo(mgr *Manager, URL, branch string, commits []string) ([]*vcs.Commit, error) {
dir := osutil.Abs(filepath.Join("jobs", mgr.managercfg.TargetOS, "kernel"))
repo, err := vcs.NewRepo(mgr.managercfg.TargetOS, mgr.managercfg.Type, dir)
if err != nil {
return nil, fmt.Errorf("failed to create kernel repo: %v", err)
}
if _, err = repo.CheckoutBranch(URL, branch); err != nil {
return nil, fmt.Errorf("failed to checkout kernel repo %v/%v: %v", URL, branch, err)
}
results, missing, err := repo.GetCommitsByTitles(commits)
if err != nil {
return nil, err
}
for _, title := range missing {
log.Logf(0, "did not find commit %q", title)
}
return results, nil
}
func (jp *JobProcessor) pollJobs() {
poll := &dashapi.JobPollReq{
Managers: make(map[string]dashapi.ManagerJobs),
}
2017-11-16 11:08:01 +01:00
for _, mgr := range jp.managers {
if !mgr.mgrcfg.Jobs.TestPatches &&
!mgr.mgrcfg.Jobs.BisectCause &&
!mgr.mgrcfg.Jobs.BisectFix {
continue
}
poll.Managers[mgr.name] = dashapi.ManagerJobs{
TestPatches: mgr.mgrcfg.Jobs.TestPatches,
BisectCause: mgr.mgrcfg.Jobs.BisectCause,
BisectFix: mgr.mgrcfg.Jobs.BisectFix,
}
2017-11-16 11:08:01 +01:00
}
if len(poll.Managers) == 0 {
return
}
req, err := jp.dash.JobPoll(poll)
2017-11-16 11:08:01 +01:00
if err != nil {
jp.Errorf("failed to poll jobs: %v", err)
2017-11-16 11:08:01 +01:00
return
}
if req.ID == "" {
return
}
var mgr *Manager
for _, m := range jp.managers {
if m.name == req.Manager {
mgr = m
break
}
}
if mgr == nil {
jp.Errorf("got job for unknown manager: %v", req.Manager)
2017-11-16 11:08:01 +01:00
return
}
job := &Job{
req: req,
mgr: mgr,
}
jp.processJob(job)
}
func (jp *JobProcessor) processJob(job *Job) {
select {
case kernelBuildSem <- struct{}{}:
case <-jp.stop:
return
}
defer func() { <-kernelBuildSem }()
req := job.req
dashboard/app, syz-ci: bisection support This adds bulk of support for bisection to dashboard/app and syz-ci: - APIs to send bisection jobs and accept results - syz-ci logic to execute bisection jobs - formatting of emails with results - showing of results on dashboard Some difficulties we have to overcome: - since linux is frequently build/boot broken, lots of bisections are inconclusive, need to present such results too - git bisect is poorly suitable for automation, have to resort to output parsing (is output stable?) - git bisect turns out to fail (exit with non-0 status) when bisection is inconclusive (multiple potential cause commits) - older syzkaller revisions can't be built with newer (broken) kernel header, e.g.: ebtables.h:197:19: error: invalid conversion from ‘void*’ to ‘ebt_entry_target*’ - newer compilers produce more warnings and break old syzkaller builds, e.g.: kvm.S.h:6:12: error: ‘kvm_asm64_vm86’ defined but not used [-Werror=unused-const-variable=] - figuring relevant emails to CC from a commit is non-trivial: besides commit author, there can be some emails in commit tags, or not, which tags to use is an interesting question (some may include irrelevant emails) we can also run get_maintainers.pl on the commit, but this can produce too wide list if commit touches lots of files, it can also produce too small list, and then we need to resort to blame - for inconclusive bisection we probably don't need to include emails referenced in the commits (there can be too many of these commits) - need to be careful to exclude own syzbot email from commit CC list, now syzbot emails are referenced in some commits (Reported-by/Tested-by/etc) (can cause some kind of infinite recursion) - lots of commits reference stable mailing list, we should not include it in CC because it's referenced for backports rather then bug reports - since we add new Bug entity fields which we use in queries, whole datastore need to be upgrades to add the new field to index - we must not discard the crash that was used for bisection (treat it as a reported crash) - bisection results need 2 forms of reports: one when we add bisection results to already reported bug another when we report a bug first time with bisection results - when reporting a bug with bisection results we need to use the crash that was used for bisection - some fraction of bisections will probably fail with various errors and we will need some mechanism to retry bisection after the root cause is resolved this is not implemented yet - linux-next is problematic for 2 reasons: fix bisection can't possibly run on linux-next as commits are not reachable from HEAD lots of commits are missing in linux-next (even in linux-next-history) e.g. we have some c63e9e91a254a52 which is now missing in linux-next/linux-next-history - older kernels can't be build with fresh gcc/binutils/perl/make/glibc for now we have to stop at v3.9 (this only requires switching gcc several times along the way) - kernels past v4.11 do not build with gcc 7 and 8 (undefined reference to `____ilog2_NaN') - v4.1 and back have only compiler-gcc5.h - v3.17 and back have only compiler-gcc4.h - v3.6 and back do not have make olddefconfig - compat socket calls can't be bisected past "x86/entry/syscalls: Wire up 32-bit direct socket calls" (v4.10) because of https://syzkaller.appspot.com/bug?id=b5b150e322d5f48c869bcf1528cdbee08d1421cb - v2.6.28 and below does not work with modern make: *** mixed implicit and normal rules: deprecated syntax - v3.8 build fails: Can't use 'defined(@array)' (Maybe you should just omit the defined()?) at kernel/timeconst.pl line 373. kernel/Makefile:134: recipe for target 'kernel/timeconst.h' failed - make 3.81 works for v2.6.28. 3.81 almost works with current HEAD, you need to run make twice because first run spuriously fails with: - v2.6.28 with gcc-4.9.4 broken with: include/linux/kvm.h:240:9: error: duplicate member ‘padding’ - but even defconfig fails: VDSO arch/x86/vdso/vdso.so.dbg gcc: error: elf_x86_64: No such file or directory gcc: error: unrecognized command line option ‘-m’ It seems that we also need old binutils. - for v3.8 and below we need perl-5.14.4. Unfortunately this or any manually built perl doesn't work for later kernels: Can't locate strict.pm in @INC - kernels starting from 4.14 and older are boot broken: https://lkml.org/lkml/2018/9/7/648 - kernels older than 4.12 are broken during netdev setup (fixed by commit 675c8da049fd6556eb2d6cdd745fe812752f07a8) Update #501
2019-03-02 09:45:27 +01:00
log.Logf(0, "starting job %v type %v for manager %v on %v/%v",
req.ID, req.Type, req.Manager, req.KernelRepo, req.KernelBranch)
resp := jp.process(job)
log.Logf(0, "done job %v: commit %v, crash %q, error: %s",
2017-11-16 11:08:01 +01:00
resp.ID, resp.Build.KernelCommit, resp.CrashTitle, resp.Error)
select {
case <-jp.shutdownPending:
if len(resp.Error) != 0 {
// Ctrl+C can kill a child process which will cause an error.
log.Logf(0, "ignoring error: shutdown pending")
return
}
default:
}
2017-11-16 11:08:01 +01:00
if err := jp.dash.JobDone(resp); err != nil {
jp.Errorf("failed to mark job as done: %v", err)
2017-11-16 11:08:01 +01:00
return
}
}
type Job struct {
req *dashapi.JobPollResp
resp *dashapi.JobDoneReq
mgr *Manager
2017-11-16 11:08:01 +01:00
}
func (jp *JobProcessor) process(job *Job) *dashapi.JobDoneReq {
2017-11-16 11:08:01 +01:00
req, mgr := job.req, job.mgr
dashboard/app, syz-ci: bisection support This adds bulk of support for bisection to dashboard/app and syz-ci: - APIs to send bisection jobs and accept results - syz-ci logic to execute bisection jobs - formatting of emails with results - showing of results on dashboard Some difficulties we have to overcome: - since linux is frequently build/boot broken, lots of bisections are inconclusive, need to present such results too - git bisect is poorly suitable for automation, have to resort to output parsing (is output stable?) - git bisect turns out to fail (exit with non-0 status) when bisection is inconclusive (multiple potential cause commits) - older syzkaller revisions can't be built with newer (broken) kernel header, e.g.: ebtables.h:197:19: error: invalid conversion from ‘void*’ to ‘ebt_entry_target*’ - newer compilers produce more warnings and break old syzkaller builds, e.g.: kvm.S.h:6:12: error: ‘kvm_asm64_vm86’ defined but not used [-Werror=unused-const-variable=] - figuring relevant emails to CC from a commit is non-trivial: besides commit author, there can be some emails in commit tags, or not, which tags to use is an interesting question (some may include irrelevant emails) we can also run get_maintainers.pl on the commit, but this can produce too wide list if commit touches lots of files, it can also produce too small list, and then we need to resort to blame - for inconclusive bisection we probably don't need to include emails referenced in the commits (there can be too many of these commits) - need to be careful to exclude own syzbot email from commit CC list, now syzbot emails are referenced in some commits (Reported-by/Tested-by/etc) (can cause some kind of infinite recursion) - lots of commits reference stable mailing list, we should not include it in CC because it's referenced for backports rather then bug reports - since we add new Bug entity fields which we use in queries, whole datastore need to be upgrades to add the new field to index - we must not discard the crash that was used for bisection (treat it as a reported crash) - bisection results need 2 forms of reports: one when we add bisection results to already reported bug another when we report a bug first time with bisection results - when reporting a bug with bisection results we need to use the crash that was used for bisection - some fraction of bisections will probably fail with various errors and we will need some mechanism to retry bisection after the root cause is resolved this is not implemented yet - linux-next is problematic for 2 reasons: fix bisection can't possibly run on linux-next as commits are not reachable from HEAD lots of commits are missing in linux-next (even in linux-next-history) e.g. we have some c63e9e91a254a52 which is now missing in linux-next/linux-next-history - older kernels can't be build with fresh gcc/binutils/perl/make/glibc for now we have to stop at v3.9 (this only requires switching gcc several times along the way) - kernels past v4.11 do not build with gcc 7 and 8 (undefined reference to `____ilog2_NaN') - v4.1 and back have only compiler-gcc5.h - v3.17 and back have only compiler-gcc4.h - v3.6 and back do not have make olddefconfig - compat socket calls can't be bisected past "x86/entry/syscalls: Wire up 32-bit direct socket calls" (v4.10) because of https://syzkaller.appspot.com/bug?id=b5b150e322d5f48c869bcf1528cdbee08d1421cb - v2.6.28 and below does not work with modern make: *** mixed implicit and normal rules: deprecated syntax - v3.8 build fails: Can't use 'defined(@array)' (Maybe you should just omit the defined()?) at kernel/timeconst.pl line 373. kernel/Makefile:134: recipe for target 'kernel/timeconst.h' failed - make 3.81 works for v2.6.28. 3.81 almost works with current HEAD, you need to run make twice because first run spuriously fails with: - v2.6.28 with gcc-4.9.4 broken with: include/linux/kvm.h:240:9: error: duplicate member ‘padding’ - but even defconfig fails: VDSO arch/x86/vdso/vdso.so.dbg gcc: error: elf_x86_64: No such file or directory gcc: error: unrecognized command line option ‘-m’ It seems that we also need old binutils. - for v3.8 and below we need perl-5.14.4. Unfortunately this or any manually built perl doesn't work for later kernels: Can't locate strict.pm in @INC - kernels starting from 4.14 and older are boot broken: https://lkml.org/lkml/2018/9/7/648 - kernels older than 4.12 are broken during netdev setup (fixed by commit 675c8da049fd6556eb2d6cdd745fe812752f07a8) Update #501
2019-03-02 09:45:27 +01:00
dir := osutil.Abs(filepath.Join("jobs", mgr.managercfg.TargetOS))
mgrcfg := new(mgrconfig.Config)
*mgrcfg = *mgr.managercfg
mgrcfg.Workdir = filepath.Join(dir, "workdir")
mgrcfg.KernelSrc = filepath.Join(dir, "kernel")
mgrcfg.Syzkaller = filepath.Join(dir, "gopath", "src", "github.com", "google", "syzkaller")
os.RemoveAll(mgrcfg.Workdir)
defer os.RemoveAll(mgrcfg.Workdir)
resp := &dashapi.JobDoneReq{
ID: req.ID,
Build: dashapi.Build{
Manager: mgr.name,
ID: req.ID,
OS: mgr.managercfg.TargetOS,
Arch: mgr.managercfg.TargetArch,
VMArch: mgr.managercfg.TargetVMArch,
SyzkallerCommit: req.SyzkallerCommit,
},
}
job.resp = resp
switch req.Type {
case dashapi.JobTestPatch:
mgrcfg.Name += "-test-job"
resp.Build.CompilerID = mgr.compilerID
resp.Build.KernelRepo = req.KernelRepo
resp.Build.KernelBranch = req.KernelBranch
resp.Build.KernelCommit = "[unknown]"
dashboard/app, syz-ci: bisection support This adds bulk of support for bisection to dashboard/app and syz-ci: - APIs to send bisection jobs and accept results - syz-ci logic to execute bisection jobs - formatting of emails with results - showing of results on dashboard Some difficulties we have to overcome: - since linux is frequently build/boot broken, lots of bisections are inconclusive, need to present such results too - git bisect is poorly suitable for automation, have to resort to output parsing (is output stable?) - git bisect turns out to fail (exit with non-0 status) when bisection is inconclusive (multiple potential cause commits) - older syzkaller revisions can't be built with newer (broken) kernel header, e.g.: ebtables.h:197:19: error: invalid conversion from ‘void*’ to ‘ebt_entry_target*’ - newer compilers produce more warnings and break old syzkaller builds, e.g.: kvm.S.h:6:12: error: ‘kvm_asm64_vm86’ defined but not used [-Werror=unused-const-variable=] - figuring relevant emails to CC from a commit is non-trivial: besides commit author, there can be some emails in commit tags, or not, which tags to use is an interesting question (some may include irrelevant emails) we can also run get_maintainers.pl on the commit, but this can produce too wide list if commit touches lots of files, it can also produce too small list, and then we need to resort to blame - for inconclusive bisection we probably don't need to include emails referenced in the commits (there can be too many of these commits) - need to be careful to exclude own syzbot email from commit CC list, now syzbot emails are referenced in some commits (Reported-by/Tested-by/etc) (can cause some kind of infinite recursion) - lots of commits reference stable mailing list, we should not include it in CC because it's referenced for backports rather then bug reports - since we add new Bug entity fields which we use in queries, whole datastore need to be upgrades to add the new field to index - we must not discard the crash that was used for bisection (treat it as a reported crash) - bisection results need 2 forms of reports: one when we add bisection results to already reported bug another when we report a bug first time with bisection results - when reporting a bug with bisection results we need to use the crash that was used for bisection - some fraction of bisections will probably fail with various errors and we will need some mechanism to retry bisection after the root cause is resolved this is not implemented yet - linux-next is problematic for 2 reasons: fix bisection can't possibly run on linux-next as commits are not reachable from HEAD lots of commits are missing in linux-next (even in linux-next-history) e.g. we have some c63e9e91a254a52 which is now missing in linux-next/linux-next-history - older kernels can't be build with fresh gcc/binutils/perl/make/glibc for now we have to stop at v3.9 (this only requires switching gcc several times along the way) - kernels past v4.11 do not build with gcc 7 and 8 (undefined reference to `____ilog2_NaN') - v4.1 and back have only compiler-gcc5.h - v3.17 and back have only compiler-gcc4.h - v3.6 and back do not have make olddefconfig - compat socket calls can't be bisected past "x86/entry/syscalls: Wire up 32-bit direct socket calls" (v4.10) because of https://syzkaller.appspot.com/bug?id=b5b150e322d5f48c869bcf1528cdbee08d1421cb - v2.6.28 and below does not work with modern make: *** mixed implicit and normal rules: deprecated syntax - v3.8 build fails: Can't use 'defined(@array)' (Maybe you should just omit the defined()?) at kernel/timeconst.pl line 373. kernel/Makefile:134: recipe for target 'kernel/timeconst.h' failed - make 3.81 works for v2.6.28. 3.81 almost works with current HEAD, you need to run make twice because first run spuriously fails with: - v2.6.28 with gcc-4.9.4 broken with: include/linux/kvm.h:240:9: error: duplicate member ‘padding’ - but even defconfig fails: VDSO arch/x86/vdso/vdso.so.dbg gcc: error: elf_x86_64: No such file or directory gcc: error: unrecognized command line option ‘-m’ It seems that we also need old binutils. - for v3.8 and below we need perl-5.14.4. Unfortunately this or any manually built perl doesn't work for later kernels: Can't locate strict.pm in @INC - kernels starting from 4.14 and older are boot broken: https://lkml.org/lkml/2018/9/7/648 - kernels older than 4.12 are broken during netdev setup (fixed by commit 675c8da049fd6556eb2d6cdd745fe812752f07a8) Update #501
2019-03-02 09:45:27 +01:00
case dashapi.JobBisectCause, dashapi.JobBisectFix:
mgrcfg.Name += "-bisect-job"
resp.Build.KernelRepo = mgr.mgrcfg.Repo
resp.Build.KernelBranch = mgr.mgrcfg.Branch
resp.Build.KernelCommit = req.KernelCommit
resp.Build.KernelCommitTitle = req.KernelCommitTitle
resp.Build.KernelCommitDate = req.KernelCommitDate
resp.Build.KernelConfig = req.KernelConfig
dashboard/app, syz-ci: bisection support This adds bulk of support for bisection to dashboard/app and syz-ci: - APIs to send bisection jobs and accept results - syz-ci logic to execute bisection jobs - formatting of emails with results - showing of results on dashboard Some difficulties we have to overcome: - since linux is frequently build/boot broken, lots of bisections are inconclusive, need to present such results too - git bisect is poorly suitable for automation, have to resort to output parsing (is output stable?) - git bisect turns out to fail (exit with non-0 status) when bisection is inconclusive (multiple potential cause commits) - older syzkaller revisions can't be built with newer (broken) kernel header, e.g.: ebtables.h:197:19: error: invalid conversion from ‘void*’ to ‘ebt_entry_target*’ - newer compilers produce more warnings and break old syzkaller builds, e.g.: kvm.S.h:6:12: error: ‘kvm_asm64_vm86’ defined but not used [-Werror=unused-const-variable=] - figuring relevant emails to CC from a commit is non-trivial: besides commit author, there can be some emails in commit tags, or not, which tags to use is an interesting question (some may include irrelevant emails) we can also run get_maintainers.pl on the commit, but this can produce too wide list if commit touches lots of files, it can also produce too small list, and then we need to resort to blame - for inconclusive bisection we probably don't need to include emails referenced in the commits (there can be too many of these commits) - need to be careful to exclude own syzbot email from commit CC list, now syzbot emails are referenced in some commits (Reported-by/Tested-by/etc) (can cause some kind of infinite recursion) - lots of commits reference stable mailing list, we should not include it in CC because it's referenced for backports rather then bug reports - since we add new Bug entity fields which we use in queries, whole datastore need to be upgrades to add the new field to index - we must not discard the crash that was used for bisection (treat it as a reported crash) - bisection results need 2 forms of reports: one when we add bisection results to already reported bug another when we report a bug first time with bisection results - when reporting a bug with bisection results we need to use the crash that was used for bisection - some fraction of bisections will probably fail with various errors and we will need some mechanism to retry bisection after the root cause is resolved this is not implemented yet - linux-next is problematic for 2 reasons: fix bisection can't possibly run on linux-next as commits are not reachable from HEAD lots of commits are missing in linux-next (even in linux-next-history) e.g. we have some c63e9e91a254a52 which is now missing in linux-next/linux-next-history - older kernels can't be build with fresh gcc/binutils/perl/make/glibc for now we have to stop at v3.9 (this only requires switching gcc several times along the way) - kernels past v4.11 do not build with gcc 7 and 8 (undefined reference to `____ilog2_NaN') - v4.1 and back have only compiler-gcc5.h - v3.17 and back have only compiler-gcc4.h - v3.6 and back do not have make olddefconfig - compat socket calls can't be bisected past "x86/entry/syscalls: Wire up 32-bit direct socket calls" (v4.10) because of https://syzkaller.appspot.com/bug?id=b5b150e322d5f48c869bcf1528cdbee08d1421cb - v2.6.28 and below does not work with modern make: *** mixed implicit and normal rules: deprecated syntax - v3.8 build fails: Can't use 'defined(@array)' (Maybe you should just omit the defined()?) at kernel/timeconst.pl line 373. kernel/Makefile:134: recipe for target 'kernel/timeconst.h' failed - make 3.81 works for v2.6.28. 3.81 almost works with current HEAD, you need to run make twice because first run spuriously fails with: - v2.6.28 with gcc-4.9.4 broken with: include/linux/kvm.h:240:9: error: duplicate member ‘padding’ - but even defconfig fails: VDSO arch/x86/vdso/vdso.so.dbg gcc: error: elf_x86_64: No such file or directory gcc: error: unrecognized command line option ‘-m’ It seems that we also need old binutils. - for v3.8 and below we need perl-5.14.4. Unfortunately this or any manually built perl doesn't work for later kernels: Can't locate strict.pm in @INC - kernels starting from 4.14 and older are boot broken: https://lkml.org/lkml/2018/9/7/648 - kernels older than 4.12 are broken during netdev setup (fixed by commit 675c8da049fd6556eb2d6cdd745fe812752f07a8) Update #501
2019-03-02 09:45:27 +01:00
default:
err := fmt.Errorf("bad job type %v", req.Type)
job.resp.Error = []byte(err.Error())
jp.Errorf("%s", err)
return job.resp
2017-11-16 11:08:01 +01:00
}
dashboard/app, syz-ci: bisection support This adds bulk of support for bisection to dashboard/app and syz-ci: - APIs to send bisection jobs and accept results - syz-ci logic to execute bisection jobs - formatting of emails with results - showing of results on dashboard Some difficulties we have to overcome: - since linux is frequently build/boot broken, lots of bisections are inconclusive, need to present such results too - git bisect is poorly suitable for automation, have to resort to output parsing (is output stable?) - git bisect turns out to fail (exit with non-0 status) when bisection is inconclusive (multiple potential cause commits) - older syzkaller revisions can't be built with newer (broken) kernel header, e.g.: ebtables.h:197:19: error: invalid conversion from ‘void*’ to ‘ebt_entry_target*’ - newer compilers produce more warnings and break old syzkaller builds, e.g.: kvm.S.h:6:12: error: ‘kvm_asm64_vm86’ defined but not used [-Werror=unused-const-variable=] - figuring relevant emails to CC from a commit is non-trivial: besides commit author, there can be some emails in commit tags, or not, which tags to use is an interesting question (some may include irrelevant emails) we can also run get_maintainers.pl on the commit, but this can produce too wide list if commit touches lots of files, it can also produce too small list, and then we need to resort to blame - for inconclusive bisection we probably don't need to include emails referenced in the commits (there can be too many of these commits) - need to be careful to exclude own syzbot email from commit CC list, now syzbot emails are referenced in some commits (Reported-by/Tested-by/etc) (can cause some kind of infinite recursion) - lots of commits reference stable mailing list, we should not include it in CC because it's referenced for backports rather then bug reports - since we add new Bug entity fields which we use in queries, whole datastore need to be upgrades to add the new field to index - we must not discard the crash that was used for bisection (treat it as a reported crash) - bisection results need 2 forms of reports: one when we add bisection results to already reported bug another when we report a bug first time with bisection results - when reporting a bug with bisection results we need to use the crash that was used for bisection - some fraction of bisections will probably fail with various errors and we will need some mechanism to retry bisection after the root cause is resolved this is not implemented yet - linux-next is problematic for 2 reasons: fix bisection can't possibly run on linux-next as commits are not reachable from HEAD lots of commits are missing in linux-next (even in linux-next-history) e.g. we have some c63e9e91a254a52 which is now missing in linux-next/linux-next-history - older kernels can't be build with fresh gcc/binutils/perl/make/glibc for now we have to stop at v3.9 (this only requires switching gcc several times along the way) - kernels past v4.11 do not build with gcc 7 and 8 (undefined reference to `____ilog2_NaN') - v4.1 and back have only compiler-gcc5.h - v3.17 and back have only compiler-gcc4.h - v3.6 and back do not have make olddefconfig - compat socket calls can't be bisected past "x86/entry/syscalls: Wire up 32-bit direct socket calls" (v4.10) because of https://syzkaller.appspot.com/bug?id=b5b150e322d5f48c869bcf1528cdbee08d1421cb - v2.6.28 and below does not work with modern make: *** mixed implicit and normal rules: deprecated syntax - v3.8 build fails: Can't use 'defined(@array)' (Maybe you should just omit the defined()?) at kernel/timeconst.pl line 373. kernel/Makefile:134: recipe for target 'kernel/timeconst.h' failed - make 3.81 works for v2.6.28. 3.81 almost works with current HEAD, you need to run make twice because first run spuriously fails with: - v2.6.28 with gcc-4.9.4 broken with: include/linux/kvm.h:240:9: error: duplicate member ‘padding’ - but even defconfig fails: VDSO arch/x86/vdso/vdso.so.dbg gcc: error: elf_x86_64: No such file or directory gcc: error: unrecognized command line option ‘-m’ It seems that we also need old binutils. - for v3.8 and below we need perl-5.14.4. Unfortunately this or any manually built perl doesn't work for later kernels: Can't locate strict.pm in @INC - kernels starting from 4.14 and older are boot broken: https://lkml.org/lkml/2018/9/7/648 - kernels older than 4.12 are broken during netdev setup (fixed by commit 675c8da049fd6556eb2d6cdd745fe812752f07a8) Update #501
2019-03-02 09:45:27 +01:00
2017-11-16 11:08:01 +01:00
required := []struct {
name string
ok bool
}{
dashboard/app, syz-ci: bisection support This adds bulk of support for bisection to dashboard/app and syz-ci: - APIs to send bisection jobs and accept results - syz-ci logic to execute bisection jobs - formatting of emails with results - showing of results on dashboard Some difficulties we have to overcome: - since linux is frequently build/boot broken, lots of bisections are inconclusive, need to present such results too - git bisect is poorly suitable for automation, have to resort to output parsing (is output stable?) - git bisect turns out to fail (exit with non-0 status) when bisection is inconclusive (multiple potential cause commits) - older syzkaller revisions can't be built with newer (broken) kernel header, e.g.: ebtables.h:197:19: error: invalid conversion from ‘void*’ to ‘ebt_entry_target*’ - newer compilers produce more warnings and break old syzkaller builds, e.g.: kvm.S.h:6:12: error: ‘kvm_asm64_vm86’ defined but not used [-Werror=unused-const-variable=] - figuring relevant emails to CC from a commit is non-trivial: besides commit author, there can be some emails in commit tags, or not, which tags to use is an interesting question (some may include irrelevant emails) we can also run get_maintainers.pl on the commit, but this can produce too wide list if commit touches lots of files, it can also produce too small list, and then we need to resort to blame - for inconclusive bisection we probably don't need to include emails referenced in the commits (there can be too many of these commits) - need to be careful to exclude own syzbot email from commit CC list, now syzbot emails are referenced in some commits (Reported-by/Tested-by/etc) (can cause some kind of infinite recursion) - lots of commits reference stable mailing list, we should not include it in CC because it's referenced for backports rather then bug reports - since we add new Bug entity fields which we use in queries, whole datastore need to be upgrades to add the new field to index - we must not discard the crash that was used for bisection (treat it as a reported crash) - bisection results need 2 forms of reports: one when we add bisection results to already reported bug another when we report a bug first time with bisection results - when reporting a bug with bisection results we need to use the crash that was used for bisection - some fraction of bisections will probably fail with various errors and we will need some mechanism to retry bisection after the root cause is resolved this is not implemented yet - linux-next is problematic for 2 reasons: fix bisection can't possibly run on linux-next as commits are not reachable from HEAD lots of commits are missing in linux-next (even in linux-next-history) e.g. we have some c63e9e91a254a52 which is now missing in linux-next/linux-next-history - older kernels can't be build with fresh gcc/binutils/perl/make/glibc for now we have to stop at v3.9 (this only requires switching gcc several times along the way) - kernels past v4.11 do not build with gcc 7 and 8 (undefined reference to `____ilog2_NaN') - v4.1 and back have only compiler-gcc5.h - v3.17 and back have only compiler-gcc4.h - v3.6 and back do not have make olddefconfig - compat socket calls can't be bisected past "x86/entry/syscalls: Wire up 32-bit direct socket calls" (v4.10) because of https://syzkaller.appspot.com/bug?id=b5b150e322d5f48c869bcf1528cdbee08d1421cb - v2.6.28 and below does not work with modern make: *** mixed implicit and normal rules: deprecated syntax - v3.8 build fails: Can't use 'defined(@array)' (Maybe you should just omit the defined()?) at kernel/timeconst.pl line 373. kernel/Makefile:134: recipe for target 'kernel/timeconst.h' failed - make 3.81 works for v2.6.28. 3.81 almost works with current HEAD, you need to run make twice because first run spuriously fails with: - v2.6.28 with gcc-4.9.4 broken with: include/linux/kvm.h:240:9: error: duplicate member ‘padding’ - but even defconfig fails: VDSO arch/x86/vdso/vdso.so.dbg gcc: error: elf_x86_64: No such file or directory gcc: error: unrecognized command line option ‘-m’ It seems that we also need old binutils. - for v3.8 and below we need perl-5.14.4. Unfortunately this or any manually built perl doesn't work for later kernels: Can't locate strict.pm in @INC - kernels starting from 4.14 and older are boot broken: https://lkml.org/lkml/2018/9/7/648 - kernels older than 4.12 are broken during netdev setup (fixed by commit 675c8da049fd6556eb2d6cdd745fe812752f07a8) Update #501
2019-03-02 09:45:27 +01:00
{"kernel repository", req.KernelRepo != "" || req.Type != dashapi.JobTestPatch},
{"kernel branch", req.KernelBranch != "" || req.Type != dashapi.JobTestPatch},
2017-11-16 11:08:01 +01:00
{"kernel config", len(req.KernelConfig) != 0},
{"syzkaller commit", req.SyzkallerCommit != ""},
{"reproducer options", len(req.ReproOpts) != 0},
{"reproducer program", len(req.ReproSyz) != 0},
}
for _, req := range required {
if !req.ok {
job.resp.Error = []byte(req.name + " is empty")
jp.Errorf("%s", job.resp.Error)
2017-11-16 11:08:01 +01:00
return job.resp
}
}
if typ := mgr.managercfg.Type; !vm.AllowsOvercommit(typ) {
2017-11-16 11:08:01 +01:00
job.resp.Error = []byte(fmt.Sprintf("testing is not yet supported for %v machine type.", typ))
jp.Errorf("%s", job.resp.Error)
2017-11-16 11:08:01 +01:00
return job.resp
}
dashboard/app, syz-ci: bisection support This adds bulk of support for bisection to dashboard/app and syz-ci: - APIs to send bisection jobs and accept results - syz-ci logic to execute bisection jobs - formatting of emails with results - showing of results on dashboard Some difficulties we have to overcome: - since linux is frequently build/boot broken, lots of bisections are inconclusive, need to present such results too - git bisect is poorly suitable for automation, have to resort to output parsing (is output stable?) - git bisect turns out to fail (exit with non-0 status) when bisection is inconclusive (multiple potential cause commits) - older syzkaller revisions can't be built with newer (broken) kernel header, e.g.: ebtables.h:197:19: error: invalid conversion from ‘void*’ to ‘ebt_entry_target*’ - newer compilers produce more warnings and break old syzkaller builds, e.g.: kvm.S.h:6:12: error: ‘kvm_asm64_vm86’ defined but not used [-Werror=unused-const-variable=] - figuring relevant emails to CC from a commit is non-trivial: besides commit author, there can be some emails in commit tags, or not, which tags to use is an interesting question (some may include irrelevant emails) we can also run get_maintainers.pl on the commit, but this can produce too wide list if commit touches lots of files, it can also produce too small list, and then we need to resort to blame - for inconclusive bisection we probably don't need to include emails referenced in the commits (there can be too many of these commits) - need to be careful to exclude own syzbot email from commit CC list, now syzbot emails are referenced in some commits (Reported-by/Tested-by/etc) (can cause some kind of infinite recursion) - lots of commits reference stable mailing list, we should not include it in CC because it's referenced for backports rather then bug reports - since we add new Bug entity fields which we use in queries, whole datastore need to be upgrades to add the new field to index - we must not discard the crash that was used for bisection (treat it as a reported crash) - bisection results need 2 forms of reports: one when we add bisection results to already reported bug another when we report a bug first time with bisection results - when reporting a bug with bisection results we need to use the crash that was used for bisection - some fraction of bisections will probably fail with various errors and we will need some mechanism to retry bisection after the root cause is resolved this is not implemented yet - linux-next is problematic for 2 reasons: fix bisection can't possibly run on linux-next as commits are not reachable from HEAD lots of commits are missing in linux-next (even in linux-next-history) e.g. we have some c63e9e91a254a52 which is now missing in linux-next/linux-next-history - older kernels can't be build with fresh gcc/binutils/perl/make/glibc for now we have to stop at v3.9 (this only requires switching gcc several times along the way) - kernels past v4.11 do not build with gcc 7 and 8 (undefined reference to `____ilog2_NaN') - v4.1 and back have only compiler-gcc5.h - v3.17 and back have only compiler-gcc4.h - v3.6 and back do not have make olddefconfig - compat socket calls can't be bisected past "x86/entry/syscalls: Wire up 32-bit direct socket calls" (v4.10) because of https://syzkaller.appspot.com/bug?id=b5b150e322d5f48c869bcf1528cdbee08d1421cb - v2.6.28 and below does not work with modern make: *** mixed implicit and normal rules: deprecated syntax - v3.8 build fails: Can't use 'defined(@array)' (Maybe you should just omit the defined()?) at kernel/timeconst.pl line 373. kernel/Makefile:134: recipe for target 'kernel/timeconst.h' failed - make 3.81 works for v2.6.28. 3.81 almost works with current HEAD, you need to run make twice because first run spuriously fails with: - v2.6.28 with gcc-4.9.4 broken with: include/linux/kvm.h:240:9: error: duplicate member ‘padding’ - but even defconfig fails: VDSO arch/x86/vdso/vdso.so.dbg gcc: error: elf_x86_64: No such file or directory gcc: error: unrecognized command line option ‘-m’ It seems that we also need old binutils. - for v3.8 and below we need perl-5.14.4. Unfortunately this or any manually built perl doesn't work for later kernels: Can't locate strict.pm in @INC - kernels starting from 4.14 and older are boot broken: https://lkml.org/lkml/2018/9/7/648 - kernels older than 4.12 are broken during netdev setup (fixed by commit 675c8da049fd6556eb2d6cdd745fe812752f07a8) Update #501
2019-03-02 09:45:27 +01:00
var err error
switch req.Type {
case dashapi.JobTestPatch:
mgrcfg.Name += "-test-job"
err = jp.testPatch(job, mgrcfg)
case dashapi.JobBisectCause, dashapi.JobBisectFix:
mgrcfg.Name += "-bisect-job"
err = jp.bisect(job, mgrcfg)
}
if err != nil {
2017-11-16 11:08:01 +01:00
job.resp.Error = []byte(err.Error())
}
return job.resp
}
dashboard/app, syz-ci: bisection support This adds bulk of support for bisection to dashboard/app and syz-ci: - APIs to send bisection jobs and accept results - syz-ci logic to execute bisection jobs - formatting of emails with results - showing of results on dashboard Some difficulties we have to overcome: - since linux is frequently build/boot broken, lots of bisections are inconclusive, need to present such results too - git bisect is poorly suitable for automation, have to resort to output parsing (is output stable?) - git bisect turns out to fail (exit with non-0 status) when bisection is inconclusive (multiple potential cause commits) - older syzkaller revisions can't be built with newer (broken) kernel header, e.g.: ebtables.h:197:19: error: invalid conversion from ‘void*’ to ‘ebt_entry_target*’ - newer compilers produce more warnings and break old syzkaller builds, e.g.: kvm.S.h:6:12: error: ‘kvm_asm64_vm86’ defined but not used [-Werror=unused-const-variable=] - figuring relevant emails to CC from a commit is non-trivial: besides commit author, there can be some emails in commit tags, or not, which tags to use is an interesting question (some may include irrelevant emails) we can also run get_maintainers.pl on the commit, but this can produce too wide list if commit touches lots of files, it can also produce too small list, and then we need to resort to blame - for inconclusive bisection we probably don't need to include emails referenced in the commits (there can be too many of these commits) - need to be careful to exclude own syzbot email from commit CC list, now syzbot emails are referenced in some commits (Reported-by/Tested-by/etc) (can cause some kind of infinite recursion) - lots of commits reference stable mailing list, we should not include it in CC because it's referenced for backports rather then bug reports - since we add new Bug entity fields which we use in queries, whole datastore need to be upgrades to add the new field to index - we must not discard the crash that was used for bisection (treat it as a reported crash) - bisection results need 2 forms of reports: one when we add bisection results to already reported bug another when we report a bug first time with bisection results - when reporting a bug with bisection results we need to use the crash that was used for bisection - some fraction of bisections will probably fail with various errors and we will need some mechanism to retry bisection after the root cause is resolved this is not implemented yet - linux-next is problematic for 2 reasons: fix bisection can't possibly run on linux-next as commits are not reachable from HEAD lots of commits are missing in linux-next (even in linux-next-history) e.g. we have some c63e9e91a254a52 which is now missing in linux-next/linux-next-history - older kernels can't be build with fresh gcc/binutils/perl/make/glibc for now we have to stop at v3.9 (this only requires switching gcc several times along the way) - kernels past v4.11 do not build with gcc 7 and 8 (undefined reference to `____ilog2_NaN') - v4.1 and back have only compiler-gcc5.h - v3.17 and back have only compiler-gcc4.h - v3.6 and back do not have make olddefconfig - compat socket calls can't be bisected past "x86/entry/syscalls: Wire up 32-bit direct socket calls" (v4.10) because of https://syzkaller.appspot.com/bug?id=b5b150e322d5f48c869bcf1528cdbee08d1421cb - v2.6.28 and below does not work with modern make: *** mixed implicit and normal rules: deprecated syntax - v3.8 build fails: Can't use 'defined(@array)' (Maybe you should just omit the defined()?) at kernel/timeconst.pl line 373. kernel/Makefile:134: recipe for target 'kernel/timeconst.h' failed - make 3.81 works for v2.6.28. 3.81 almost works with current HEAD, you need to run make twice because first run spuriously fails with: - v2.6.28 with gcc-4.9.4 broken with: include/linux/kvm.h:240:9: error: duplicate member ‘padding’ - but even defconfig fails: VDSO arch/x86/vdso/vdso.so.dbg gcc: error: elf_x86_64: No such file or directory gcc: error: unrecognized command line option ‘-m’ It seems that we also need old binutils. - for v3.8 and below we need perl-5.14.4. Unfortunately this or any manually built perl doesn't work for later kernels: Can't locate strict.pm in @INC - kernels starting from 4.14 and older are boot broken: https://lkml.org/lkml/2018/9/7/648 - kernels older than 4.12 are broken during netdev setup (fixed by commit 675c8da049fd6556eb2d6cdd745fe812752f07a8) Update #501
2019-03-02 09:45:27 +01:00
func (jp *JobProcessor) bisect(job *Job, mgrcfg *mgrconfig.Config) error {
2017-11-16 11:08:01 +01:00
req, resp, mgr := job.req, job.resp, job.mgr
// Hack: if the manager has only, say, 5 VMs, but bisect wants 10, try to override number of VMs to 10.
// OverrideVMCount is opportunistic and should do it only if it's safe.
if err := instance.OverrideVMCount(mgrcfg, bisect.NumTests); err != nil {
return err
}
var baseline []byte
2020-06-25 18:36:11 +02:00
// Read possible baseline for config minimization.
if mgr.mgrcfg.KernelBaselineConfig != "" {
var err error
baseline, err = ioutil.ReadFile(mgr.mgrcfg.KernelBaselineConfig)
if err != nil {
2020-06-25 18:36:11 +02:00
return fmt.Errorf("failed to read baseline config: %v", err)
}
}
dashboard/app, syz-ci: bisection support This adds bulk of support for bisection to dashboard/app and syz-ci: - APIs to send bisection jobs and accept results - syz-ci logic to execute bisection jobs - formatting of emails with results - showing of results on dashboard Some difficulties we have to overcome: - since linux is frequently build/boot broken, lots of bisections are inconclusive, need to present such results too - git bisect is poorly suitable for automation, have to resort to output parsing (is output stable?) - git bisect turns out to fail (exit with non-0 status) when bisection is inconclusive (multiple potential cause commits) - older syzkaller revisions can't be built with newer (broken) kernel header, e.g.: ebtables.h:197:19: error: invalid conversion from ‘void*’ to ‘ebt_entry_target*’ - newer compilers produce more warnings and break old syzkaller builds, e.g.: kvm.S.h:6:12: error: ‘kvm_asm64_vm86’ defined but not used [-Werror=unused-const-variable=] - figuring relevant emails to CC from a commit is non-trivial: besides commit author, there can be some emails in commit tags, or not, which tags to use is an interesting question (some may include irrelevant emails) we can also run get_maintainers.pl on the commit, but this can produce too wide list if commit touches lots of files, it can also produce too small list, and then we need to resort to blame - for inconclusive bisection we probably don't need to include emails referenced in the commits (there can be too many of these commits) - need to be careful to exclude own syzbot email from commit CC list, now syzbot emails are referenced in some commits (Reported-by/Tested-by/etc) (can cause some kind of infinite recursion) - lots of commits reference stable mailing list, we should not include it in CC because it's referenced for backports rather then bug reports - since we add new Bug entity fields which we use in queries, whole datastore need to be upgrades to add the new field to index - we must not discard the crash that was used for bisection (treat it as a reported crash) - bisection results need 2 forms of reports: one when we add bisection results to already reported bug another when we report a bug first time with bisection results - when reporting a bug with bisection results we need to use the crash that was used for bisection - some fraction of bisections will probably fail with various errors and we will need some mechanism to retry bisection after the root cause is resolved this is not implemented yet - linux-next is problematic for 2 reasons: fix bisection can't possibly run on linux-next as commits are not reachable from HEAD lots of commits are missing in linux-next (even in linux-next-history) e.g. we have some c63e9e91a254a52 which is now missing in linux-next/linux-next-history - older kernels can't be build with fresh gcc/binutils/perl/make/glibc for now we have to stop at v3.9 (this only requires switching gcc several times along the way) - kernels past v4.11 do not build with gcc 7 and 8 (undefined reference to `____ilog2_NaN') - v4.1 and back have only compiler-gcc5.h - v3.17 and back have only compiler-gcc4.h - v3.6 and back do not have make olddefconfig - compat socket calls can't be bisected past "x86/entry/syscalls: Wire up 32-bit direct socket calls" (v4.10) because of https://syzkaller.appspot.com/bug?id=b5b150e322d5f48c869bcf1528cdbee08d1421cb - v2.6.28 and below does not work with modern make: *** mixed implicit and normal rules: deprecated syntax - v3.8 build fails: Can't use 'defined(@array)' (Maybe you should just omit the defined()?) at kernel/timeconst.pl line 373. kernel/Makefile:134: recipe for target 'kernel/timeconst.h' failed - make 3.81 works for v2.6.28. 3.81 almost works with current HEAD, you need to run make twice because first run spuriously fails with: - v2.6.28 with gcc-4.9.4 broken with: include/linux/kvm.h:240:9: error: duplicate member ‘padding’ - but even defconfig fails: VDSO arch/x86/vdso/vdso.so.dbg gcc: error: elf_x86_64: No such file or directory gcc: error: unrecognized command line option ‘-m’ It seems that we also need old binutils. - for v3.8 and below we need perl-5.14.4. Unfortunately this or any manually built perl doesn't work for later kernels: Can't locate strict.pm in @INC - kernels starting from 4.14 and older are boot broken: https://lkml.org/lkml/2018/9/7/648 - kernels older than 4.12 are broken during netdev setup (fixed by commit 675c8da049fd6556eb2d6cdd745fe812752f07a8) Update #501
2019-03-02 09:45:27 +01:00
trace := new(bytes.Buffer)
cfg := &bisect.Config{
Trace: io.MultiWriter(trace, log.VerboseWriter(3)),
DebugDir: osutil.Abs(filepath.Join("jobs", "debug", strings.Replace(req.ID, "|", "_", -1))),
// Out of 1049 cause bisections that we have now:
// - 891 finished under 6h (84.9%)
// - 957 finished under 8h (91.2%)
// - 980 finished under 10h (93.4%)
// - 989 finished under 12h (94.3%)
// - 1011 finished under 18h (96.3%)
// - 1025 finished under 24h (97.7%)
// There is also a significant increase in errors/inconclusive bisections after ~8h.
// Out of 4075 fix bisections:
// - 4015 finished under 6h (98.5%)
// - 4020 finished under 8h (98.7%)
// - 4026 finished under 10h (98.8%)
// - 4032 finished under 12h (98.9%)
// Significant increase in errors starts after ~12h.
// The current timeout also take into account that bisection jobs
// compete with patch testing jobs (it's bad delaying patch testing).
// When/if bisection jobs don't compete with patch testing,
// it makes sense to increase this to 12-24h.
Timeout: 8 * time.Hour,
Fix: req.Type == dashapi.JobBisectFix,
BinDir: jp.cfg.BisectBinDir,
dashboard/app, syz-ci: bisection support This adds bulk of support for bisection to dashboard/app and syz-ci: - APIs to send bisection jobs and accept results - syz-ci logic to execute bisection jobs - formatting of emails with results - showing of results on dashboard Some difficulties we have to overcome: - since linux is frequently build/boot broken, lots of bisections are inconclusive, need to present such results too - git bisect is poorly suitable for automation, have to resort to output parsing (is output stable?) - git bisect turns out to fail (exit with non-0 status) when bisection is inconclusive (multiple potential cause commits) - older syzkaller revisions can't be built with newer (broken) kernel header, e.g.: ebtables.h:197:19: error: invalid conversion from ‘void*’ to ‘ebt_entry_target*’ - newer compilers produce more warnings and break old syzkaller builds, e.g.: kvm.S.h:6:12: error: ‘kvm_asm64_vm86’ defined but not used [-Werror=unused-const-variable=] - figuring relevant emails to CC from a commit is non-trivial: besides commit author, there can be some emails in commit tags, or not, which tags to use is an interesting question (some may include irrelevant emails) we can also run get_maintainers.pl on the commit, but this can produce too wide list if commit touches lots of files, it can also produce too small list, and then we need to resort to blame - for inconclusive bisection we probably don't need to include emails referenced in the commits (there can be too many of these commits) - need to be careful to exclude own syzbot email from commit CC list, now syzbot emails are referenced in some commits (Reported-by/Tested-by/etc) (can cause some kind of infinite recursion) - lots of commits reference stable mailing list, we should not include it in CC because it's referenced for backports rather then bug reports - since we add new Bug entity fields which we use in queries, whole datastore need to be upgrades to add the new field to index - we must not discard the crash that was used for bisection (treat it as a reported crash) - bisection results need 2 forms of reports: one when we add bisection results to already reported bug another when we report a bug first time with bisection results - when reporting a bug with bisection results we need to use the crash that was used for bisection - some fraction of bisections will probably fail with various errors and we will need some mechanism to retry bisection after the root cause is resolved this is not implemented yet - linux-next is problematic for 2 reasons: fix bisection can't possibly run on linux-next as commits are not reachable from HEAD lots of commits are missing in linux-next (even in linux-next-history) e.g. we have some c63e9e91a254a52 which is now missing in linux-next/linux-next-history - older kernels can't be build with fresh gcc/binutils/perl/make/glibc for now we have to stop at v3.9 (this only requires switching gcc several times along the way) - kernels past v4.11 do not build with gcc 7 and 8 (undefined reference to `____ilog2_NaN') - v4.1 and back have only compiler-gcc5.h - v3.17 and back have only compiler-gcc4.h - v3.6 and back do not have make olddefconfig - compat socket calls can't be bisected past "x86/entry/syscalls: Wire up 32-bit direct socket calls" (v4.10) because of https://syzkaller.appspot.com/bug?id=b5b150e322d5f48c869bcf1528cdbee08d1421cb - v2.6.28 and below does not work with modern make: *** mixed implicit and normal rules: deprecated syntax - v3.8 build fails: Can't use 'defined(@array)' (Maybe you should just omit the defined()?) at kernel/timeconst.pl line 373. kernel/Makefile:134: recipe for target 'kernel/timeconst.h' failed - make 3.81 works for v2.6.28. 3.81 almost works with current HEAD, you need to run make twice because first run spuriously fails with: - v2.6.28 with gcc-4.9.4 broken with: include/linux/kvm.h:240:9: error: duplicate member ‘padding’ - but even defconfig fails: VDSO arch/x86/vdso/vdso.so.dbg gcc: error: elf_x86_64: No such file or directory gcc: error: unrecognized command line option ‘-m’ It seems that we also need old binutils. - for v3.8 and below we need perl-5.14.4. Unfortunately this or any manually built perl doesn't work for later kernels: Can't locate strict.pm in @INC - kernels starting from 4.14 and older are boot broken: https://lkml.org/lkml/2018/9/7/648 - kernels older than 4.12 are broken during netdev setup (fixed by commit 675c8da049fd6556eb2d6cdd745fe812752f07a8) Update #501
2019-03-02 09:45:27 +01:00
Kernel: bisect.KernelConfig{
Repo: mgr.mgrcfg.Repo,
Branch: mgr.mgrcfg.Branch,
Commit: req.KernelCommit,
Cmdline: mgr.mgrcfg.KernelCmdline,
Sysctl: mgr.mgrcfg.KernelSysctl,
Config: req.KernelConfig,
BaselineConfig: baseline,
Userspace: mgr.mgrcfg.Userspace,
dashboard/app, syz-ci: bisection support This adds bulk of support for bisection to dashboard/app and syz-ci: - APIs to send bisection jobs and accept results - syz-ci logic to execute bisection jobs - formatting of emails with results - showing of results on dashboard Some difficulties we have to overcome: - since linux is frequently build/boot broken, lots of bisections are inconclusive, need to present such results too - git bisect is poorly suitable for automation, have to resort to output parsing (is output stable?) - git bisect turns out to fail (exit with non-0 status) when bisection is inconclusive (multiple potential cause commits) - older syzkaller revisions can't be built with newer (broken) kernel header, e.g.: ebtables.h:197:19: error: invalid conversion from ‘void*’ to ‘ebt_entry_target*’ - newer compilers produce more warnings and break old syzkaller builds, e.g.: kvm.S.h:6:12: error: ‘kvm_asm64_vm86’ defined but not used [-Werror=unused-const-variable=] - figuring relevant emails to CC from a commit is non-trivial: besides commit author, there can be some emails in commit tags, or not, which tags to use is an interesting question (some may include irrelevant emails) we can also run get_maintainers.pl on the commit, but this can produce too wide list if commit touches lots of files, it can also produce too small list, and then we need to resort to blame - for inconclusive bisection we probably don't need to include emails referenced in the commits (there can be too many of these commits) - need to be careful to exclude own syzbot email from commit CC list, now syzbot emails are referenced in some commits (Reported-by/Tested-by/etc) (can cause some kind of infinite recursion) - lots of commits reference stable mailing list, we should not include it in CC because it's referenced for backports rather then bug reports - since we add new Bug entity fields which we use in queries, whole datastore need to be upgrades to add the new field to index - we must not discard the crash that was used for bisection (treat it as a reported crash) - bisection results need 2 forms of reports: one when we add bisection results to already reported bug another when we report a bug first time with bisection results - when reporting a bug with bisection results we need to use the crash that was used for bisection - some fraction of bisections will probably fail with various errors and we will need some mechanism to retry bisection after the root cause is resolved this is not implemented yet - linux-next is problematic for 2 reasons: fix bisection can't possibly run on linux-next as commits are not reachable from HEAD lots of commits are missing in linux-next (even in linux-next-history) e.g. we have some c63e9e91a254a52 which is now missing in linux-next/linux-next-history - older kernels can't be build with fresh gcc/binutils/perl/make/glibc for now we have to stop at v3.9 (this only requires switching gcc several times along the way) - kernels past v4.11 do not build with gcc 7 and 8 (undefined reference to `____ilog2_NaN') - v4.1 and back have only compiler-gcc5.h - v3.17 and back have only compiler-gcc4.h - v3.6 and back do not have make olddefconfig - compat socket calls can't be bisected past "x86/entry/syscalls: Wire up 32-bit direct socket calls" (v4.10) because of https://syzkaller.appspot.com/bug?id=b5b150e322d5f48c869bcf1528cdbee08d1421cb - v2.6.28 and below does not work with modern make: *** mixed implicit and normal rules: deprecated syntax - v3.8 build fails: Can't use 'defined(@array)' (Maybe you should just omit the defined()?) at kernel/timeconst.pl line 373. kernel/Makefile:134: recipe for target 'kernel/timeconst.h' failed - make 3.81 works for v2.6.28. 3.81 almost works with current HEAD, you need to run make twice because first run spuriously fails with: - v2.6.28 with gcc-4.9.4 broken with: include/linux/kvm.h:240:9: error: duplicate member ‘padding’ - but even defconfig fails: VDSO arch/x86/vdso/vdso.so.dbg gcc: error: elf_x86_64: No such file or directory gcc: error: unrecognized command line option ‘-m’ It seems that we also need old binutils. - for v3.8 and below we need perl-5.14.4. Unfortunately this or any manually built perl doesn't work for later kernels: Can't locate strict.pm in @INC - kernels starting from 4.14 and older are boot broken: https://lkml.org/lkml/2018/9/7/648 - kernels older than 4.12 are broken during netdev setup (fixed by commit 675c8da049fd6556eb2d6cdd745fe812752f07a8) Update #501
2019-03-02 09:45:27 +01:00
},
Syzkaller: bisect.SyzkallerConfig{
Repo: jp.syzkallerRepo,
Commit: req.SyzkallerCommit,
},
Repro: bisect.ReproConfig{
Opts: req.ReproOpts,
Syz: req.ReproSyz,
C: req.ReproC,
},
Manager: *mgrcfg,
}
res, err := bisect.Run(cfg)
dashboard/app, syz-ci: bisection support This adds bulk of support for bisection to dashboard/app and syz-ci: - APIs to send bisection jobs and accept results - syz-ci logic to execute bisection jobs - formatting of emails with results - showing of results on dashboard Some difficulties we have to overcome: - since linux is frequently build/boot broken, lots of bisections are inconclusive, need to present such results too - git bisect is poorly suitable for automation, have to resort to output parsing (is output stable?) - git bisect turns out to fail (exit with non-0 status) when bisection is inconclusive (multiple potential cause commits) - older syzkaller revisions can't be built with newer (broken) kernel header, e.g.: ebtables.h:197:19: error: invalid conversion from ‘void*’ to ‘ebt_entry_target*’ - newer compilers produce more warnings and break old syzkaller builds, e.g.: kvm.S.h:6:12: error: ‘kvm_asm64_vm86’ defined but not used [-Werror=unused-const-variable=] - figuring relevant emails to CC from a commit is non-trivial: besides commit author, there can be some emails in commit tags, or not, which tags to use is an interesting question (some may include irrelevant emails) we can also run get_maintainers.pl on the commit, but this can produce too wide list if commit touches lots of files, it can also produce too small list, and then we need to resort to blame - for inconclusive bisection we probably don't need to include emails referenced in the commits (there can be too many of these commits) - need to be careful to exclude own syzbot email from commit CC list, now syzbot emails are referenced in some commits (Reported-by/Tested-by/etc) (can cause some kind of infinite recursion) - lots of commits reference stable mailing list, we should not include it in CC because it's referenced for backports rather then bug reports - since we add new Bug entity fields which we use in queries, whole datastore need to be upgrades to add the new field to index - we must not discard the crash that was used for bisection (treat it as a reported crash) - bisection results need 2 forms of reports: one when we add bisection results to already reported bug another when we report a bug first time with bisection results - when reporting a bug with bisection results we need to use the crash that was used for bisection - some fraction of bisections will probably fail with various errors and we will need some mechanism to retry bisection after the root cause is resolved this is not implemented yet - linux-next is problematic for 2 reasons: fix bisection can't possibly run on linux-next as commits are not reachable from HEAD lots of commits are missing in linux-next (even in linux-next-history) e.g. we have some c63e9e91a254a52 which is now missing in linux-next/linux-next-history - older kernels can't be build with fresh gcc/binutils/perl/make/glibc for now we have to stop at v3.9 (this only requires switching gcc several times along the way) - kernels past v4.11 do not build with gcc 7 and 8 (undefined reference to `____ilog2_NaN') - v4.1 and back have only compiler-gcc5.h - v3.17 and back have only compiler-gcc4.h - v3.6 and back do not have make olddefconfig - compat socket calls can't be bisected past "x86/entry/syscalls: Wire up 32-bit direct socket calls" (v4.10) because of https://syzkaller.appspot.com/bug?id=b5b150e322d5f48c869bcf1528cdbee08d1421cb - v2.6.28 and below does not work with modern make: *** mixed implicit and normal rules: deprecated syntax - v3.8 build fails: Can't use 'defined(@array)' (Maybe you should just omit the defined()?) at kernel/timeconst.pl line 373. kernel/Makefile:134: recipe for target 'kernel/timeconst.h' failed - make 3.81 works for v2.6.28. 3.81 almost works with current HEAD, you need to run make twice because first run spuriously fails with: - v2.6.28 with gcc-4.9.4 broken with: include/linux/kvm.h:240:9: error: duplicate member ‘padding’ - but even defconfig fails: VDSO arch/x86/vdso/vdso.so.dbg gcc: error: elf_x86_64: No such file or directory gcc: error: unrecognized command line option ‘-m’ It seems that we also need old binutils. - for v3.8 and below we need perl-5.14.4. Unfortunately this or any manually built perl doesn't work for later kernels: Can't locate strict.pm in @INC - kernels starting from 4.14 and older are boot broken: https://lkml.org/lkml/2018/9/7/648 - kernels older than 4.12 are broken during netdev setup (fixed by commit 675c8da049fd6556eb2d6cdd745fe812752f07a8) Update #501
2019-03-02 09:45:27 +01:00
resp.Log = trace.Bytes()
if err != nil {
return err
}
for _, com := range res.Commits {
dashboard/app, syz-ci: bisection support This adds bulk of support for bisection to dashboard/app and syz-ci: - APIs to send bisection jobs and accept results - syz-ci logic to execute bisection jobs - formatting of emails with results - showing of results on dashboard Some difficulties we have to overcome: - since linux is frequently build/boot broken, lots of bisections are inconclusive, need to present such results too - git bisect is poorly suitable for automation, have to resort to output parsing (is output stable?) - git bisect turns out to fail (exit with non-0 status) when bisection is inconclusive (multiple potential cause commits) - older syzkaller revisions can't be built with newer (broken) kernel header, e.g.: ebtables.h:197:19: error: invalid conversion from ‘void*’ to ‘ebt_entry_target*’ - newer compilers produce more warnings and break old syzkaller builds, e.g.: kvm.S.h:6:12: error: ‘kvm_asm64_vm86’ defined but not used [-Werror=unused-const-variable=] - figuring relevant emails to CC from a commit is non-trivial: besides commit author, there can be some emails in commit tags, or not, which tags to use is an interesting question (some may include irrelevant emails) we can also run get_maintainers.pl on the commit, but this can produce too wide list if commit touches lots of files, it can also produce too small list, and then we need to resort to blame - for inconclusive bisection we probably don't need to include emails referenced in the commits (there can be too many of these commits) - need to be careful to exclude own syzbot email from commit CC list, now syzbot emails are referenced in some commits (Reported-by/Tested-by/etc) (can cause some kind of infinite recursion) - lots of commits reference stable mailing list, we should not include it in CC because it's referenced for backports rather then bug reports - since we add new Bug entity fields which we use in queries, whole datastore need to be upgrades to add the new field to index - we must not discard the crash that was used for bisection (treat it as a reported crash) - bisection results need 2 forms of reports: one when we add bisection results to already reported bug another when we report a bug first time with bisection results - when reporting a bug with bisection results we need to use the crash that was used for bisection - some fraction of bisections will probably fail with various errors and we will need some mechanism to retry bisection after the root cause is resolved this is not implemented yet - linux-next is problematic for 2 reasons: fix bisection can't possibly run on linux-next as commits are not reachable from HEAD lots of commits are missing in linux-next (even in linux-next-history) e.g. we have some c63e9e91a254a52 which is now missing in linux-next/linux-next-history - older kernels can't be build with fresh gcc/binutils/perl/make/glibc for now we have to stop at v3.9 (this only requires switching gcc several times along the way) - kernels past v4.11 do not build with gcc 7 and 8 (undefined reference to `____ilog2_NaN') - v4.1 and back have only compiler-gcc5.h - v3.17 and back have only compiler-gcc4.h - v3.6 and back do not have make olddefconfig - compat socket calls can't be bisected past "x86/entry/syscalls: Wire up 32-bit direct socket calls" (v4.10) because of https://syzkaller.appspot.com/bug?id=b5b150e322d5f48c869bcf1528cdbee08d1421cb - v2.6.28 and below does not work with modern make: *** mixed implicit and normal rules: deprecated syntax - v3.8 build fails: Can't use 'defined(@array)' (Maybe you should just omit the defined()?) at kernel/timeconst.pl line 373. kernel/Makefile:134: recipe for target 'kernel/timeconst.h' failed - make 3.81 works for v2.6.28. 3.81 almost works with current HEAD, you need to run make twice because first run spuriously fails with: - v2.6.28 with gcc-4.9.4 broken with: include/linux/kvm.h:240:9: error: duplicate member ‘padding’ - but even defconfig fails: VDSO arch/x86/vdso/vdso.so.dbg gcc: error: elf_x86_64: No such file or directory gcc: error: unrecognized command line option ‘-m’ It seems that we also need old binutils. - for v3.8 and below we need perl-5.14.4. Unfortunately this or any manually built perl doesn't work for later kernels: Can't locate strict.pm in @INC - kernels starting from 4.14 and older are boot broken: https://lkml.org/lkml/2018/9/7/648 - kernels older than 4.12 are broken during netdev setup (fixed by commit 675c8da049fd6556eb2d6cdd745fe812752f07a8) Update #501
2019-03-02 09:45:27 +01:00
resp.Commits = append(resp.Commits, dashapi.Commit{
Hash: com.Hash,
Title: com.Title,
Author: com.Author,
AuthorName: com.AuthorName,
Recipients: com.Recipients.ToDash(),
dashboard/app, syz-ci: bisection support This adds bulk of support for bisection to dashboard/app and syz-ci: - APIs to send bisection jobs and accept results - syz-ci logic to execute bisection jobs - formatting of emails with results - showing of results on dashboard Some difficulties we have to overcome: - since linux is frequently build/boot broken, lots of bisections are inconclusive, need to present such results too - git bisect is poorly suitable for automation, have to resort to output parsing (is output stable?) - git bisect turns out to fail (exit with non-0 status) when bisection is inconclusive (multiple potential cause commits) - older syzkaller revisions can't be built with newer (broken) kernel header, e.g.: ebtables.h:197:19: error: invalid conversion from ‘void*’ to ‘ebt_entry_target*’ - newer compilers produce more warnings and break old syzkaller builds, e.g.: kvm.S.h:6:12: error: ‘kvm_asm64_vm86’ defined but not used [-Werror=unused-const-variable=] - figuring relevant emails to CC from a commit is non-trivial: besides commit author, there can be some emails in commit tags, or not, which tags to use is an interesting question (some may include irrelevant emails) we can also run get_maintainers.pl on the commit, but this can produce too wide list if commit touches lots of files, it can also produce too small list, and then we need to resort to blame - for inconclusive bisection we probably don't need to include emails referenced in the commits (there can be too many of these commits) - need to be careful to exclude own syzbot email from commit CC list, now syzbot emails are referenced in some commits (Reported-by/Tested-by/etc) (can cause some kind of infinite recursion) - lots of commits reference stable mailing list, we should not include it in CC because it's referenced for backports rather then bug reports - since we add new Bug entity fields which we use in queries, whole datastore need to be upgrades to add the new field to index - we must not discard the crash that was used for bisection (treat it as a reported crash) - bisection results need 2 forms of reports: one when we add bisection results to already reported bug another when we report a bug first time with bisection results - when reporting a bug with bisection results we need to use the crash that was used for bisection - some fraction of bisections will probably fail with various errors and we will need some mechanism to retry bisection after the root cause is resolved this is not implemented yet - linux-next is problematic for 2 reasons: fix bisection can't possibly run on linux-next as commits are not reachable from HEAD lots of commits are missing in linux-next (even in linux-next-history) e.g. we have some c63e9e91a254a52 which is now missing in linux-next/linux-next-history - older kernels can't be build with fresh gcc/binutils/perl/make/glibc for now we have to stop at v3.9 (this only requires switching gcc several times along the way) - kernels past v4.11 do not build with gcc 7 and 8 (undefined reference to `____ilog2_NaN') - v4.1 and back have only compiler-gcc5.h - v3.17 and back have only compiler-gcc4.h - v3.6 and back do not have make olddefconfig - compat socket calls can't be bisected past "x86/entry/syscalls: Wire up 32-bit direct socket calls" (v4.10) because of https://syzkaller.appspot.com/bug?id=b5b150e322d5f48c869bcf1528cdbee08d1421cb - v2.6.28 and below does not work with modern make: *** mixed implicit and normal rules: deprecated syntax - v3.8 build fails: Can't use 'defined(@array)' (Maybe you should just omit the defined()?) at kernel/timeconst.pl line 373. kernel/Makefile:134: recipe for target 'kernel/timeconst.h' failed - make 3.81 works for v2.6.28. 3.81 almost works with current HEAD, you need to run make twice because first run spuriously fails with: - v2.6.28 with gcc-4.9.4 broken with: include/linux/kvm.h:240:9: error: duplicate member ‘padding’ - but even defconfig fails: VDSO arch/x86/vdso/vdso.so.dbg gcc: error: elf_x86_64: No such file or directory gcc: error: unrecognized command line option ‘-m’ It seems that we also need old binutils. - for v3.8 and below we need perl-5.14.4. Unfortunately this or any manually built perl doesn't work for later kernels: Can't locate strict.pm in @INC - kernels starting from 4.14 and older are boot broken: https://lkml.org/lkml/2018/9/7/648 - kernels older than 4.12 are broken during netdev setup (fixed by commit 675c8da049fd6556eb2d6cdd745fe812752f07a8) Update #501
2019-03-02 09:45:27 +01:00
Date: com.Date,
})
}
if len(res.Commits) == 1 {
if len(res.Commits[0].Parents) > 1 {
resp.Flags |= dashapi.BisectResultMerge
}
if res.NoopChange {
resp.Flags |= dashapi.BisectResultNoop
}
if res.IsRelease {
resp.Flags |= dashapi.BisectResultRelease
}
ignoredCommits := []string{
// Commit "usb: gadget: add raw-gadget interface" adds a kernel interface for
// triggering USB bugs, which ends up being the guilty commit during bisection
// for USB bugs introduced before it.
"f2c2e717642c66f7fe7e5dd69b2e8ff5849f4d10",
}
for _, commit := range ignoredCommits {
if res.Commits[0].Hash == commit {
resp.Flags |= dashapi.BisectResultIgnore
}
}
}
if res.Report != nil {
resp.CrashTitle = res.Report.Title
resp.CrashReport = res.Report.Report
resp.CrashLog = res.Report.Output
dashboard/app, syz-ci: bisection support This adds bulk of support for bisection to dashboard/app and syz-ci: - APIs to send bisection jobs and accept results - syz-ci logic to execute bisection jobs - formatting of emails with results - showing of results on dashboard Some difficulties we have to overcome: - since linux is frequently build/boot broken, lots of bisections are inconclusive, need to present such results too - git bisect is poorly suitable for automation, have to resort to output parsing (is output stable?) - git bisect turns out to fail (exit with non-0 status) when bisection is inconclusive (multiple potential cause commits) - older syzkaller revisions can't be built with newer (broken) kernel header, e.g.: ebtables.h:197:19: error: invalid conversion from ‘void*’ to ‘ebt_entry_target*’ - newer compilers produce more warnings and break old syzkaller builds, e.g.: kvm.S.h:6:12: error: ‘kvm_asm64_vm86’ defined but not used [-Werror=unused-const-variable=] - figuring relevant emails to CC from a commit is non-trivial: besides commit author, there can be some emails in commit tags, or not, which tags to use is an interesting question (some may include irrelevant emails) we can also run get_maintainers.pl on the commit, but this can produce too wide list if commit touches lots of files, it can also produce too small list, and then we need to resort to blame - for inconclusive bisection we probably don't need to include emails referenced in the commits (there can be too many of these commits) - need to be careful to exclude own syzbot email from commit CC list, now syzbot emails are referenced in some commits (Reported-by/Tested-by/etc) (can cause some kind of infinite recursion) - lots of commits reference stable mailing list, we should not include it in CC because it's referenced for backports rather then bug reports - since we add new Bug entity fields which we use in queries, whole datastore need to be upgrades to add the new field to index - we must not discard the crash that was used for bisection (treat it as a reported crash) - bisection results need 2 forms of reports: one when we add bisection results to already reported bug another when we report a bug first time with bisection results - when reporting a bug with bisection results we need to use the crash that was used for bisection - some fraction of bisections will probably fail with various errors and we will need some mechanism to retry bisection after the root cause is resolved this is not implemented yet - linux-next is problematic for 2 reasons: fix bisection can't possibly run on linux-next as commits are not reachable from HEAD lots of commits are missing in linux-next (even in linux-next-history) e.g. we have some c63e9e91a254a52 which is now missing in linux-next/linux-next-history - older kernels can't be build with fresh gcc/binutils/perl/make/glibc for now we have to stop at v3.9 (this only requires switching gcc several times along the way) - kernels past v4.11 do not build with gcc 7 and 8 (undefined reference to `____ilog2_NaN') - v4.1 and back have only compiler-gcc5.h - v3.17 and back have only compiler-gcc4.h - v3.6 and back do not have make olddefconfig - compat socket calls can't be bisected past "x86/entry/syscalls: Wire up 32-bit direct socket calls" (v4.10) because of https://syzkaller.appspot.com/bug?id=b5b150e322d5f48c869bcf1528cdbee08d1421cb - v2.6.28 and below does not work with modern make: *** mixed implicit and normal rules: deprecated syntax - v3.8 build fails: Can't use 'defined(@array)' (Maybe you should just omit the defined()?) at kernel/timeconst.pl line 373. kernel/Makefile:134: recipe for target 'kernel/timeconst.h' failed - make 3.81 works for v2.6.28. 3.81 almost works with current HEAD, you need to run make twice because first run spuriously fails with: - v2.6.28 with gcc-4.9.4 broken with: include/linux/kvm.h:240:9: error: duplicate member ‘padding’ - but even defconfig fails: VDSO arch/x86/vdso/vdso.so.dbg gcc: error: elf_x86_64: No such file or directory gcc: error: unrecognized command line option ‘-m’ It seems that we also need old binutils. - for v3.8 and below we need perl-5.14.4. Unfortunately this or any manually built perl doesn't work for later kernels: Can't locate strict.pm in @INC - kernels starting from 4.14 and older are boot broken: https://lkml.org/lkml/2018/9/7/648 - kernels older than 4.12 are broken during netdev setup (fixed by commit 675c8da049fd6556eb2d6cdd745fe812752f07a8) Update #501
2019-03-02 09:45:27 +01:00
if len(resp.Commits) != 0 {
resp.Commits[0].Recipients = append(resp.Commits[0].Recipients, res.Report.Recipients.ToDash()...)
} else {
// If there is a report and there is no commit, it means a crash
// occurred on HEAD(for BisectFix) and oldest tested release(for BisectCause).
resp.Build.KernelCommit = res.Commit.Hash
resp.Build.KernelCommitDate = res.Commit.Date
resp.Build.KernelCommitTitle = res.Commit.Title
dashboard/app, syz-ci: bisection support This adds bulk of support for bisection to dashboard/app and syz-ci: - APIs to send bisection jobs and accept results - syz-ci logic to execute bisection jobs - formatting of emails with results - showing of results on dashboard Some difficulties we have to overcome: - since linux is frequently build/boot broken, lots of bisections are inconclusive, need to present such results too - git bisect is poorly suitable for automation, have to resort to output parsing (is output stable?) - git bisect turns out to fail (exit with non-0 status) when bisection is inconclusive (multiple potential cause commits) - older syzkaller revisions can't be built with newer (broken) kernel header, e.g.: ebtables.h:197:19: error: invalid conversion from ‘void*’ to ‘ebt_entry_target*’ - newer compilers produce more warnings and break old syzkaller builds, e.g.: kvm.S.h:6:12: error: ‘kvm_asm64_vm86’ defined but not used [-Werror=unused-const-variable=] - figuring relevant emails to CC from a commit is non-trivial: besides commit author, there can be some emails in commit tags, or not, which tags to use is an interesting question (some may include irrelevant emails) we can also run get_maintainers.pl on the commit, but this can produce too wide list if commit touches lots of files, it can also produce too small list, and then we need to resort to blame - for inconclusive bisection we probably don't need to include emails referenced in the commits (there can be too many of these commits) - need to be careful to exclude own syzbot email from commit CC list, now syzbot emails are referenced in some commits (Reported-by/Tested-by/etc) (can cause some kind of infinite recursion) - lots of commits reference stable mailing list, we should not include it in CC because it's referenced for backports rather then bug reports - since we add new Bug entity fields which we use in queries, whole datastore need to be upgrades to add the new field to index - we must not discard the crash that was used for bisection (treat it as a reported crash) - bisection results need 2 forms of reports: one when we add bisection results to already reported bug another when we report a bug first time with bisection results - when reporting a bug with bisection results we need to use the crash that was used for bisection - some fraction of bisections will probably fail with various errors and we will need some mechanism to retry bisection after the root cause is resolved this is not implemented yet - linux-next is problematic for 2 reasons: fix bisection can't possibly run on linux-next as commits are not reachable from HEAD lots of commits are missing in linux-next (even in linux-next-history) e.g. we have some c63e9e91a254a52 which is now missing in linux-next/linux-next-history - older kernels can't be build with fresh gcc/binutils/perl/make/glibc for now we have to stop at v3.9 (this only requires switching gcc several times along the way) - kernels past v4.11 do not build with gcc 7 and 8 (undefined reference to `____ilog2_NaN') - v4.1 and back have only compiler-gcc5.h - v3.17 and back have only compiler-gcc4.h - v3.6 and back do not have make olddefconfig - compat socket calls can't be bisected past "x86/entry/syscalls: Wire up 32-bit direct socket calls" (v4.10) because of https://syzkaller.appspot.com/bug?id=b5b150e322d5f48c869bcf1528cdbee08d1421cb - v2.6.28 and below does not work with modern make: *** mixed implicit and normal rules: deprecated syntax - v3.8 build fails: Can't use 'defined(@array)' (Maybe you should just omit the defined()?) at kernel/timeconst.pl line 373. kernel/Makefile:134: recipe for target 'kernel/timeconst.h' failed - make 3.81 works for v2.6.28. 3.81 almost works with current HEAD, you need to run make twice because first run spuriously fails with: - v2.6.28 with gcc-4.9.4 broken with: include/linux/kvm.h:240:9: error: duplicate member ‘padding’ - but even defconfig fails: VDSO arch/x86/vdso/vdso.so.dbg gcc: error: elf_x86_64: No such file or directory gcc: error: unrecognized command line option ‘-m’ It seems that we also need old binutils. - for v3.8 and below we need perl-5.14.4. Unfortunately this or any manually built perl doesn't work for later kernels: Can't locate strict.pm in @INC - kernels starting from 4.14 and older are boot broken: https://lkml.org/lkml/2018/9/7/648 - kernels older than 4.12 are broken during netdev setup (fixed by commit 675c8da049fd6556eb2d6cdd745fe812752f07a8) Update #501
2019-03-02 09:45:27 +01:00
}
}
return nil
}
dashboard/app, syz-ci: bisection support This adds bulk of support for bisection to dashboard/app and syz-ci: - APIs to send bisection jobs and accept results - syz-ci logic to execute bisection jobs - formatting of emails with results - showing of results on dashboard Some difficulties we have to overcome: - since linux is frequently build/boot broken, lots of bisections are inconclusive, need to present such results too - git bisect is poorly suitable for automation, have to resort to output parsing (is output stable?) - git bisect turns out to fail (exit with non-0 status) when bisection is inconclusive (multiple potential cause commits) - older syzkaller revisions can't be built with newer (broken) kernel header, e.g.: ebtables.h:197:19: error: invalid conversion from ‘void*’ to ‘ebt_entry_target*’ - newer compilers produce more warnings and break old syzkaller builds, e.g.: kvm.S.h:6:12: error: ‘kvm_asm64_vm86’ defined but not used [-Werror=unused-const-variable=] - figuring relevant emails to CC from a commit is non-trivial: besides commit author, there can be some emails in commit tags, or not, which tags to use is an interesting question (some may include irrelevant emails) we can also run get_maintainers.pl on the commit, but this can produce too wide list if commit touches lots of files, it can also produce too small list, and then we need to resort to blame - for inconclusive bisection we probably don't need to include emails referenced in the commits (there can be too many of these commits) - need to be careful to exclude own syzbot email from commit CC list, now syzbot emails are referenced in some commits (Reported-by/Tested-by/etc) (can cause some kind of infinite recursion) - lots of commits reference stable mailing list, we should not include it in CC because it's referenced for backports rather then bug reports - since we add new Bug entity fields which we use in queries, whole datastore need to be upgrades to add the new field to index - we must not discard the crash that was used for bisection (treat it as a reported crash) - bisection results need 2 forms of reports: one when we add bisection results to already reported bug another when we report a bug first time with bisection results - when reporting a bug with bisection results we need to use the crash that was used for bisection - some fraction of bisections will probably fail with various errors and we will need some mechanism to retry bisection after the root cause is resolved this is not implemented yet - linux-next is problematic for 2 reasons: fix bisection can't possibly run on linux-next as commits are not reachable from HEAD lots of commits are missing in linux-next (even in linux-next-history) e.g. we have some c63e9e91a254a52 which is now missing in linux-next/linux-next-history - older kernels can't be build with fresh gcc/binutils/perl/make/glibc for now we have to stop at v3.9 (this only requires switching gcc several times along the way) - kernels past v4.11 do not build with gcc 7 and 8 (undefined reference to `____ilog2_NaN') - v4.1 and back have only compiler-gcc5.h - v3.17 and back have only compiler-gcc4.h - v3.6 and back do not have make olddefconfig - compat socket calls can't be bisected past "x86/entry/syscalls: Wire up 32-bit direct socket calls" (v4.10) because of https://syzkaller.appspot.com/bug?id=b5b150e322d5f48c869bcf1528cdbee08d1421cb - v2.6.28 and below does not work with modern make: *** mixed implicit and normal rules: deprecated syntax - v3.8 build fails: Can't use 'defined(@array)' (Maybe you should just omit the defined()?) at kernel/timeconst.pl line 373. kernel/Makefile:134: recipe for target 'kernel/timeconst.h' failed - make 3.81 works for v2.6.28. 3.81 almost works with current HEAD, you need to run make twice because first run spuriously fails with: - v2.6.28 with gcc-4.9.4 broken with: include/linux/kvm.h:240:9: error: duplicate member ‘padding’ - but even defconfig fails: VDSO arch/x86/vdso/vdso.so.dbg gcc: error: elf_x86_64: No such file or directory gcc: error: unrecognized command line option ‘-m’ It seems that we also need old binutils. - for v3.8 and below we need perl-5.14.4. Unfortunately this or any manually built perl doesn't work for later kernels: Can't locate strict.pm in @INC - kernels starting from 4.14 and older are boot broken: https://lkml.org/lkml/2018/9/7/648 - kernels older than 4.12 are broken during netdev setup (fixed by commit 675c8da049fd6556eb2d6cdd745fe812752f07a8) Update #501
2019-03-02 09:45:27 +01:00
func (jp *JobProcessor) testPatch(job *Job, mgrcfg *mgrconfig.Config) error {
req, resp, mgr := job.req, job.resp, job.mgr
env, err := instance.NewEnv(mgrcfg)
if err != nil {
return err
}
log.Logf(0, "job: building syzkaller on %v...", req.SyzkallerCommit)
if err := env.BuildSyzkaller(jp.syzkallerRepo, req.SyzkallerCommit); err != nil {
return err
}
2017-11-16 11:08:01 +01:00
log.Logf(0, "job: fetching kernel...")
dashboard/app, syz-ci: bisection support This adds bulk of support for bisection to dashboard/app and syz-ci: - APIs to send bisection jobs and accept results - syz-ci logic to execute bisection jobs - formatting of emails with results - showing of results on dashboard Some difficulties we have to overcome: - since linux is frequently build/boot broken, lots of bisections are inconclusive, need to present such results too - git bisect is poorly suitable for automation, have to resort to output parsing (is output stable?) - git bisect turns out to fail (exit with non-0 status) when bisection is inconclusive (multiple potential cause commits) - older syzkaller revisions can't be built with newer (broken) kernel header, e.g.: ebtables.h:197:19: error: invalid conversion from ‘void*’ to ‘ebt_entry_target*’ - newer compilers produce more warnings and break old syzkaller builds, e.g.: kvm.S.h:6:12: error: ‘kvm_asm64_vm86’ defined but not used [-Werror=unused-const-variable=] - figuring relevant emails to CC from a commit is non-trivial: besides commit author, there can be some emails in commit tags, or not, which tags to use is an interesting question (some may include irrelevant emails) we can also run get_maintainers.pl on the commit, but this can produce too wide list if commit touches lots of files, it can also produce too small list, and then we need to resort to blame - for inconclusive bisection we probably don't need to include emails referenced in the commits (there can be too many of these commits) - need to be careful to exclude own syzbot email from commit CC list, now syzbot emails are referenced in some commits (Reported-by/Tested-by/etc) (can cause some kind of infinite recursion) - lots of commits reference stable mailing list, we should not include it in CC because it's referenced for backports rather then bug reports - since we add new Bug entity fields which we use in queries, whole datastore need to be upgrades to add the new field to index - we must not discard the crash that was used for bisection (treat it as a reported crash) - bisection results need 2 forms of reports: one when we add bisection results to already reported bug another when we report a bug first time with bisection results - when reporting a bug with bisection results we need to use the crash that was used for bisection - some fraction of bisections will probably fail with various errors and we will need some mechanism to retry bisection after the root cause is resolved this is not implemented yet - linux-next is problematic for 2 reasons: fix bisection can't possibly run on linux-next as commits are not reachable from HEAD lots of commits are missing in linux-next (even in linux-next-history) e.g. we have some c63e9e91a254a52 which is now missing in linux-next/linux-next-history - older kernels can't be build with fresh gcc/binutils/perl/make/glibc for now we have to stop at v3.9 (this only requires switching gcc several times along the way) - kernels past v4.11 do not build with gcc 7 and 8 (undefined reference to `____ilog2_NaN') - v4.1 and back have only compiler-gcc5.h - v3.17 and back have only compiler-gcc4.h - v3.6 and back do not have make olddefconfig - compat socket calls can't be bisected past "x86/entry/syscalls: Wire up 32-bit direct socket calls" (v4.10) because of https://syzkaller.appspot.com/bug?id=b5b150e322d5f48c869bcf1528cdbee08d1421cb - v2.6.28 and below does not work with modern make: *** mixed implicit and normal rules: deprecated syntax - v3.8 build fails: Can't use 'defined(@array)' (Maybe you should just omit the defined()?) at kernel/timeconst.pl line 373. kernel/Makefile:134: recipe for target 'kernel/timeconst.h' failed - make 3.81 works for v2.6.28. 3.81 almost works with current HEAD, you need to run make twice because first run spuriously fails with: - v2.6.28 with gcc-4.9.4 broken with: include/linux/kvm.h:240:9: error: duplicate member ‘padding’ - but even defconfig fails: VDSO arch/x86/vdso/vdso.so.dbg gcc: error: elf_x86_64: No such file or directory gcc: error: unrecognized command line option ‘-m’ It seems that we also need old binutils. - for v3.8 and below we need perl-5.14.4. Unfortunately this or any manually built perl doesn't work for later kernels: Can't locate strict.pm in @INC - kernels starting from 4.14 and older are boot broken: https://lkml.org/lkml/2018/9/7/648 - kernels older than 4.12 are broken during netdev setup (fixed by commit 675c8da049fd6556eb2d6cdd745fe812752f07a8) Update #501
2019-03-02 09:45:27 +01:00
repo, err := vcs.NewRepo(mgrcfg.TargetOS, mgrcfg.Type, mgrcfg.KernelSrc)
if err != nil {
return fmt.Errorf("failed to create kernel repo: %v", err)
}
var kernelCommit *vcs.Commit
if vcs.CheckCommitHash(req.KernelBranch) {
kernelCommit, err = repo.CheckoutCommit(req.KernelRepo, req.KernelBranch)
if err != nil {
return fmt.Errorf("failed to checkout kernel repo %v on commit %v: %v",
req.KernelRepo, req.KernelBranch, err)
}
resp.Build.KernelBranch = ""
} else {
kernelCommit, err = repo.CheckoutBranch(req.KernelRepo, req.KernelBranch)
if err != nil {
return fmt.Errorf("failed to checkout kernel repo %v/%v: %v",
req.KernelRepo, req.KernelBranch, err)
}
2017-11-16 11:08:01 +01:00
}
resp.Build.KernelCommit = kernelCommit.Hash
resp.Build.KernelCommitTitle = kernelCommit.Title
resp.Build.KernelCommitDate = kernelCommit.Date
2017-11-16 11:08:01 +01:00
dashboard/app, syz-ci: bisection support This adds bulk of support for bisection to dashboard/app and syz-ci: - APIs to send bisection jobs and accept results - syz-ci logic to execute bisection jobs - formatting of emails with results - showing of results on dashboard Some difficulties we have to overcome: - since linux is frequently build/boot broken, lots of bisections are inconclusive, need to present such results too - git bisect is poorly suitable for automation, have to resort to output parsing (is output stable?) - git bisect turns out to fail (exit with non-0 status) when bisection is inconclusive (multiple potential cause commits) - older syzkaller revisions can't be built with newer (broken) kernel header, e.g.: ebtables.h:197:19: error: invalid conversion from ‘void*’ to ‘ebt_entry_target*’ - newer compilers produce more warnings and break old syzkaller builds, e.g.: kvm.S.h:6:12: error: ‘kvm_asm64_vm86’ defined but not used [-Werror=unused-const-variable=] - figuring relevant emails to CC from a commit is non-trivial: besides commit author, there can be some emails in commit tags, or not, which tags to use is an interesting question (some may include irrelevant emails) we can also run get_maintainers.pl on the commit, but this can produce too wide list if commit touches lots of files, it can also produce too small list, and then we need to resort to blame - for inconclusive bisection we probably don't need to include emails referenced in the commits (there can be too many of these commits) - need to be careful to exclude own syzbot email from commit CC list, now syzbot emails are referenced in some commits (Reported-by/Tested-by/etc) (can cause some kind of infinite recursion) - lots of commits reference stable mailing list, we should not include it in CC because it's referenced for backports rather then bug reports - since we add new Bug entity fields which we use in queries, whole datastore need to be upgrades to add the new field to index - we must not discard the crash that was used for bisection (treat it as a reported crash) - bisection results need 2 forms of reports: one when we add bisection results to already reported bug another when we report a bug first time with bisection results - when reporting a bug with bisection results we need to use the crash that was used for bisection - some fraction of bisections will probably fail with various errors and we will need some mechanism to retry bisection after the root cause is resolved this is not implemented yet - linux-next is problematic for 2 reasons: fix bisection can't possibly run on linux-next as commits are not reachable from HEAD lots of commits are missing in linux-next (even in linux-next-history) e.g. we have some c63e9e91a254a52 which is now missing in linux-next/linux-next-history - older kernels can't be build with fresh gcc/binutils/perl/make/glibc for now we have to stop at v3.9 (this only requires switching gcc several times along the way) - kernels past v4.11 do not build with gcc 7 and 8 (undefined reference to `____ilog2_NaN') - v4.1 and back have only compiler-gcc5.h - v3.17 and back have only compiler-gcc4.h - v3.6 and back do not have make olddefconfig - compat socket calls can't be bisected past "x86/entry/syscalls: Wire up 32-bit direct socket calls" (v4.10) because of https://syzkaller.appspot.com/bug?id=b5b150e322d5f48c869bcf1528cdbee08d1421cb - v2.6.28 and below does not work with modern make: *** mixed implicit and normal rules: deprecated syntax - v3.8 build fails: Can't use 'defined(@array)' (Maybe you should just omit the defined()?) at kernel/timeconst.pl line 373. kernel/Makefile:134: recipe for target 'kernel/timeconst.h' failed - make 3.81 works for v2.6.28. 3.81 almost works with current HEAD, you need to run make twice because first run spuriously fails with: - v2.6.28 with gcc-4.9.4 broken with: include/linux/kvm.h:240:9: error: duplicate member ‘padding’ - but even defconfig fails: VDSO arch/x86/vdso/vdso.so.dbg gcc: error: elf_x86_64: No such file or directory gcc: error: unrecognized command line option ‘-m’ It seems that we also need old binutils. - for v3.8 and below we need perl-5.14.4. Unfortunately this or any manually built perl doesn't work for later kernels: Can't locate strict.pm in @INC - kernels starting from 4.14 and older are boot broken: https://lkml.org/lkml/2018/9/7/648 - kernels older than 4.12 are broken during netdev setup (fixed by commit 675c8da049fd6556eb2d6cdd745fe812752f07a8) Update #501
2019-03-02 09:45:27 +01:00
if err := build.Clean(mgrcfg.TargetOS, mgrcfg.TargetVMArch, mgrcfg.Type, mgrcfg.KernelSrc); err != nil {
return fmt.Errorf("kernel clean failed: %v", err)
}
if len(req.Patch) != 0 {
dashboard/app, syz-ci: bisection support This adds bulk of support for bisection to dashboard/app and syz-ci: - APIs to send bisection jobs and accept results - syz-ci logic to execute bisection jobs - formatting of emails with results - showing of results on dashboard Some difficulties we have to overcome: - since linux is frequently build/boot broken, lots of bisections are inconclusive, need to present such results too - git bisect is poorly suitable for automation, have to resort to output parsing (is output stable?) - git bisect turns out to fail (exit with non-0 status) when bisection is inconclusive (multiple potential cause commits) - older syzkaller revisions can't be built with newer (broken) kernel header, e.g.: ebtables.h:197:19: error: invalid conversion from ‘void*’ to ‘ebt_entry_target*’ - newer compilers produce more warnings and break old syzkaller builds, e.g.: kvm.S.h:6:12: error: ‘kvm_asm64_vm86’ defined but not used [-Werror=unused-const-variable=] - figuring relevant emails to CC from a commit is non-trivial: besides commit author, there can be some emails in commit tags, or not, which tags to use is an interesting question (some may include irrelevant emails) we can also run get_maintainers.pl on the commit, but this can produce too wide list if commit touches lots of files, it can also produce too small list, and then we need to resort to blame - for inconclusive bisection we probably don't need to include emails referenced in the commits (there can be too many of these commits) - need to be careful to exclude own syzbot email from commit CC list, now syzbot emails are referenced in some commits (Reported-by/Tested-by/etc) (can cause some kind of infinite recursion) - lots of commits reference stable mailing list, we should not include it in CC because it's referenced for backports rather then bug reports - since we add new Bug entity fields which we use in queries, whole datastore need to be upgrades to add the new field to index - we must not discard the crash that was used for bisection (treat it as a reported crash) - bisection results need 2 forms of reports: one when we add bisection results to already reported bug another when we report a bug first time with bisection results - when reporting a bug with bisection results we need to use the crash that was used for bisection - some fraction of bisections will probably fail with various errors and we will need some mechanism to retry bisection after the root cause is resolved this is not implemented yet - linux-next is problematic for 2 reasons: fix bisection can't possibly run on linux-next as commits are not reachable from HEAD lots of commits are missing in linux-next (even in linux-next-history) e.g. we have some c63e9e91a254a52 which is now missing in linux-next/linux-next-history - older kernels can't be build with fresh gcc/binutils/perl/make/glibc for now we have to stop at v3.9 (this only requires switching gcc several times along the way) - kernels past v4.11 do not build with gcc 7 and 8 (undefined reference to `____ilog2_NaN') - v4.1 and back have only compiler-gcc5.h - v3.17 and back have only compiler-gcc4.h - v3.6 and back do not have make olddefconfig - compat socket calls can't be bisected past "x86/entry/syscalls: Wire up 32-bit direct socket calls" (v4.10) because of https://syzkaller.appspot.com/bug?id=b5b150e322d5f48c869bcf1528cdbee08d1421cb - v2.6.28 and below does not work with modern make: *** mixed implicit and normal rules: deprecated syntax - v3.8 build fails: Can't use 'defined(@array)' (Maybe you should just omit the defined()?) at kernel/timeconst.pl line 373. kernel/Makefile:134: recipe for target 'kernel/timeconst.h' failed - make 3.81 works for v2.6.28. 3.81 almost works with current HEAD, you need to run make twice because first run spuriously fails with: - v2.6.28 with gcc-4.9.4 broken with: include/linux/kvm.h:240:9: error: duplicate member ‘padding’ - but even defconfig fails: VDSO arch/x86/vdso/vdso.so.dbg gcc: error: elf_x86_64: No such file or directory gcc: error: unrecognized command line option ‘-m’ It seems that we also need old binutils. - for v3.8 and below we need perl-5.14.4. Unfortunately this or any manually built perl doesn't work for later kernels: Can't locate strict.pm in @INC - kernels starting from 4.14 and older are boot broken: https://lkml.org/lkml/2018/9/7/648 - kernels older than 4.12 are broken during netdev setup (fixed by commit 675c8da049fd6556eb2d6cdd745fe812752f07a8) Update #501
2019-03-02 09:45:27 +01:00
if err := vcs.Patch(mgrcfg.KernelSrc, req.Patch); err != nil {
return err
}
2017-11-16 11:08:01 +01:00
}
log.Logf(0, "job: building kernel...")
kernelConfig, _, err := env.BuildKernel(mgr.mgrcfg.Compiler, mgr.mgrcfg.Userspace, mgr.mgrcfg.KernelCmdline,
mgr.mgrcfg.KernelSysctl, req.KernelConfig)
if err != nil {
return err
2017-11-16 11:08:01 +01:00
}
if kernelConfig != "" {
resp.Build.KernelConfig, err = ioutil.ReadFile(kernelConfig)
if err != nil {
return fmt.Errorf("failed to read config file: %v", err)
}
2017-11-16 11:08:01 +01:00
}
log.Logf(0, "job: testing...")
results, err := env.Test(3, req.ReproSyz, req.ReproOpts, req.ReproC)
if err != nil {
return err
}
rep, err := aggregateTestResults(results)
if err != nil {
return err
}
if rep != nil {
resp.CrashTitle = rep.Title
resp.CrashReport = rep.Report
resp.CrashLog = rep.Output
}
return nil
}
func aggregateTestResults(results []error) (*report.Report, error) {
// We can have transient errors and other errors of different types.
// We need to avoid reporting transient "failed to boot" or "failed to copy binary" errors.
// If any of the instances crash during testing, we report this with the highest priority.
// Then if any of the runs succeed, we report that (to avoid transient errors).
// If all instances failed to boot, then we report one of these errors.
anySuccess := false
var anyErr, testErr error
var resReport *report.Report
for _, res := range results {
if res == nil {
anySuccess = true
continue
2017-11-16 11:08:01 +01:00
}
anyErr = res
switch err := res.(type) {
case *instance.TestError:
// We should not put rep into resp.CrashTitle/CrashReport,
// because that will be treated as patch not fixing the bug.
if rep := err.Report; rep != nil {
testErr = fmt.Errorf("%v\n\n%s\n\n%s", rep.Title, rep.Report, rep.Output)
} else {
testErr = fmt.Errorf("%v\n\n%s", err.Title, err.Output)
}
case *instance.CrashError:
if resReport == nil || (len(resReport.Report) == 0 && len(err.Report.Report) != 0) {
resReport = err.Report
}
2017-11-16 11:08:01 +01:00
}
}
if resReport != nil {
return resReport, nil
}
if anySuccess {
return nil, nil
}
if testErr != nil {
return nil, testErr
}
return nil, anyErr
2017-11-16 11:08:01 +01:00
}
// Errorf logs non-fatal error and sends it to dashboard.
func (jp *JobProcessor) Errorf(msg string, args ...interface{}) {
log.Logf(0, "job: "+msg, args...)
if jp.dash != nil {
jp.dash.LogError(jp.name, msg, args...)
}
}