dash

package
v0.0.0-...-d374ac5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 21, 2020 License: Apache-2.0 Imports: 27 Imported by: 0

README

Dashboard

dashboard is an App Engine app that powers syzbot. The main deployment is at syzkaller.appspot.com.

It is so-called "Standard environment Go app" managed with original App Engine SDK.
For more details about App Engine refer to the docs and in particular support package docs.

Note: The app is not stable and is not officially supported. It's here only to power the main deployment.

To test the app one needs to install the SDK and add the goapp binary to $PATH, then run:

goapp test -tags=aetest github.com/google/syzkaller/dashboard/app

During development it's handy to use -short flag to not run the longest tests.

If any of the tests fail, use -v flag to see log of what happens and -run flag to run a single test, e.g.:

goapp test -tags=aetest -short -v -run=TestEmailReport github.com/google/syzkaller/dashboard/app

Documentation

Index

Constants

View Source
const (
	BugStatusFixed = 1000 + iota
	BugStatusInvalid
	BugStatusDup
)
View Source
const (
	ReproLevelNone = dashapi.ReproLevelNone
	ReproLevelSyz  = dashapi.ReproLevelSyz
	ReproLevelC    = dashapi.ReproLevelC
)
View Source
const (
	BugStatusOpen = iota
)
View Source
const (
	MaxStringLen = 1024
)

Variables

View Source
var ErrAccess = errors.New("unauthorized")

Functions

This section is empty.

Types

type APIHandler

type APIHandler func(c context.Context, r *http.Request, payload []byte) (interface{}, error)

type APINamespaceHandler

type APINamespaceHandler func(c context.Context, ns string, r *http.Request, payload []byte) (interface{}, error)

type AccessLevel

type AccessLevel int
const (
	AccessPublic AccessLevel = iota + 1
	AccessUser
	AccessAdmin
)

type BisectStatus

type BisectStatus int
const (
	BisectNot BisectStatus = iota
	BisectPending
	BisectError
	BisectYes
)

type Bug

type Bug struct {
	Namespace      string
	Seq            int64 // sequences of the bug with the same title
	Title          string
	Status         int
	DupOf          string
	NumCrashes     int64
	NumRepro       int64
	ReproLevel     dashapi.ReproLevel
	BisectCause    BisectStatus
	BisectFix      BisectStatus
	HasReport      bool
	NeedCommitInfo bool
	FirstTime      time.Time
	LastTime       time.Time
	LastSavedCrash time.Time
	LastReproTime  time.Time
	FixTime        time.Time // when we become aware of the fixing commit
	LastActivity   time.Time // last time we observed any activity related to the bug
	Closed         time.Time
	Reporting      []BugReporting
	Commits        []string // titles of fixing commmits
	CommitInfo     []Commit // additional info for commits (for historical reasons parallel array to Commits)
	HappenedOn     []string // list of managers
	PatchedOn      []string `datastore:",noindex"` // list of managers
	UNCC           []string // don't CC these emails on this bug
}

type BugReporting

type BugReporting struct {
	Name       string // refers to Reporting.Name
	ID         string // unique ID per BUG/BugReporting used in commucation with external systems
	ExtID      string // arbitrary reporting ID that is passed back in dashapi.BugReport
	Link       string
	CC         string             // additional emails added to CC list (|-delimited list)
	CrashID    int64              // crash that we've last reported in this reporting
	Auto       bool               // was it auto-upstreamed/obsoleted?
	ReproLevel dashapi.ReproLevel // may be less then bug.ReproLevel if repro arrived but we didn't report it yet
	OnHold     time.Time          // if set, the bug must not be upstreamed
	Reported   time.Time
	Closed     time.Time
}

type Build

type Build struct {
	Namespace           string
	Manager             string
	ID                  string // unique ID generated by syz-ci
	Type                BuildType
	Time                time.Time
	OS                  string
	Arch                string
	VMArch              string
	SyzkallerCommit     string
	SyzkallerCommitDate time.Time
	CompilerID          string
	KernelRepo          string
	KernelBranch        string
	KernelCommit        string
	KernelCommitTitle   string    `datastore:",noindex"`
	KernelCommitDate    time.Time `datastore:",noindex"`
	KernelConfig        int64     // reference to KernelConfig text entity
}

type BuildType

type BuildType int
const (
	BuildNormal BuildType = iota
	BuildFailed
	BuildJob
)

type Commit

type Commit struct {
	Hash       string
	Title      string
	Author     string
	AuthorName string
	CC         string `datastore:",noindex"` // (|-delimited list)
	Date       time.Time
}

type Config

