mirror of
https://github.com/reactos/syzkaller.git
synced 2024-11-23 11:29:46 +00:00
all: fix too long lines
Not sure why I have not seen warnings about these lines on another machine...
This commit is contained in:
parent
31ea20ce83
commit
78b251cbd7
@ -17,7 +17,8 @@ import (
|
||||
"github.com/google/syzkaller/pkg/osutil"
|
||||
)
|
||||
|
||||
func extract(info *compiler.ConstInfo, cc string, args []string, addSource string, declarePrintf bool) (map[string]uint64, map[string]bool, error) {
|
||||
func extract(info *compiler.ConstInfo, cc string, args []string, addSource string, declarePrintf bool) (
|
||||
map[string]uint64, map[string]bool, error) {
|
||||
data := &CompileData{
|
||||
AddSource: addSource,
|
||||
Defines: info.Defines,
|
||||
|
@ -381,7 +381,8 @@ func (fuzzer *Fuzzer) pollLoop() {
|
||||
}
|
||||
}
|
||||
|
||||
func buildCallList(target *prog.Target, enabledCalls []int, sandbox string) (map[*prog.Syscall]bool, []rpctype.SyscallReason) {
|
||||
func buildCallList(target *prog.Target, enabledCalls []int, sandbox string) (
|
||||
map[*prog.Syscall]bool, []rpctype.SyscallReason) {
|
||||
calls := make(map[*prog.Syscall]bool)
|
||||
for _, n := range enabledCalls {
|
||||
if n >= len(target.Syscalls) {
|
||||
|
@ -757,8 +757,10 @@ func (mgr *Manager) saveRepro(res *repro.Result, hub bool) {
|
||||
osutil.WriteFile(filepath.Join(dir, "repro.report"), rep.Report)
|
||||
}
|
||||
osutil.WriteFile(filepath.Join(dir, "repro.stats.log"), res.Stats.Log)
|
||||
stats := fmt.Sprintf("Extracting prog: %s\nMinimizing prog: %s\nSimplifying prog options: %s\nExtracting C: %s\nSimplifying C: %s\n",
|
||||
res.Stats.ExtractProgTime, res.Stats.MinimizeProgTime, res.Stats.SimplifyProgTime, res.Stats.ExtractCTime, res.Stats.SimplifyCTime)
|
||||
stats := fmt.Sprintf("Extracting prog: %s\nMinimizing prog: %s\nSimplifying prog options: %s\n"+
|
||||
"Extracting C: %s\nSimplifying C: %s\n",
|
||||
res.Stats.ExtractProgTime, res.Stats.MinimizeProgTime, res.Stats.SimplifyProgTime,
|
||||
res.Stats.ExtractCTime, res.Stats.SimplifyCTime)
|
||||
osutil.WriteFile(filepath.Join(dir, "repro.stats"), []byte(stats))
|
||||
var cprogText []byte
|
||||
if res.CRepro {
|
||||
@ -928,7 +930,8 @@ func (mgr *Manager) Check(a *rpctype.CheckArgs, r *int) error {
|
||||
log.Fatalf("/sys/kernel/debug/kcov is missing on target machine. Enable CONFIG_KCOV and mount debugfs")
|
||||
}
|
||||
if mgr.cfg.Sandbox == "namespace" && !a.UserNamespaces {
|
||||
log.Fatalf("/proc/self/ns/user is missing on target machine or permission is denied. Can't use requested namespace sandbox. Enable CONFIG_USER_NS")
|
||||
log.Fatalf("/proc/self/ns/user is missing on target machine or permission is denied." +
|
||||
" Can't use requested namespace sandbox. Enable CONFIG_USER_NS")
|
||||
}
|
||||
if mgr.vmPool != nil {
|
||||
if mgr.target.Arch != a.ExecutorArch {
|
||||
@ -936,13 +939,15 @@ func (mgr *Manager) Check(a *rpctype.CheckArgs, r *int) error {
|
||||
mgr.target.Arch, a.ExecutorArch)
|
||||
}
|
||||
if sys.GitRevision != a.FuzzerGitRev || sys.GitRevision != a.ExecutorGitRev {
|
||||
log.Fatalf("syz-manager, syz-fuzzer and syz-executor binaries are built on different git revisions\n"+
|
||||
log.Fatalf("syz-manager, syz-fuzzer and syz-executor binaries are built"+
|
||||
" on different git revisions\n"+
|
||||
"manager= %v\nfuzzer= %v\nexecutor=%v\n"+
|
||||
"this is not supported, rebuild all binaries with make",
|
||||
sys.GitRevision, a.FuzzerGitRev, a.ExecutorGitRev)
|
||||
}
|
||||
if mgr.target.Revision != a.FuzzerSyzRev || mgr.target.Revision != a.ExecutorSyzRev {
|
||||
log.Fatalf("syz-manager, syz-fuzzer and syz-executor binaries have different versions of system call descriptions compiled in\n"+
|
||||
log.Fatalf("syz-manager, syz-fuzzer and syz-executor binaries have different"+
|
||||
" versions of system call descriptions compiled in\n"+
|
||||
"manager= %v\nfuzzer= %v\nexecutor=%v\n"+
|
||||
"this is not supported, rebuild all binaries with make",
|
||||
mgr.target.Revision, a.FuzzerSyzRev, a.ExecutorSyzRev)
|
||||
@ -1209,8 +1214,10 @@ func (mgr *Manager) hubSync() {
|
||||
mgr.stats["hub new"] += uint64(len(r.Progs) - dropped)
|
||||
mgr.stats["hub sent repros"] += uint64(len(a.Repros))
|
||||
mgr.stats["hub recv repros"] += uint64(len(r.Repros) - reproDropped)
|
||||
log.Logf(0, "hub sync: send: add %v, del %v, repros %v; recv: progs: drop %v, new %v, repros: drop: %v, new %v; more %v",
|
||||
len(a.Add), len(a.Del), len(a.Repros), dropped, len(r.Progs)-dropped, reproDropped, len(r.Repros)-reproDropped, r.More)
|
||||
log.Logf(0, "hub sync: send: add %v, del %v, repros %v; recv: progs: drop %v, new %v,"+
|
||||
" repros: drop: %v, new %v; more %v",
|
||||
len(a.Add), len(a.Del), len(a.Repros), dropped, len(r.Progs)-dropped,
|
||||
reproDropped, len(r.Repros)-reproDropped, r.More)
|
||||
if len(r.Progs)+r.More == 0 {
|
||||
break
|
||||
}
|
||||
|
@ -94,7 +94,8 @@ func main() {
|
||||
if syscallSuffix == "ext2" || syscallSuffix == "ext3" {
|
||||
syscallSuffix = "ext4"
|
||||
}
|
||||
fmt.Printf(`syz_mount_image$%v(&(0x7f0000000000)='%v\x00', &(0x7f0000000100)='./file0\x00', 0x%x, 0x%x, &(0x7f0000000200)=[`,
|
||||
fmt.Printf(`syz_mount_image$%v(&(0x7f0000000000)='%v\x00', &(0x7f0000000100)='./file0\x00',`+
|
||||
` 0x%x, 0x%x, &(0x7f0000000200)=[`,
|
||||
syscallSuffix, *flagFS, len(data0), len(segs))
|
||||
addr := 0x7f0000010000
|
||||
for i, seg := range segs {
|
||||
|
@ -382,7 +382,8 @@ func (inst *instance) Copy(hostSrc string) (string, error) {
|
||||
return vmDst, nil
|
||||
}
|
||||
|
||||
func (inst *instance) Run(timeout time.Duration, stop <-chan bool, command string) (<-chan []byte, <-chan error, error) {
|
||||
func (inst *instance) Run(timeout time.Duration, stop <-chan bool, command string) (
|
||||
<-chan []byte, <-chan error, error) {
|
||||
var tty io.ReadCloser
|
||||
var err error
|
||||
if inst.console == "adb" {
|
||||
|
@ -198,7 +198,8 @@ func (inst *instance) Copy(hostSrc string) (string, error) {
|
||||
return vmDst, nil
|
||||
}
|
||||
|
||||
func (inst *instance) Run(timeout time.Duration, stop <-chan bool, command string) (<-chan []byte, <-chan error, error) {
|
||||
func (inst *instance) Run(timeout time.Duration, stop <-chan bool, command string) (
|
||||
<-chan []byte, <-chan error, error) {
|
||||
conRpipe, conWpipe, err := osutil.LongPipe()
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
|
@ -261,7 +261,8 @@ func (inst *instance) Copy(hostSrc string) (string, error) {
|
||||
return vmDst, nil
|
||||
}
|
||||
|
||||
func (inst *instance) Run(timeout time.Duration, stop <-chan bool, command string) (<-chan []byte, <-chan error, error) {
|
||||
func (inst *instance) Run(timeout time.Duration, stop <-chan bool, command string) (
|
||||
<-chan []byte, <-chan error, error) {
|
||||
args := append(inst.sshArgs("-p"), inst.target)
|
||||
dmesg, err := vmimpl.OpenRemoteConsole("ssh", args...)
|
||||
if err != nil {
|
||||
|
@ -225,7 +225,8 @@ func (inst *instance) Copy(hostSrc string) (string, error) {
|
||||
return vmDst, nil
|
||||
}
|
||||
|
||||
func (inst *instance) Run(timeout time.Duration, stop <-chan bool, command string) (<-chan []byte, <-chan error, error) {
|
||||
func (inst *instance) Run(timeout time.Duration, stop <-chan bool, command string) (
|
||||
<-chan []byte, <-chan error, error) {
|
||||
outputC := make(chan []byte, 10)
|
||||
errorC := make(chan error, 1)
|
||||
inst.mu.Lock()
|
||||
|
@ -319,7 +319,8 @@ func (inst *instance) Copy(hostSrc string) (string, error) {
|
||||
return vmDst, nil
|
||||
}
|
||||
|
||||
func (inst *instance) Run(timeout time.Duration, stop <-chan bool, command string) (<-chan []byte, <-chan error, error) {
|
||||
func (inst *instance) Run(timeout time.Duration, stop <-chan bool, command string) (
|
||||
<-chan []byte, <-chan error, error) {
|
||||
tty, err := vmimpl.OpenConsole(inst.cfg.Console)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
|
@ -419,7 +419,8 @@ func (inst *instance) Copy(hostSrc string) (string, error) {
|
||||
return vmDst, nil
|
||||
}
|
||||
|
||||
func (inst *instance) Run(timeout time.Duration, stop <-chan bool, command string) (<-chan []byte, <-chan error, error) {
|
||||
func (inst *instance) Run(timeout time.Duration, stop <-chan bool, command string) (
|
||||
<-chan []byte, <-chan error, error) {
|
||||
rpipe, wpipe, err := osutil.LongPipe()
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
@ -489,6 +490,7 @@ func (inst *instance) sshArgs(portArg string) []string {
|
||||
return args
|
||||
}
|
||||
|
||||
// nolint: lll
|
||||
const initScript = `#! /bin/bash
|
||||
set -eux
|
||||
mount -t proc none /proc
|
||||
|
3
vm/vm.go
3
vm/vm.go
@ -92,7 +92,8 @@ func (inst *Instance) Forward(port int) (string, error) {
|
||||
return inst.impl.Forward(port)
|
||||
}
|
||||
|
||||
func (inst *Instance) Run(timeout time.Duration, stop <-chan bool, command string) (outc <-chan []byte, errc <-chan error, err error) {
|
||||
func (inst *Instance) Run(timeout time.Duration, stop <-chan bool, command string) (
|
||||
outc <-chan []byte, errc <-chan error, err error) {
|
||||
return inst.impl.Run(timeout, stop, command)
|
||||
}
|
||||
|
||||
|
@ -27,7 +27,8 @@ func OpenConsole(con string) (rc io.ReadCloser, err error) {
|
||||
}
|
||||
}()
|
||||
var term unix.Termios
|
||||
if _, _, errno := syscall.Syscall(unix.SYS_IOCTL, uintptr(fd), syscall_TCGETS, uintptr(unsafe.Pointer(&term))); errno != 0 {
|
||||
_, _, errno := syscall.Syscall(unix.SYS_IOCTL, uintptr(fd), syscall_TCGETS, uintptr(unsafe.Pointer(&term)))
|
||||
if errno != 0 {
|
||||
return nil, fmt.Errorf("failed to get console termios: %v", errno)
|
||||
}
|
||||
// no parity bit, only need 1 stop bit, no hardware flowcontrol
|
||||
@ -35,12 +36,14 @@ func OpenConsole(con string) (rc io.ReadCloser, err error) {
|
||||
// ignore modem controls
|
||||
term.Cflag |= unix.B115200 | unix.CS8 | unix.CLOCAL | unix.CREAD
|
||||
// setup for non-canonical mode
|
||||
term.Iflag &^= unix.IGNBRK | unix.BRKINT | unix.PARMRK | unix.ISTRIP | unix.INLCR | unix.IGNCR | unix.ICRNL | unix.IXON
|
||||
term.Iflag &^= unix.IGNBRK | unix.BRKINT | unix.PARMRK | unix.ISTRIP | unix.INLCR |
|
||||
unix.IGNCR | unix.ICRNL | unix.IXON
|
||||
term.Lflag &^= unix.ECHO | unix.ECHONL | unix.ICANON | unix.ISIG | unix.IEXTEN
|
||||
term.Oflag &^= unix.OPOST
|
||||
term.Cc[unix.VMIN] = 0
|
||||
term.Cc[unix.VTIME] = 10 // 1 second timeout
|
||||
if _, _, errno := syscall.Syscall(unix.SYS_IOCTL, uintptr(fd), syscall_TCSETS, uintptr(unsafe.Pointer(&term))); errno != 0 {
|
||||
_, _, errno = syscall.Syscall(unix.SYS_IOCTL, uintptr(fd), syscall_TCSETS, uintptr(unsafe.Pointer(&term)))
|
||||
if errno != 0 {
|
||||
return nil, fmt.Errorf("failed to get console termios: %v", errno)
|
||||
}
|
||||
tmp := fd
|
||||
|
Loading…
Reference in New Issue
Block a user