2015-10-12 08:16:57 +00:00
|
|
|
// Copyright 2015 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 (
|
2017-10-11 20:24:29 +00:00
|
|
|
"bufio"
|
2019-01-16 13:38:28 +00:00
|
|
|
"encoding/json"
|
2015-10-12 08:16:57 +00:00
|
|
|
"fmt"
|
2016-10-06 16:46:21 +00:00
|
|
|
"io"
|
|
|
|
"io/ioutil"
|
2016-10-06 14:13:06 +00:00
|
|
|
"net"
|
2015-10-12 08:16:57 +00:00
|
|
|
"net/http"
|
2016-01-19 11:29:59 +00:00
|
|
|
_ "net/http/pprof"
|
2016-10-06 16:46:21 +00:00
|
|
|
"os"
|
|
|
|
"path/filepath"
|
2016-02-16 14:07:27 +00:00
|
|
|
"runtime"
|
2015-10-12 08:16:57 +00:00
|
|
|
"sort"
|
|
|
|
"strconv"
|
2016-10-06 16:46:21 +00:00
|
|
|
"strings"
|
2015-11-19 18:02:30 +00:00
|
|
|
"time"
|
2015-10-12 08:16:57 +00:00
|
|
|
|
2017-06-17 10:40:18 +00:00
|
|
|
"github.com/google/syzkaller/pkg/cover"
|
2018-11-22 13:27:37 +00:00
|
|
|
"github.com/google/syzkaller/pkg/html"
|
2018-05-03 12:41:34 +00:00
|
|
|
"github.com/google/syzkaller/pkg/log"
|
2017-06-17 10:23:52 +00:00
|
|
|
"github.com/google/syzkaller/pkg/osutil"
|
2018-12-25 18:15:28 +00:00
|
|
|
"github.com/google/syzkaller/pkg/signal"
|
2018-06-29 18:34:43 +00:00
|
|
|
"github.com/google/syzkaller/prog"
|
2019-01-16 13:38:28 +00:00
|
|
|
"github.com/google/syzkaller/sys"
|
2015-10-12 08:16:57 +00:00
|
|
|
)
|
|
|
|
|
2018-03-08 17:48:26 +00:00
|
|
|
func (mgr *Manager) initHTTP() {
|
2016-10-06 16:46:21 +00:00
|
|
|
http.HandleFunc("/", mgr.httpSummary)
|
2019-01-16 13:38:28 +00:00
|
|
|
http.HandleFunc("/config", mgr.httpConfig)
|
2018-04-02 11:11:06 +00:00
|
|
|
http.HandleFunc("/syscalls", mgr.httpSyscalls)
|
2015-10-14 14:55:09 +00:00
|
|
|
http.HandleFunc("/corpus", mgr.httpCorpus)
|
2016-10-06 16:46:21 +00:00
|
|
|
http.HandleFunc("/crash", mgr.httpCrash)
|
2015-10-14 14:55:09 +00:00
|
|
|
http.HandleFunc("/cover", mgr.httpCover)
|
|
|
|
http.HandleFunc("/prio", mgr.httpPrio)
|
2016-10-06 16:46:21 +00:00
|
|
|
http.HandleFunc("/file", mgr.httpFile)
|
2016-11-25 10:04:06 +00:00
|
|
|
http.HandleFunc("/report", mgr.httpReport)
|
2017-10-11 20:24:29 +00:00
|
|
|
http.HandleFunc("/rawcover", mgr.httpRawCover)
|
2018-11-22 13:27:37 +00:00
|
|
|
http.HandleFunc("/input", mgr.httpInput)
|
2017-12-14 14:43:06 +00:00
|
|
|
// Browsers like to request this, without special handler this goes to / handler.
|
|
|
|
http.HandleFunc("/favicon.ico", func(w http.ResponseWriter, r *http.Request) {})
|
2016-10-06 14:13:06 +00:00
|
|
|
|
2018-03-08 17:48:26 +00:00
|
|
|
ln, err := net.Listen("tcp4", mgr.cfg.HTTP)
|
2016-10-06 14:13:06 +00:00
|
|
|
if err != nil {
|
2018-05-03 12:41:34 +00:00
|
|
|
log.Fatalf("failed to listen on %v: %v", mgr.cfg.HTTP, err)
|
2016-10-06 14:13:06 +00:00
|
|
|
}
|
2018-05-03 12:41:34 +00:00
|
|
|
log.Logf(0, "serving http on http://%v", ln.Addr())
|
2016-10-06 14:13:06 +00:00
|
|
|
go func() {
|
|
|
|
err := http.Serve(ln, nil)
|
2018-05-03 12:41:34 +00:00
|
|
|
log.Fatalf("failed to serve http: %v", err)
|
2016-10-06 14:13:06 +00:00
|
|
|
}()
|
2015-10-14 14:55:09 +00:00
|
|
|
}
|
|
|
|
|
2016-10-06 16:46:21 +00:00
|
|
|
func (mgr *Manager) httpSummary(w http.ResponseWriter, r *http.Request) {
|
2016-11-16 12:17:47 +00:00
|
|
|
data := &UISummaryData{
|
2018-04-02 11:11:06 +00:00
|
|
|
Name: mgr.cfg.Name,
|
2018-05-03 12:41:34 +00:00
|
|
|
Log: log.CachedLogOutput(),
|
2018-04-02 11:11:06 +00:00
|
|
|
Stats: mgr.collectStats(),
|
2016-11-16 12:17:47 +00:00
|
|
|
}
|
2017-01-30 14:23:29 +00:00
|
|
|
|
|
|
|
var err error
|
2018-04-02 10:58:03 +00:00
|
|
|
if data.Crashes, err = mgr.collectCrashes(mgr.cfg.Workdir); err != nil {
|
2017-01-30 14:23:29 +00:00
|
|
|
http.Error(w, fmt.Sprintf("failed to collect crashes: %v", err), http.StatusInternalServerError)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2018-04-02 11:11:06 +00:00
|
|
|
if err := summaryTemplate.Execute(w, data); err != nil {
|
|
|
|
http.Error(w, fmt.Sprintf("failed to execute template: %v", err),
|
|
|
|
http.StatusInternalServerError)
|
2017-12-14 15:24:09 +00:00
|
|
|
return
|
|
|
|
}
|
2018-04-02 11:11:06 +00:00
|
|
|
}
|
2017-12-14 15:24:09 +00:00
|
|
|
|
2019-01-16 13:38:28 +00:00
|
|
|
func (mgr *Manager) httpConfig(w http.ResponseWriter, r *http.Request) {
|
|
|
|
data, err := json.MarshalIndent(mgr.cfg, "", "\t")
|
|
|
|
if err != nil {
|
2019-01-16 13:48:49 +00:00
|
|
|
http.Error(w, fmt.Sprintf("failed to encode json: %v", err),
|
2019-01-16 13:38:28 +00:00
|
|
|
http.StatusInternalServerError)
|
|
|
|
return
|
|
|
|
}
|
2019-01-16 13:48:49 +00:00
|
|
|
w.Write(data)
|
2019-01-16 13:38:28 +00:00
|
|
|
}
|
|
|
|
|
2018-04-02 11:11:06 +00:00
|
|
|
func (mgr *Manager) httpSyscalls(w http.ResponseWriter, r *http.Request) {
|
|
|
|
data := &UISyscallsData{
|
|
|
|
Name: mgr.cfg.Name,
|
|
|
|
}
|
|
|
|
for c, cc := range mgr.collectSyscallInfo() {
|
2017-12-14 15:24:09 +00:00
|
|
|
data.Calls = append(data.Calls, UICallType{
|
|
|
|
Name: c,
|
|
|
|
Inputs: cc.count,
|
|
|
|
Cover: len(cc.cov),
|
|
|
|
})
|
|
|
|
}
|
2018-11-22 13:27:37 +00:00
|
|
|
sort.Slice(data.Calls, func(i, j int) bool {
|
|
|
|
return data.Calls[i].Name < data.Calls[j].Name
|
|
|
|
})
|
2018-04-02 11:11:06 +00:00
|
|
|
if err := syscallsTemplate.Execute(w, data); err != nil {
|
2017-12-14 15:24:09 +00:00
|
|
|
http.Error(w, fmt.Sprintf("failed to execute template: %v", err),
|
|
|
|
http.StatusInternalServerError)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
type CallCov struct {
|
|
|
|
count int
|
|
|
|
cov cover.Cover
|
|
|
|
}
|
|
|
|
|
2018-04-02 11:11:06 +00:00
|
|
|
func (mgr *Manager) collectStats() []UIStat {
|
2017-01-30 14:23:29 +00:00
|
|
|
mgr.mu.Lock()
|
|
|
|
defer mgr.mu.Unlock()
|
|
|
|
|
2018-12-25 18:15:28 +00:00
|
|
|
rawStats := mgr.stats.all()
|
2019-01-16 13:38:28 +00:00
|
|
|
head := strings.Replace(sys.GitRevision, "+", "", -1)
|
|
|
|
if head == "" {
|
|
|
|
head = "master"
|
|
|
|
}
|
2018-06-12 12:05:02 +00:00
|
|
|
stats := []UIStat{
|
2019-01-16 13:48:49 +00:00
|
|
|
{Name: "revision", Value: fmt.Sprint(head[:8]), Link: "https://github.com/google/syzkaller/commit/" + head},
|
2019-01-17 22:11:37 +00:00
|
|
|
{Name: "config", Value: mgr.cfg.Name, Link: "/config"},
|
2018-06-12 12:05:02 +00:00
|
|
|
{Name: "uptime", Value: fmt.Sprint(time.Since(mgr.startTime) / 1e9 * 1e9)},
|
|
|
|
{Name: "fuzzing", Value: fmt.Sprint(mgr.fuzzingTime / 60e9 * 60e9)},
|
2018-11-22 13:27:37 +00:00
|
|
|
{Name: "corpus", Value: fmt.Sprint(len(mgr.corpus)), Link: "/corpus"},
|
2018-06-12 12:05:02 +00:00
|
|
|
{Name: "triage queue", Value: fmt.Sprint(len(mgr.candidates))},
|
2018-12-25 18:15:28 +00:00
|
|
|
{Name: "cover", Value: fmt.Sprint(rawStats["cover"]), Link: "/cover"},
|
|
|
|
{Name: "signal", Value: fmt.Sprint(rawStats["signal"])},
|
2018-06-12 12:05:02 +00:00
|
|
|
}
|
2018-12-25 18:15:28 +00:00
|
|
|
delete(rawStats, "cover")
|
|
|
|
delete(rawStats, "signal")
|
2018-06-12 12:05:02 +00:00
|
|
|
if mgr.checkResult != nil {
|
|
|
|
stats = append(stats, UIStat{
|
|
|
|
Name: "syscalls",
|
2018-08-04 15:55:19 +00:00
|
|
|
Value: fmt.Sprint(len(mgr.checkResult.EnabledCalls[mgr.cfg.Sandbox])),
|
2018-06-12 12:05:02 +00:00
|
|
|
Link: "/syscalls",
|
|
|
|
})
|
|
|
|
}
|
2016-01-19 11:29:59 +00:00
|
|
|
|
2016-08-22 02:04:50 +00:00
|
|
|
secs := uint64(1)
|
|
|
|
if !mgr.firstConnect.IsZero() {
|
|
|
|
secs = uint64(time.Since(mgr.firstConnect))/1e9 + 1
|
|
|
|
}
|
2018-12-25 18:15:28 +00:00
|
|
|
intStats := convertStats(rawStats, secs)
|
2018-11-22 13:27:37 +00:00
|
|
|
sort.Slice(intStats, func(i, j int) bool {
|
|
|
|
return intStats[i].Name < intStats[j].Name
|
|
|
|
})
|
2018-08-02 14:44:21 +00:00
|
|
|
stats = append(stats, intStats...)
|
|
|
|
return stats
|
|
|
|
}
|
|
|
|
|
|
|
|
func convertStats(stats map[string]uint64, secs uint64) []UIStat {
|
2016-10-06 17:48:44 +00:00
|
|
|
var intStats []UIStat
|
2018-08-02 14:44:21 +00:00
|
|
|
for k, v := range stats {
|
2016-10-06 17:48:44 +00:00
|
|
|
val := fmt.Sprintf("%v", v)
|
|
|
|
if x := v / secs; x >= 10 {
|
|
|
|
val += fmt.Sprintf(" (%v/sec)", x)
|
|
|
|
} else if x := v * 60 / secs; x >= 10 {
|
|
|
|
val += fmt.Sprintf(" (%v/min)", x)
|
|
|
|
} else {
|
|
|
|
x := v * 60 * 60 / secs
|
|
|
|
val += fmt.Sprintf(" (%v/hour)", x)
|
|
|
|
}
|
|
|
|
intStats = append(intStats, UIStat{Name: k, Value: val})
|
|
|
|
}
|
2018-08-02 14:44:21 +00:00
|
|
|
return intStats
|
2018-04-02 11:11:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (mgr *Manager) collectSyscallInfo() map[string]*CallCov {
|
|
|
|
mgr.mu.Lock()
|
|
|
|
defer mgr.mu.Unlock()
|
2015-10-12 08:16:57 +00:00
|
|
|
|
2017-12-14 15:24:09 +00:00
|
|
|
calls := make(map[string]*CallCov)
|
|
|
|
for _, inp := range mgr.corpus {
|
|
|
|
if calls[inp.Call] == nil {
|
|
|
|
calls[inp.Call] = new(CallCov)
|
|
|
|
}
|
|
|
|
cc := calls[inp.Call]
|
|
|
|
cc.count++
|
2018-02-20 19:44:04 +00:00
|
|
|
cc.cov.Merge(inp.Cover)
|
2016-10-06 16:46:21 +00:00
|
|
|
}
|
2018-04-02 11:11:06 +00:00
|
|
|
return calls
|
2016-10-06 16:46:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (mgr *Manager) httpCrash(w http.ResponseWriter, r *http.Request) {
|
|
|
|
crashID := r.FormValue("id")
|
2018-11-22 13:27:37 +00:00
|
|
|
crash := readCrash(mgr.cfg.Workdir, crashID, nil, mgr.startTime, true)
|
2016-10-06 16:46:21 +00:00
|
|
|
if crash == nil {
|
2017-01-16 20:39:34 +00:00
|
|
|
http.Error(w, fmt.Sprintf("failed to read crash info"), http.StatusInternalServerError)
|
2016-10-06 16:46:21 +00:00
|
|
|
return
|
|
|
|
}
|
|
|
|
if err := crashTemplate.Execute(w, crash); err != nil {
|
2015-10-12 08:16:57 +00:00
|
|
|
http.Error(w, fmt.Sprintf("failed to execute template: %v", err), http.StatusInternalServerError)
|
2016-10-06 16:46:21 +00:00
|
|
|
return
|
2015-10-12 08:16:57 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (mgr *Manager) httpCorpus(w http.ResponseWriter, r *http.Request) {
|
|
|
|
mgr.mu.Lock()
|
|
|
|
defer mgr.mu.Unlock()
|
|
|
|
|
2018-11-22 13:27:37 +00:00
|
|
|
data := UICorpus{
|
|
|
|
Call: r.FormValue("call"),
|
|
|
|
}
|
2017-01-25 21:18:42 +00:00
|
|
|
for sig, inp := range mgr.corpus {
|
2018-11-22 13:27:37 +00:00
|
|
|
if data.Call != "" && data.Call != inp.Call {
|
2015-10-12 08:16:57 +00:00
|
|
|
continue
|
|
|
|
}
|
2018-12-09 17:05:58 +00:00
|
|
|
p, err := mgr.target.Deserialize(inp.Prog, prog.NonStrict)
|
2015-10-12 08:16:57 +00:00
|
|
|
if err != nil {
|
|
|
|
http.Error(w, fmt.Sprintf("failed to deserialize program: %v", err), http.StatusInternalServerError)
|
2016-10-06 16:46:21 +00:00
|
|
|
return
|
2015-10-12 08:16:57 +00:00
|
|
|
}
|
2018-11-22 13:27:37 +00:00
|
|
|
data.Inputs = append(data.Inputs, &UIInput{
|
|
|
|
Sig: sig,
|
2017-01-25 21:18:42 +00:00
|
|
|
Short: p.String(),
|
|
|
|
Cover: len(inp.Cover),
|
2015-10-12 08:16:57 +00:00
|
|
|
})
|
|
|
|
}
|
2018-11-22 13:27:37 +00:00
|
|
|
sort.Slice(data.Inputs, func(i, j int) bool {
|
|
|
|
a, b := data.Inputs[i], data.Inputs[j]
|
|
|
|
if a.Cover != b.Cover {
|
|
|
|
return a.Cover > b.Cover
|
|
|
|
}
|
|
|
|
return a.Short < b.Short
|
|
|
|
})
|
2015-10-12 08:16:57 +00:00
|
|
|
|
|
|
|
if err := corpusTemplate.Execute(w, data); err != nil {
|
|
|
|
http.Error(w, fmt.Sprintf("failed to execute template: %v", err), http.StatusInternalServerError)
|
2016-10-06 16:46:21 +00:00
|
|
|
return
|
2015-10-12 08:16:57 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (mgr *Manager) httpCover(w http.ResponseWriter, r *http.Request) {
|
|
|
|
mgr.mu.Lock()
|
|
|
|
defer mgr.mu.Unlock()
|
|
|
|
|
2018-06-29 18:34:43 +00:00
|
|
|
if mgr.checkResult == nil {
|
|
|
|
http.Error(w, fmt.Sprintf("machine is not checked yet"), http.StatusInternalServerError)
|
|
|
|
return
|
|
|
|
}
|
2018-06-29 16:15:41 +00:00
|
|
|
if mgr.cfg.Cover {
|
|
|
|
mgr.httpCoverCover(w, r)
|
|
|
|
} else {
|
|
|
|
mgr.httpCoverFallback(w, r)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (mgr *Manager) httpCoverCover(w http.ResponseWriter, r *http.Request) {
|
2018-06-21 12:38:08 +00:00
|
|
|
if mgr.cfg.KernelObj == "" {
|
|
|
|
http.Error(w, fmt.Sprintf("no kernel_obj in config file"), http.StatusInternalServerError)
|
2017-09-23 08:02:53 +00:00
|
|
|
return
|
|
|
|
}
|
2015-10-12 08:16:57 +00:00
|
|
|
var cov cover.Cover
|
2017-01-25 21:18:42 +00:00
|
|
|
if sig := r.FormValue("input"); sig != "" {
|
2018-02-20 19:44:04 +00:00
|
|
|
cov.Merge(mgr.corpus[sig].Cover)
|
2015-10-12 08:16:57 +00:00
|
|
|
} else {
|
2017-01-25 21:18:42 +00:00
|
|
|
call := r.FormValue("call")
|
2015-10-12 08:16:57 +00:00
|
|
|
for _, inp := range mgr.corpus {
|
|
|
|
if call == "" || call == inp.Call {
|
2018-02-20 19:44:04 +00:00
|
|
|
cov.Merge(inp.Cover)
|
2015-10-12 08:16:57 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-08-31 19:30:18 +00:00
|
|
|
if err := generateCoverHTML(w, mgr.cfg.KernelObj, mgr.sysTarget.KernelObject,
|
2018-12-31 18:07:41 +00:00
|
|
|
mgr.cfg.KernelSrc, mgr.cfg.TargetVMArch, mgr.cfg.TargetOS, cov); err != nil {
|
2015-10-12 08:16:57 +00:00
|
|
|
http.Error(w, fmt.Sprintf("failed to generate coverage profile: %v", err), http.StatusInternalServerError)
|
2016-10-06 16:46:21 +00:00
|
|
|
return
|
2015-10-12 08:16:57 +00:00
|
|
|
}
|
2016-02-16 14:07:27 +00:00
|
|
|
runtime.GC()
|
2015-10-12 08:16:57 +00:00
|
|
|
}
|
|
|
|
|
2018-06-29 16:15:41 +00:00
|
|
|
func (mgr *Manager) httpCoverFallback(w http.ResponseWriter, r *http.Request) {
|
2018-12-25 18:15:28 +00:00
|
|
|
var maxSignal signal.Signal
|
|
|
|
for _, inp := range mgr.corpus {
|
|
|
|
maxSignal.Merge(inp.Signal.Deserialize())
|
|
|
|
}
|
2018-06-29 16:15:41 +00:00
|
|
|
calls := make(map[int][]int)
|
2018-12-25 18:15:28 +00:00
|
|
|
for s := range maxSignal {
|
2018-06-29 18:34:43 +00:00
|
|
|
id, errno := prog.DecodeFallbackSignal(uint32(s))
|
2018-06-29 16:15:41 +00:00
|
|
|
calls[id] = append(calls[id], errno)
|
|
|
|
}
|
|
|
|
data := &UIFallbackCoverData{}
|
2018-07-25 14:45:57 +00:00
|
|
|
for _, id := range mgr.checkResult.EnabledCalls[mgr.cfg.Sandbox] {
|
2018-06-29 18:34:43 +00:00
|
|
|
errnos := calls[id]
|
2018-06-29 16:15:41 +00:00
|
|
|
sort.Ints(errnos)
|
2018-06-29 18:34:43 +00:00
|
|
|
successful := 0
|
|
|
|
for len(errnos) != 0 && errnos[0] == 0 {
|
|
|
|
successful++
|
2018-06-29 16:15:41 +00:00
|
|
|
errnos = errnos[1:]
|
|
|
|
}
|
|
|
|
data.Calls = append(data.Calls, UIFallbackCall{
|
2018-06-29 18:34:43 +00:00
|
|
|
Name: mgr.target.Syscalls[id].Name,
|
|
|
|
Successful: successful,
|
|
|
|
Errnos: errnos,
|
2018-06-29 16:15:41 +00:00
|
|
|
})
|
|
|
|
}
|
|
|
|
sort.Slice(data.Calls, func(i, j int) bool {
|
|
|
|
return data.Calls[i].Name < data.Calls[j].Name
|
|
|
|
})
|
|
|
|
|
|
|
|
if err := fallbackCoverTemplate.Execute(w, data); err != nil {
|
|
|
|
http.Error(w, fmt.Sprintf("failed to execute template: %v", err), http.StatusInternalServerError)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-10-14 14:55:09 +00:00
|
|
|
func (mgr *Manager) httpPrio(w http.ResponseWriter, r *http.Request) {
|
|
|
|
mgr.mu.Lock()
|
|
|
|
defer mgr.mu.Unlock()
|
|
|
|
|
|
|
|
call := r.FormValue("call")
|
|
|
|
idx := -1
|
2017-09-14 17:25:01 +00:00
|
|
|
for i, c := range mgr.target.Syscalls {
|
2015-10-14 14:55:09 +00:00
|
|
|
if c.CallName == call {
|
|
|
|
idx = i
|
|
|
|
break
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if idx == -1 {
|
|
|
|
http.Error(w, fmt.Sprintf("unknown call: %v", call), http.StatusInternalServerError)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2018-11-12 20:26:29 +00:00
|
|
|
var corpus []*prog.Prog
|
|
|
|
for _, inp := range mgr.corpus {
|
2018-12-09 17:05:58 +00:00
|
|
|
p, err := mgr.target.Deserialize(inp.Prog, prog.NonStrict)
|
2018-11-12 20:26:29 +00:00
|
|
|
if err != nil {
|
|
|
|
http.Error(w, fmt.Sprintf("failed to deserialize program: %v", err), http.StatusInternalServerError)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
corpus = append(corpus, p)
|
|
|
|
}
|
|
|
|
prios := mgr.target.CalculatePriorities(corpus)
|
|
|
|
|
2015-10-14 14:55:09 +00:00
|
|
|
data := &UIPrioData{Call: call}
|
2018-11-12 20:26:29 +00:00
|
|
|
for i, p := range prios[idx] {
|
2017-09-14 17:25:01 +00:00
|
|
|
data.Prios = append(data.Prios, UIPrio{mgr.target.Syscalls[i].Name, p})
|
2015-10-14 14:55:09 +00:00
|
|
|
}
|
2018-11-22 13:27:37 +00:00
|
|
|
sort.Slice(data.Prios, func(i, j int) bool {
|
|
|
|
return data.Prios[i].Prio > data.Prios[j].Prio
|
|
|
|
})
|
2015-10-14 14:55:09 +00:00
|
|
|
|
|
|
|
if err := prioTemplate.Execute(w, data); err != nil {
|
|
|
|
http.Error(w, fmt.Sprintf("failed to execute template: %v", err), http.StatusInternalServerError)
|
2016-10-06 16:46:21 +00:00
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (mgr *Manager) httpFile(w http.ResponseWriter, r *http.Request) {
|
|
|
|
file := filepath.Clean(r.FormValue("name"))
|
|
|
|
if !strings.HasPrefix(file, "crashes/") && !strings.HasPrefix(file, "corpus/") {
|
|
|
|
http.Error(w, "oh, oh, oh!", http.StatusInternalServerError)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
file = filepath.Join(mgr.cfg.Workdir, file)
|
|
|
|
f, err := os.Open(file)
|
|
|
|
if err != nil {
|
|
|
|
http.Error(w, "failed to open the file", http.StatusInternalServerError)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
defer f.Close()
|
|
|
|
w.Header().Set("Content-Type", "text/plain; charset=utf-8")
|
|
|
|
io.Copy(w, f)
|
|
|
|
}
|
|
|
|
|
2018-11-22 13:27:37 +00:00
|
|
|
func (mgr *Manager) httpInput(w http.ResponseWriter, r *http.Request) {
|
|
|
|
mgr.mu.Lock()
|
|
|
|
defer mgr.mu.Unlock()
|
|
|
|
inp, ok := mgr.corpus[r.FormValue("sig")]
|
|
|
|
if !ok {
|
|
|
|
http.Error(w, "can't find the input", http.StatusInternalServerError)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
w.Header().Set("Content-Type", "text/plain; charset=utf-8")
|
|
|
|
w.Write(inp.Prog)
|
|
|
|
}
|
|
|
|
|
2016-11-25 10:04:06 +00:00
|
|
|
func (mgr *Manager) httpReport(w http.ResponseWriter, r *http.Request) {
|
|
|
|
mgr.mu.Lock()
|
|
|
|
defer mgr.mu.Unlock()
|
|
|
|
|
|
|
|
crashID := r.FormValue("id")
|
|
|
|
desc, err := ioutil.ReadFile(filepath.Join(mgr.crashdir, crashID, "description"))
|
|
|
|
if err != nil {
|
|
|
|
http.Error(w, "failed to read description file", http.StatusInternalServerError)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
tag, _ := ioutil.ReadFile(filepath.Join(mgr.crashdir, crashID, "repro.tag"))
|
|
|
|
prog, _ := ioutil.ReadFile(filepath.Join(mgr.crashdir, crashID, "repro.prog"))
|
|
|
|
cprog, _ := ioutil.ReadFile(filepath.Join(mgr.crashdir, crashID, "repro.cprog"))
|
2017-06-06 14:07:18 +00:00
|
|
|
rep, _ := ioutil.ReadFile(filepath.Join(mgr.crashdir, crashID, "repro.report"))
|
2016-11-25 10:04:06 +00:00
|
|
|
|
2017-07-19 15:35:40 +00:00
|
|
|
commitDesc := ""
|
|
|
|
if len(tag) != 0 {
|
|
|
|
commitDesc = fmt.Sprintf(" on commit %s.", trimNewLines(tag))
|
|
|
|
}
|
|
|
|
fmt.Fprintf(w, "Syzkaller hit '%s' bug%s.\n\n", trimNewLines(desc), commitDesc)
|
2017-06-06 14:07:18 +00:00
|
|
|
if len(rep) != 0 {
|
|
|
|
fmt.Fprintf(w, "%s\n\n", rep)
|
2016-11-25 10:04:06 +00:00
|
|
|
}
|
|
|
|
if len(prog) == 0 && len(cprog) == 0 {
|
|
|
|
fmt.Fprintf(w, "The bug is not reproducible.\n")
|
|
|
|
} else {
|
|
|
|
fmt.Fprintf(w, "Syzkaller reproducer:\n%s\n\n", prog)
|
|
|
|
if len(cprog) != 0 {
|
|
|
|
fmt.Fprintf(w, "C reproducer:\n%s\n\n", cprog)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-10-11 20:24:29 +00:00
|
|
|
func (mgr *Manager) httpRawCover(w http.ResponseWriter, r *http.Request) {
|
|
|
|
mgr.mu.Lock()
|
|
|
|
defer mgr.mu.Unlock()
|
|
|
|
|
2018-08-31 19:30:18 +00:00
|
|
|
initCoverOnce.Do(func() {
|
2018-12-09 14:32:10 +00:00
|
|
|
initCoverError = initCover(mgr.cfg.KernelObj, mgr.sysTarget.KernelObject,
|
2018-12-31 18:07:41 +00:00
|
|
|
mgr.cfg.KernelSrc, mgr.cfg.TargetArch, mgr.cfg.TargetOS)
|
2018-08-31 19:30:18 +00:00
|
|
|
})
|
2018-06-21 12:38:08 +00:00
|
|
|
if initCoverError != nil {
|
|
|
|
http.Error(w, initCoverError.Error(), http.StatusInternalServerError)
|
2017-10-11 20:24:29 +00:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
var cov cover.Cover
|
|
|
|
for _, inp := range mgr.corpus {
|
2018-02-20 19:44:04 +00:00
|
|
|
cov.Merge(inp.Cover)
|
2017-10-11 20:24:29 +00:00
|
|
|
}
|
2018-02-20 19:44:04 +00:00
|
|
|
pcs := make([]uint64, 0, len(cov))
|
|
|
|
for pc := range cov {
|
2018-06-21 12:38:08 +00:00
|
|
|
fullPC := cover.RestorePC(pc, initCoverVMOffset)
|
2018-12-09 14:32:10 +00:00
|
|
|
prevPC := cover.PreviousInstructionPC(mgr.cfg.TargetVMArch, fullPC)
|
2018-04-27 12:14:03 +00:00
|
|
|
pcs = append(pcs, prevPC)
|
2018-02-20 19:44:04 +00:00
|
|
|
}
|
|
|
|
sort.Slice(pcs, func(i, j int) bool {
|
|
|
|
return pcs[i] < pcs[j]
|
|
|
|
})
|
2017-10-11 20:24:29 +00:00
|
|
|
|
|
|
|
w.Header().Set("Content-Type", "text/plain; charset=utf-8")
|
|
|
|
buf := bufio.NewWriter(w)
|
2018-02-20 19:44:04 +00:00
|
|
|
for _, pc := range pcs {
|
|
|
|
fmt.Fprintf(buf, "0x%x\n", pc)
|
2017-10-11 20:24:29 +00:00
|
|
|
}
|
|
|
|
buf.Flush()
|
|
|
|
}
|
|
|
|
|
2018-04-02 10:58:03 +00:00
|
|
|
func (mgr *Manager) collectCrashes(workdir string) ([]*UICrashType, error) {
|
|
|
|
// Note: mu is not locked here.
|
|
|
|
reproReply := make(chan map[string]bool)
|
|
|
|
mgr.reproRequest <- reproReply
|
|
|
|
repros := <-reproReply
|
|
|
|
|
2017-01-30 14:23:29 +00:00
|
|
|
crashdir := filepath.Join(workdir, "crashes")
|
2017-08-06 14:47:16 +00:00
|
|
|
dirs, err := osutil.ListDir(crashdir)
|
2016-10-06 16:46:21 +00:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
2015-10-14 14:55:09 +00:00
|
|
|
}
|
2017-01-16 20:39:34 +00:00
|
|
|
var crashTypes []*UICrashType
|
2016-10-06 16:46:21 +00:00
|
|
|
for _, dir := range dirs {
|
2018-11-22 13:27:37 +00:00
|
|
|
crash := readCrash(workdir, dir, repros, mgr.startTime, false)
|
2017-01-16 20:39:34 +00:00
|
|
|
if crash != nil {
|
|
|
|
crashTypes = append(crashTypes, crash)
|
2016-10-06 16:46:21 +00:00
|
|
|
}
|
2017-01-16 20:39:34 +00:00
|
|
|
}
|
2018-11-22 13:27:37 +00:00
|
|
|
sort.Slice(crashTypes, func(i, j int) bool {
|
|
|
|
return strings.ToLower(crashTypes[i].Description) < strings.ToLower(crashTypes[j].Description)
|
|
|
|
})
|
2017-01-16 20:39:34 +00:00
|
|
|
return crashTypes, nil
|
|
|
|
}
|
|
|
|
|
2018-11-22 13:27:37 +00:00
|
|
|
func readCrash(workdir, dir string, repros map[string]bool, start time.Time, full bool) *UICrashType {
|
2017-01-16 20:39:34 +00:00
|
|
|
if len(dir) != 40 {
|
|
|
|
return nil
|
|
|
|
}
|
2017-01-30 14:23:29 +00:00
|
|
|
crashdir := filepath.Join(workdir, "crashes")
|
|
|
|
descFile, err := os.Open(filepath.Join(crashdir, dir, "description"))
|
2017-01-16 20:39:34 +00:00
|
|
|
if err != nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
defer descFile.Close()
|
2018-08-02 14:44:21 +00:00
|
|
|
descBytes, err := ioutil.ReadAll(descFile)
|
|
|
|
if err != nil || len(descBytes) == 0 {
|
2017-01-16 20:39:34 +00:00
|
|
|
return nil
|
|
|
|
}
|
2018-08-02 14:44:21 +00:00
|
|
|
desc := string(trimNewLines(descBytes))
|
2017-01-16 20:39:34 +00:00
|
|
|
stat, err := descFile.Stat()
|
|
|
|
if err != nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
modTime := stat.ModTime()
|
|
|
|
descFile.Close()
|
|
|
|
|
2017-08-06 14:47:16 +00:00
|
|
|
files, err := osutil.ListDir(filepath.Join(crashdir, dir))
|
2017-01-16 20:39:34 +00:00
|
|
|
if err != nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
var crashes []*UICrash
|
|
|
|
reproAttempts := 0
|
|
|
|
hasRepro, hasCRepro := false, false
|
|
|
|
reports := make(map[string]bool)
|
|
|
|
for _, f := range files {
|
|
|
|
if strings.HasPrefix(f, "log") {
|
|
|
|
index, err := strconv.ParseUint(f[3:], 10, 64)
|
|
|
|
if err == nil {
|
|
|
|
crashes = append(crashes, &UICrash{
|
|
|
|
Index: int(index),
|
|
|
|
})
|
2016-10-06 16:46:21 +00:00
|
|
|
}
|
2017-01-16 20:39:34 +00:00
|
|
|
} else if strings.HasPrefix(f, "report") {
|
|
|
|
reports[f] = true
|
|
|
|
} else if f == "repro.prog" {
|
|
|
|
hasRepro = true
|
|
|
|
} else if f == "repro.cprog" {
|
|
|
|
hasCRepro = true
|
|
|
|
} else if f == "repro.report" {
|
|
|
|
} else if f == "repro0" || f == "repro1" || f == "repro2" {
|
|
|
|
reproAttempts++
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if full {
|
|
|
|
for _, crash := range crashes {
|
|
|
|
index := strconv.Itoa(crash.Index)
|
|
|
|
crash.Log = filepath.Join("crashes", dir, "log"+index)
|
2017-01-30 14:23:29 +00:00
|
|
|
if stat, err := os.Stat(filepath.Join(workdir, crash.Log)); err == nil {
|
2017-01-16 20:39:34 +00:00
|
|
|
crash.Time = stat.ModTime()
|
2018-11-22 13:27:37 +00:00
|
|
|
crash.Active = crash.Time.After(start)
|
2016-10-06 16:46:21 +00:00
|
|
|
}
|
2017-01-30 14:23:29 +00:00
|
|
|
tag, _ := ioutil.ReadFile(filepath.Join(crashdir, dir, "tag"+index))
|
2017-01-16 20:39:34 +00:00
|
|
|
crash.Tag = string(tag)
|
|
|
|
reportFile := filepath.Join("crashes", dir, "report"+index)
|
2017-06-17 10:23:52 +00:00
|
|
|
if osutil.IsExist(filepath.Join(workdir, reportFile)) {
|
2016-10-06 16:46:21 +00:00
|
|
|
crash.Report = reportFile
|
|
|
|
}
|
|
|
|
}
|
2018-11-22 13:27:37 +00:00
|
|
|
sort.Slice(crashes, func(i, j int) bool {
|
|
|
|
return crashes[i].Time.After(crashes[j].Time)
|
|
|
|
})
|
2017-01-16 20:39:34 +00:00
|
|
|
}
|
2016-11-25 10:04:06 +00:00
|
|
|
|
2018-08-02 14:44:21 +00:00
|
|
|
triaged := reproStatus(hasRepro, hasCRepro, repros[desc], reproAttempts >= maxReproAttempts)
|
2017-01-16 20:39:34 +00:00
|
|
|
return &UICrashType{
|
2018-08-02 14:44:21 +00:00
|
|
|
Description: desc,
|
2018-11-22 13:27:37 +00:00
|
|
|
LastTime: modTime,
|
|
|
|
Active: modTime.After(start),
|
2017-01-16 20:39:34 +00:00
|
|
|
ID: dir,
|
|
|
|
Count: len(crashes),
|
|
|
|
Triaged: triaged,
|
|
|
|
Crashes: crashes,
|
2016-10-06 16:46:21 +00:00
|
|
|
}
|
2017-01-16 20:39:34 +00:00
|
|
|
}
|
|
|
|
|
2018-08-02 14:44:21 +00:00
|
|
|
func reproStatus(hasRepro, hasCRepro, reproducing, nonReproducible bool) string {
|
|
|
|
status := ""
|
|
|
|
if hasRepro {
|
|
|
|
status = "has repro"
|
|
|
|
if hasCRepro {
|
|
|
|
status = "has C repro"
|
|
|
|
}
|
|
|
|
} else if reproducing {
|
|
|
|
status = "reproducing"
|
|
|
|
} else if nonReproducible {
|
|
|
|
status = "non-reproducible"
|
|
|
|
}
|
|
|
|
return status
|
|
|
|
}
|
|
|
|
|
2016-11-25 10:04:06 +00:00
|
|
|
func trimNewLines(data []byte) []byte {
|
|
|
|
for len(data) > 0 && data[len(data)-1] == '\n' {
|
|
|
|
data = data[:len(data)-1]
|
|
|
|
}
|
|
|
|
return data
|
|
|
|
}
|
|
|
|
|
2016-10-06 16:46:21 +00:00
|
|
|
type UISummaryData struct {
|
2016-11-16 12:17:47 +00:00
|
|
|
Name string
|
2016-10-06 17:48:44 +00:00
|
|
|
Stats []UIStat
|
2017-01-16 20:39:34 +00:00
|
|
|
Crashes []*UICrashType
|
2016-10-09 09:45:39 +00:00
|
|
|
Log string
|
2016-10-06 16:46:21 +00:00
|
|
|
}
|
|
|
|
|
2018-04-02 11:11:06 +00:00
|
|
|
type UISyscallsData struct {
|
|
|
|
Name string
|
|
|
|
Calls []UICallType
|
|
|
|
}
|
|
|
|
|
2016-10-06 16:46:21 +00:00
|
|
|
type UICrashType struct {
|
|
|
|
Description string
|
2018-11-22 13:27:37 +00:00
|
|
|
LastTime time.Time
|
|
|
|
Active bool
|
2016-10-06 16:46:21 +00:00
|
|
|
ID string
|
|
|
|
Count int
|
2016-11-25 10:04:06 +00:00
|
|
|
Triaged string
|
2017-01-16 20:39:34 +00:00
|
|
|
Crashes []*UICrash
|
2016-10-06 16:46:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type UICrash struct {
|
2018-11-22 13:27:37 +00:00
|
|
|
Index int
|
|
|
|
Time time.Time
|
|
|
|
Active bool
|
|
|
|
Log string
|
|
|
|
Report string
|
|
|
|
Tag string
|
2015-10-12 08:16:57 +00:00
|
|
|
}
|
|
|
|
|
2015-11-19 18:02:30 +00:00
|
|
|
type UIStat struct {
|
|
|
|
Name string
|
|
|
|
Value string
|
2016-10-06 17:48:44 +00:00
|
|
|
Link string
|
2015-11-19 18:02:30 +00:00
|
|
|
}
|
|
|
|
|
2015-10-12 08:16:57 +00:00
|
|
|
type UICallType struct {
|
2017-01-25 21:18:42 +00:00
|
|
|
Name string
|
|
|
|
Inputs int
|
|
|
|
Cover int
|
2015-10-12 08:16:57 +00:00
|
|
|
}
|
|
|
|
|
2018-11-22 13:27:37 +00:00
|
|
|
type UICorpus struct {
|
|
|
|
Call string
|
|
|
|
Inputs []*UIInput
|
|
|
|
}
|
|
|
|
|
2015-10-12 08:16:57 +00:00
|
|
|
type UIInput struct {
|
2018-11-22 13:27:37 +00:00
|
|
|
Sig string
|
2017-01-25 21:18:42 +00:00
|
|
|
Short string
|
|
|
|
Cover int
|
2015-10-12 08:16:57 +00:00
|
|
|
}
|
|
|
|
|
2018-11-22 13:27:37 +00:00
|
|
|
var summaryTemplate = html.CreatePage(`
|
2015-10-12 08:16:57 +00:00
|
|
|
<!doctype html>
|
|
|
|
<html>
|
|
|
|
<head>
|
2016-11-16 12:17:47 +00:00
|
|
|
<title>{{.Name }} syzkaller</title>
|
2018-11-22 13:27:37 +00:00
|
|
|
{{HEAD}}
|
2015-10-12 08:16:57 +00:00
|
|
|
</head>
|
|
|
|
<body>
|
2016-11-16 12:17:47 +00:00
|
|
|
<b>{{.Name }} syzkaller</b>
|
2015-10-12 08:16:57 +00:00
|
|
|
<br>
|
2016-10-06 17:48:44 +00:00
|
|
|
|
2018-11-22 13:27:37 +00:00
|
|
|
<table class="list_table">
|
2016-10-10 15:32:27 +00:00
|
|
|
<caption>Stats:</caption>
|
2016-10-06 17:48:44 +00:00
|
|
|
{{range $s := $.Stats}}
|
|
|
|
<tr>
|
2018-11-22 13:27:37 +00:00
|
|
|
<td class="stat_name">{{$s.Name}}</td>
|
|
|
|
<td class="stat_value">
|
|
|
|
{{if $s.Link}}
|
|
|
|
<a href="{{$s.Link}}">{{$s.Value}}</a>
|
|
|
|
{{else}}
|
|
|
|
{{$s.Value}}
|
|
|
|
{{end}}
|
|
|
|
</td>
|
2016-10-06 17:48:44 +00:00
|
|
|
</tr>
|
|
|
|
{{end}}
|
|
|
|
</table>
|
2016-10-06 16:46:21 +00:00
|
|
|
|
2018-11-22 13:27:37 +00:00
|
|
|
<table class="list_table">
|
2016-10-10 15:32:27 +00:00
|
|
|
<caption>Crashes:</caption>
|
2016-10-06 16:46:21 +00:00
|
|
|
<tr>
|
2018-11-22 13:27:37 +00:00
|
|
|
<th><a onclick="return sortTable(this, 'Description', textSort)" href="#">Description</a></th>
|
|
|
|
<th><a onclick="return sortTable(this, 'Count', numSort)" href="#">Count</a></th>
|
|
|
|
<th><a onclick="return sortTable(this, 'Last Time', textSort, true)" href="#">Last Time</a></th>
|
|
|
|
<th><a onclick="return sortTable(this, 'Report', textSort)" href="#">Report</a></th>
|
2016-10-06 16:46:21 +00:00
|
|
|
</tr>
|
|
|
|
{{range $c := $.Crashes}}
|
|
|
|
<tr>
|
2018-11-22 13:27:37 +00:00
|
|
|
<td class="title"><a href="/crash?id={{$c.ID}}">{{$c.Description}}</a></td>
|
|
|
|
<td class="stat {{if not $c.Active}}inactive{{end}}">{{$c.Count}}</td>
|
|
|
|
<td class="time {{if not $c.Active}}inactive{{end}}">{{formatTime $c.LastTime}}</td>
|
2016-11-25 10:04:06 +00:00
|
|
|
<td>
|
|
|
|
{{if $c.Triaged}}
|
|
|
|
<a href="/report?id={{$c.ID}}">{{$c.Triaged}}</a>
|
|
|
|
{{end}}
|
|
|
|
</td>
|
2016-10-06 16:46:21 +00:00
|
|
|
</tr>
|
|
|
|
{{end}}
|
|
|
|
</table>
|
|
|
|
|
2016-10-10 11:11:31 +00:00
|
|
|
<b>Log:</b>
|
2016-10-09 09:45:39 +00:00
|
|
|
<br>
|
2018-11-22 13:27:37 +00:00
|
|
|
<textarea id="log_textarea" readonly rows="20" wrap=off>
|
2016-10-09 09:45:39 +00:00
|
|
|
{{.Log}}
|
|
|
|
</textarea>
|
2016-10-10 11:00:27 +00:00
|
|
|
<script>
|
|
|
|
var textarea = document.getElementById("log_textarea");
|
|
|
|
textarea.scrollTop = textarea.scrollHeight;
|
|
|
|
</script>
|
2018-04-02 11:11:06 +00:00
|
|
|
</body></html>
|
2018-11-22 13:27:37 +00:00
|
|
|
`)
|
2016-10-09 09:45:39 +00:00
|
|
|
|
2018-11-22 13:27:37 +00:00
|
|
|
var syscallsTemplate = html.CreatePage(`
|
2018-04-02 11:11:06 +00:00
|
|
|
<!doctype html>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<title>{{.Name }} syzkaller</title>
|
2018-11-22 13:27:37 +00:00
|
|
|
{{HEAD}}
|
2018-04-02 11:11:06 +00:00
|
|
|
</head>
|
|
|
|
<body>
|
2018-11-22 13:27:37 +00:00
|
|
|
|
|
|
|
<table class="list_table">
|
|
|
|
<caption>Per-syscall coverage:</caption>
|
|
|
|
<tr>
|
|
|
|
<th><a onclick="return sortTable(this, 'Syscall', textSort)" href="#">Syscall</a></th>
|
|
|
|
<th><a onclick="return sortTable(this, 'Inputs', numSort)" href="#">Inputs</a></th>
|
|
|
|
<th><a onclick="return sortTable(this, 'Coverage', numSort)" href="#">Coverage</a></th>
|
|
|
|
<th>Prio</th>
|
|
|
|
</tr>
|
|
|
|
{{range $c := $.Calls}}
|
|
|
|
<tr>
|
|
|
|
<td>{{$c.Name}}</td>
|
|
|
|
<td><a href='/corpus?call={{$c.Name}}'>{{$c.Inputs}}</a></td>
|
|
|
|
<td><a href='/cover?call={{$c.Name}}'>{{$c.Cover}}</a></td>
|
|
|
|
<td><a href='/prio?call={{$c.Name}}'>prio</a></td>
|
|
|
|
</tr>
|
|
|
|
{{end}}
|
|
|
|
</table>
|
2015-10-12 08:16:57 +00:00
|
|
|
</body></html>
|
2018-11-22 13:27:37 +00:00
|
|
|
`)
|
2015-10-12 08:16:57 +00:00
|
|
|
|
2018-11-22 13:27:37 +00:00
|
|
|
var crashTemplate = html.CreatePage(`
|
2015-10-12 08:16:57 +00:00
|
|
|
<!doctype html>
|
|
|
|
<html>
|
|
|
|
<head>
|
2016-10-06 16:46:21 +00:00
|
|
|
<title>{{.Description}}</title>
|
2018-11-22 13:27:37 +00:00
|
|
|
{{HEAD}}
|
2016-10-06 16:46:21 +00:00
|
|
|
</head>
|
|
|
|
<body>
|
2016-10-10 11:11:31 +00:00
|
|
|
<b>{{.Description}}</b>
|
2016-11-25 10:04:06 +00:00
|
|
|
|
|
|
|
{{if .Triaged}}
|
|
|
|
Report: <a href="/report?id={{.ID}}">{{.Triaged}}</a>
|
|
|
|
{{end}}
|
|
|
|
|
2018-11-22 13:27:37 +00:00
|
|
|
<table class="list_table">
|
2016-10-10 15:32:27 +00:00
|
|
|
<tr>
|
|
|
|
<th>#</th>
|
|
|
|
<th>Log</th>
|
|
|
|
<th>Report</th>
|
|
|
|
<th>Time</th>
|
|
|
|
<th>Tag</th>
|
|
|
|
</tr>
|
2016-10-06 16:46:21 +00:00
|
|
|
{{range $c := $.Crashes}}
|
|
|
|
<tr>
|
2016-10-10 15:32:27 +00:00
|
|
|
<td>{{$c.Index}}</td>
|
2016-10-06 16:46:21 +00:00
|
|
|
<td><a href="/file?name={{$c.Log}}">log</a></td>
|
2018-11-22 13:27:37 +00:00
|
|
|
<td>
|
|
|
|
{{if $c.Report}}
|
|
|
|
<a href="/file?name={{$c.Report}}">report</a></td>
|
|
|
|
{{end}}
|
|
|
|
</td>
|
|
|
|
<td class="time {{if not $c.Active}}inactive{{end}}">{{formatTime $c.Time}}</td>
|
|
|
|
<td class="tag {{if not $c.Active}}inactive{{end}}" title="{{$c.Tag}}">{{formatShortHash $c.Tag}}</td>
|
2016-10-06 16:46:21 +00:00
|
|
|
</tr>
|
|
|
|
{{end}}
|
|
|
|
</table>
|
|
|
|
</body></html>
|
2018-11-22 13:27:37 +00:00
|
|
|
`)
|
2016-10-06 16:46:21 +00:00
|
|
|
|
2018-11-22 13:27:37 +00:00
|
|
|
var corpusTemplate = html.CreatePage(`
|
2016-10-06 16:46:21 +00:00
|
|
|
<!doctype html>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<title>syzkaller corpus</title>
|
2018-11-22 13:27:37 +00:00
|
|
|
{{HEAD}}
|
2015-10-12 08:16:57 +00:00
|
|
|
</head>
|
|
|
|
<body>
|
2018-11-22 13:27:37 +00:00
|
|
|
|
|
|
|
<table class="list_table">
|
|
|
|
<caption>Corpus{{if $.Call}} for {{$.Call}}{{end}}:</caption>
|
|
|
|
<tr>
|
|
|
|
<th>Coverage</th>
|
|
|
|
<th>Program</th>
|
|
|
|
</tr>
|
|
|
|
{{range $inp := $.Inputs}}
|
|
|
|
<tr>
|
|
|
|
<td><a href='/cover?input={{$inp.Sig}}'>{{$inp.Cover}}</a></td>
|
|
|
|
<td><a href="/input?sig={{$inp.Sig}}">{{$inp.Short}}</a></td>
|
|
|
|
</tr>
|
|
|
|
{{end}}
|
|
|
|
</table>
|
2015-10-12 08:16:57 +00:00
|
|
|
</body></html>
|
2018-11-22 13:27:37 +00:00
|
|
|
`)
|
2015-10-14 14:55:09 +00:00
|
|
|
|
|
|
|
type UIPrioData struct {
|
|
|
|
Call string
|
|
|
|
Prios []UIPrio
|
|
|
|
}
|
|
|
|
|
|
|
|
type UIPrio struct {
|
|
|
|
Call string
|
|
|
|
Prio float32
|
|
|
|
}
|
|
|
|
|
2018-11-22 13:27:37 +00:00
|
|
|
var prioTemplate = html.CreatePage(`
|
2015-10-14 14:55:09 +00:00
|
|
|
<!doctype html>
|
|
|
|
<html>
|
|
|
|
<head>
|
2016-10-06 16:46:21 +00:00
|
|
|
<title>syzkaller priorities</title>
|
2018-11-22 13:27:37 +00:00
|
|
|
{{HEAD}}
|
2015-10-14 14:55:09 +00:00
|
|
|
</head>
|
|
|
|
<body>
|
2018-11-22 13:27:37 +00:00
|
|
|
<table class="list_table">
|
|
|
|
<caption>Priorities for {{$.Call}}:</caption>
|
|
|
|
<tr>
|
|
|
|
<th><a onclick="return sortTable(this, 'Prio', floatSort)" href="#">Prio</a></th>
|
|
|
|
<th><a onclick="return sortTable(this, 'Call', textSort)" href="#">Call</a></th>
|
|
|
|
</tr>
|
|
|
|
{{range $p := $.Prios}}
|
|
|
|
<tr>
|
|
|
|
<td>{{printf "%.4f" $p.Prio}}</td>
|
|
|
|
<td><a href='/prio?call={{$p.Call}}'>{{$p.Call}}</a></td>
|
|
|
|
</tr>
|
|
|
|
{{end}}
|
|
|
|
</table>
|
2015-10-14 14:55:09 +00:00
|
|
|
</body></html>
|
2018-11-22 13:27:37 +00:00
|
|
|
`)
|
2016-10-06 16:46:21 +00:00
|
|
|
|
2018-06-29 16:15:41 +00:00
|
|
|
type UIFallbackCoverData struct {
|
|
|
|
Calls []UIFallbackCall
|
|
|
|
}
|
|
|
|
|
|
|
|
type UIFallbackCall struct {
|
2018-06-29 18:34:43 +00:00
|
|
|
Name string
|
|
|
|
Successful int
|
|
|
|
Errnos []int
|
2018-06-29 16:15:41 +00:00
|
|
|
}
|
|
|
|
|
2018-11-22 13:27:37 +00:00
|
|
|
var fallbackCoverTemplate = html.CreatePage(`
|
2018-06-29 16:15:41 +00:00
|
|
|
<!doctype html>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<title>syzkaller coverage</title>
|
2018-11-22 13:27:37 +00:00
|
|
|
{{HEAD}}
|
2018-06-29 16:15:41 +00:00
|
|
|
</head>
|
|
|
|
<body>
|
2018-11-22 13:27:37 +00:00
|
|
|
<table class="list_table">
|
2018-06-29 16:15:41 +00:00
|
|
|
<tr>
|
|
|
|
<th>Call</th>
|
2018-06-29 18:34:43 +00:00
|
|
|
<th>Successful</th>
|
2018-06-29 16:15:41 +00:00
|
|
|
<th>Errnos</th>
|
|
|
|
</tr>
|
|
|
|
{{range $c := $.Calls}}
|
|
|
|
<tr>
|
|
|
|
<td>{{$c.Name}}</td>
|
2018-06-29 18:34:43 +00:00
|
|
|
<td>{{if $c.Successful}}{{$c.Successful}}{{end}}</td>
|
|
|
|
<td>{{range $e := $c.Errnos}}{{$e}} {{end}}</td>
|
2018-06-29 16:15:41 +00:00
|
|
|
</tr>
|
|
|
|
{{end}}
|
|
|
|
</table>
|
|
|
|
</body></html>
|
2018-11-22 13:27:37 +00:00
|
|
|
`)
|