type Config struct {
	// See GlobalConfig.AccessLevel.
	AccessLevel AccessLevel
	// Name used in UI.
	DisplayTitle string
	// Unique string that allows to show "similar bugs" across different namespaces.
	// Similar bugs are shown only across namespaces with the same value of SimilarityDomain.
	SimilarityDomain string
	// Per-namespace clients that act only on a particular namespace.
	Clients map[string]string
	// A unique key for hashing, can be anything.
	Key string
	// Mail bugs without reports (e.g. "no output").
	MailWithoutReport bool
	// How long should we wait before reporting a bug.
	ReportingDelay time.Duration
	// How long should we wait for a C repro before reporting a bug.
	WaitForRepro time.Duration
	// If set, successful fix bisections will auto-close the bug.
	FixBisectionAutoClose bool
	// Managers contains some special additional info about syz-manager instances.
	Managers map[string]ConfigManager
	// Reporting config.
	Reporting []Reporting
	// TransformCrash hook is called when a manager uploads a crash.
	// The hook can transform the crash or discard the crash by returning false.
	TransformCrash func(build *Build, crash *dashapi.Crash) bool
	// NeedRepro hook can be used to prevent reproduction of some bugs.
	NeedRepro func(bug *Bug) bool
	// List of kernel repositories for this namespace.
	// The first repo considered the "main" repo (e.g. fixing commit info is shown against this repo).
	// Other repos are secondary repos, they may be tested or not.
	// If not tested they are used to poll for fixing commits.
	Repos []KernelRepo
}

Per-namespace config.

func (*Config) ReportingByName

func (cfg *Config) ReportingByName(name string) *Reporting

type ConfigManager

type ConfigManager struct {
	Decommissioned bool   // The instance is no longer active.
	DelegatedTo    string // If Decommissioned, test requests should go to this instance instead.
	// Normally instances can test patches on any tree.
	// However, some (e.g. non-upstreamed KMSAN) can test only on a fixed tree.
	// RestrictedTestingRepo contains the repo for such instances
	// and RestrictedTestingReason contains a human readable reason for the restriction.
	RestrictedTestingRepo   string
	RestrictedTestingReason string
	// If a bug happens only on this manager, this overrides global obsoleting settings.
	// See ObsoletingConfig for details.
	ObsoletingMinPeriod time.Duration
	ObsoletingMaxPeriod time.Duration
	// Determines if fix bisection should be disabled on this manager.
	FixBisectionDisabled bool
}

ConfigManager describes a single syz-manager instance. Dashboard does not generally need to know about all of them, but in some special cases it needs to know some additional information.

type Crash

type Crash struct {
	Manager     string
	BuildID     string
	Time        time.Time
	Reported    time.Time // set if this crash was ever reported
	Maintainers []string  `datastore:",noindex"`
	Log         int64     // reference to CrashLog text entity
	Report      int64     // reference to CrashReport text entity
	ReproOpts   []byte    `datastore:",noindex"`
	ReproSyz    int64     // reference to ReproSyz text entity
	ReproC      int64     // reference to ReproC text entity
	// Custom crash priority for reporting (greater values are higher priority).
	// For example, a crash in mainline kernel has higher priority than a crash in a side branch.
	// For historical reasons this is called ReportLen.
	ReportLen int64
}

type EmailConfig

type EmailConfig struct {
	Email              string
	MailMaintainers    bool
	DefaultMaintainers []string
}

func (*EmailConfig) Type

func (cfg *EmailConfig) Type() string

func (*EmailConfig) Validate

func (cfg *EmailConfig) Validate() error

type ErrDontLog

type ErrDontLog struct {
	// contains filtered or unexported fields
}

type ErrRedirect

type ErrRedirect struct {
	// contains filtered or unexported fields
}

type ExternalConfig

type ExternalConfig struct {
	ID string
}

func (*ExternalConfig) Type

func (cfg *ExternalConfig) Type() string

type FilterResult

type FilterResult int
const (
	FilterReport FilterResult = iota // Report bug in this reporting (default).
	FilterSkip                       // Skip this reporting and proceed to the next one.
	FilterHold                       // Hold off with reporting this bug.
)

type GlobalConfig

type GlobalConfig struct {
	// Min access levels specified hierarchically throughout the config.
	AccessLevel AccessLevel
	// Email suffix of authorized users (e.g. "@foobar.com").
	AuthDomain string
	// Google Analytics Tracking ID.
	AnalyticsTrackingID string
	// URL prefix of source coverage reports.
	// Dashboard will append manager_name.html to that prefix.
	// syz-ci can upload these reports to GCS.
	CoverPath string
	// Global API clients that work across namespaces (e.g. external reporting).
	Clients map[string]string
	// List of emails blacklisted from issuing test requests.
	EmailBlacklist []string
	// Bug obsoleting settings. See ObsoletingConfig for details.
	Obsoleting ObsoletingConfig
	// Namespace that is shown by default (no namespace selected yet).
	DefaultNamespace string
	// Per-namespace config.
	// Namespaces are a mechanism to separate groups of different kernels.
	// E.g. Debian 4.4 kernels and Ubuntu 4.9 kernels.
	// Each namespace has own reporting config, own API clients
	// and bugs are not merged across namespaces.
	Namespaces map[string]*Config
}

There are multiple configurable aspects of the app (namespaces, reporting, API clients, etc). The exact config is stored in a global config variable and is read-only. Also see config_stub.go.

type JSONHandler

type JSONHandler func(c context.Context, r *http.Request) (interface{}, error)

type Job

type Job struct {
	Type      JobType
	Created   time.Time
	User      string
	CC        []string
	Reporting string
	ExtID     string // email Message-ID
	Link      string // web link for the job (e.g. email in the group)
	Namespace string
	Manager   string
	BugTitle  string
	CrashID   int64

	// Provided by user:
	KernelRepo   string
	KernelBranch string
	Patch        int64 // reference to Patch text entity

	Attempts int // number of times we tried to execute this job
	Started  time.Time
	Finished time.Time // if set, job is finished

	// Result of execution:
	CrashTitle  string // if empty, we did not hit crash during testing
	CrashLog    int64  // reference to CrashLog text entity
	CrashReport int64  // reference to CrashReport text entity
	Commits     []Commit
	BuildID     string
	Log         int64 // reference to Log text entity
	Error       int64 // reference to Error text entity, if set job failed
	Flags       JobFlags

	Reported bool // have we reported result back to user?
}

Job represent a single patch testing or bisection job for syz-ci. Later we may want to extend this to other types of jobs:

  • test of a committed fix
  • reproduce crash
  • test that crash still happens on HEAD

Job has Bug as parent entity.

type JobFlags

type JobFlags int64
const (
	// Parallel to dashapi.JobDoneFlags, see comments there.
	BisectResultMerge JobFlags = 1 << iota
	BisectResultNoop
	BisectResultRelease
)

type JobType

type JobType int
const (
	JobTestPatch JobType = iota
	JobBisectCause
	JobBisectFix
)

type KernelRepo

type KernelRepo struct {
	URL    string
	Branch string
	// Alias is a short, readable name of a kernel repository.
	Alias string
	// ReportingPriority says if we need to prefer to report crashes in this
	// repo over crashes in repos with lower value. Must be in [0-9] range.
	ReportingPriority int
	// Additional CC list to add to all bugs reported on this repo.
	CC []string
}

type Manager

type Manager struct {
	Namespace         string
	Name              string
	Link              string
	CurrentBuild      string
	FailedBuildBug    string
	FailedSyzBuildBug string
	LastAlive         time.Time
	CurrentUpTime     time.Duration
}

type ManagerStats

type ManagerStats struct {
	Date             int // YYYYMMDD
	MaxCorpus        int64
	MaxCover         int64
	TotalFuzzingTime time.Duration
	TotalCrashes     int64
	TotalExecs       int64
}

ManagerStats holds per-day manager runtime stats. Has Manager as parent entity. Keyed by Date.

type ObsoletingConfig

type ObsoletingConfig struct {
	MinPeriod         time.Duration
	MaxPeriod         time.Duration
	NonFinalMinPeriod time.Duration
	NonFinalMaxPeriod time.Duration
}

ObsoletingConfig describes how bugs without reproducer should be obsoleted. First, for each bug we conservatively estimate period since the last crash when we consider it stopped happenning. This estimation is based on the first/last time and number and rate of crashes. Then this period is capped by MinPeriod/MaxPeriod. Then if the period has elapsed since the last crash, we obsolete the bug. NonFinalMinPeriod/NonFinalMaxPeriod (if specified) are used to cap bugs in non-final reportings. Additionally ConfigManager.ObsoletingMin/MaxPeriod override the cap settings for bugs that happen only on that manager. If no periods are specified, no bugs are obsoleted.

type Reporting

type Reporting struct {
	// See GlobalConfig.AccessLevel.
	AccessLevel AccessLevel
	// A unique name (the app does not care about exact contents).
	Name string
	// Name used in UI.
	DisplayTitle string
	// Filter can be used to conditionally skip this reporting or hold off reporting.
	Filter ReportingFilter
	// How many new bugs report per day.
	DailyLimit int
	// Upstream reports into next reporting after this period.
	Embargo time.Duration
	// Type of reporting and its configuration.
	// The app has one built-in type, EmailConfig, which reports bugs by email.
	// And ExternalConfig which can be used to attach any external reporting system (e.g. Bugzilla).
	Config ReportingType
	// contains filtered or unexported fields
}

One reporting stage.

type ReportingFilter

type ReportingFilter func(bug *Bug) FilterResult

func ConstFilter

func ConstFilter(result FilterResult) ReportingFilter

type ReportingState

type ReportingState struct {
	Entries []ReportingStateEntry
}

ReportingState holds dynamic info associated with reporting.

type ReportingStateEntry

type ReportingStateEntry struct {
	Namespace string
	Name      string
	// Current reporting quota consumption.
	Sent int
	Date int // YYYYMMDD
}

type ReportingType

type ReportingType interface {
	// Type returns a unique string that identifies this reporting type (e.g. "email").
	Type() string
	// Validate validates the current object, this is called only during init.
	Validate() error
}

type TerminalBug

type TerminalBug struct {
	Status    int
	Subpage   string
	Caption   string
	ShowPatch bool
}

type Text

type Text struct {
	Namespace string
	Text      []byte `datastore:",noindex"` // gzip-compressed text
}

Text holds text blobs (crash logs, reports, reproducers, etc).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL