aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pkg/csource/csource.go34
-rw-r--r--pkg/email/parser_test.go4
-rw-r--r--pkg/kconfig/config.go2
-rw-r--r--pkg/log/log.go8
-rw-r--r--pkg/tool/tool.go7
-rw-r--r--prog/hints.go29
-rw-r--r--sys/linux/init_alg.go6
-rw-r--r--tools/syz-bisect/bisect.go4
-rw-r--r--tools/syz-check/check.go1
-rw-r--r--tools/syz-cover/syz-cover.go1
-rw-r--r--tools/syz-crush/crush.go4
-rw-r--r--tools/syz-minconfig/minconfig.go7
-rw-r--r--tools/syz-trace2syz/proggen/proggen.go8
-rw-r--r--tools/syz-trace2syz/trace2syz.go2
-rw-r--r--tools/syz-tty/syz-tty.go4
-rw-r--r--vm/proxyapp/mocks/ProxyAppInterface.go6
-rw-r--r--vm/proxyapp/mocks/subProcessCmd.go21
-rw-r--r--vm/proxyapp/proxyappclient_test.go8
18 files changed, 93 insertions, 63 deletions
diff --git a/pkg/csource/csource.go b/pkg/csource/csource.go
index 8671a57db..d4972261b 100644
--- a/pkg/csource/csource.go
+++ b/pkg/csource/csource.go
@@ -4,23 +4,23 @@
// Package csource generates [almost] equivalent C programs from syzkaller programs.
//
// Outline of the process:
-// - inputs to the generation are the program and options
-// - options control multiple aspects of the resulting C program,
-// like if we want a multi-threaded program or a single-threaded,
-// what type of sandbox we want to use, if we want to setup net devices or not, etc
-// - we use actual executor sources as the base
-// - gen.go takes all executor/common*.h headers and bundles them into generated.go
-// - during generation we tear executor headers apart and take only the bits
-// we need for the current program/options, this is done by running C preprocessor
-// with particular set of defines so that the preprocessor removes unneeded
-// #ifdef SYZ_FOO sections
-// - then we generate actual syscall calls with the given arguments
-// based on the binary "encodingexec" representation of the program
-// (the same representation executor uses for interpretation)
-// - then we glue it all together
-// - as the last step we run some text post-processing on the resulting source code:
-// remove debug calls, replace exitf/fail with exit, hoist/sort/dedup includes,
-// remove duplicate empty lines, etc
+// - inputs to the generation are the program and options
+// - options control multiple aspects of the resulting C program,
+// like if we want a multi-threaded program or a single-threaded,
+// what type of sandbox we want to use, if we want to setup net devices or not, etc
+// - we use actual executor sources as the base
+// - gen.go takes all executor/common*.h headers and bundles them into generated.go
+// - during generation we tear executor headers apart and take only the bits
+// we need for the current program/options, this is done by running C preprocessor
+// with particular set of defines so that the preprocessor removes unneeded
+// #ifdef SYZ_FOO sections
+// - then we generate actual syscall calls with the given arguments
+// based on the binary "encodingexec" representation of the program
+// (the same representation executor uses for interpretation)
+// - then we glue it all together
+// - as the last step we run some text post-processing on the resulting source code:
+// remove debug calls, replace exitf/fail with exit, hoist/sort/dedup includes,
+// remove duplicate empty lines, etc
package csource
import (
diff --git a/pkg/email/parser_test.go b/pkg/email/parser_test.go
index edeb4a8de..b6eb58257 100644
--- a/pkg/email/parser_test.go
+++ b/pkg/email/parser_test.go
@@ -159,8 +159,8 @@ line1
#syz fix bar baz
line 2
`,
- cmd: CmdFix,
- str: "fix",
+ cmd: CmdFix,
+ str: "fix",
args: "bar baz",
},
{
diff --git a/pkg/kconfig/config.go b/pkg/kconfig/config.go
index a9c571b1d..4a917df28 100644
--- a/pkg/kconfig/config.go
+++ b/pkg/kconfig/config.go
@@ -36,7 +36,7 @@ const (
prefix = "CONFIG_"
)
-// Value returns config value, or No if it's not present at all.
+// Value returns config value, or No if it's not present at all.
func (cf *ConfigFile) Value(name string) string {
cfg := cf.Map[name]
if cfg == nil {
diff --git a/pkg/log/log.go b/pkg/log/log.go
index 92063f6de..935b0d1cd 100644
--- a/pkg/log/log.go
+++ b/pkg/log/log.go
@@ -2,10 +2,10 @@
// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
// Package log provides functionality similar to standard log package with some extensions:
-// - verbosity levels
-// - global verbosity setting that can be used by multiple packages
-// - ability to disable all output
-// - ability to cache recent output in memory
+// - verbosity levels
+// - global verbosity setting that can be used by multiple packages
+// - ability to disable all output
+// - ability to cache recent output in memory
package log
import (
diff --git a/pkg/tool/tool.go b/pkg/tool/tool.go
index 690bfa4b8..0221cb876 100644
--- a/pkg/tool/tool.go
+++ b/pkg/tool/tool.go
@@ -11,9 +11,10 @@ import (
)
// Init handles common tasks for command line tools:
-// - invokes flag.Parse
-// - adds support for optional flags (see OptionalFlags)
-// - adds support for cpu/mem profiling (-cpuprofile/memprofile flags)
+// - invokes flag.Parse
+// - adds support for optional flags (see OptionalFlags)
+// - adds support for cpu/mem profiling (-cpuprofile/memprofile flags)
+//
// Use as defer tool.Init()().
func Init() func() {
flagCPUProfile := flag.String("cpuprofile", "", "write CPU profile to this file")
diff --git a/prog/hints.go b/prog/hints.go
index 4821e03b8..9fa80547c 100644
--- a/prog/hints.go
+++ b/prog/hints.go
@@ -29,10 +29,11 @@ import (
// Example: for comparisons {(op1, op2), (op1, op3), (op1, op4), (op2, op1)}
// this map will store the following:
-// m = {
-// op1: {map[op2]: true, map[op3]: true, map[op4]: true},
-// op2: {map[op1]: true}
-// }.
+//
+// m = {
+// op1: {map[op2]: true, map[op3]: true, map[op4]: true},
+// op2: {map[op1]: true}
+// }.
type CompMap map[uint64]map[uint64]bool
const (
@@ -186,10 +187,12 @@ func checkCompressedArg(arg *DataArg, compMap CompMap, exec func()) {
// are casted to narrower (and wider) integer types.
//
// Motivation for shrink:
-// void f(u16 x) {
-// u8 y = (u8)x;
-// if (y == 0xab) {...}
-// }
+//
+// void f(u16 x) {
+// u8 y = (u8)x;
+// if (y == 0xab) {...}
+// }
+//
// If we call f(0x1234), then we'll see a comparison 0x34 vs 0xab and we'll
// be unable to match the argument 0x1234 with any of the comparison operands.
// Thus we shrink 0x1234 to 0x34 and try to match 0x34.
@@ -202,10 +205,12 @@ func checkCompressedArg(arg *DataArg, compMap CompMap, exec func()) {
// we check the sizes with leastSize().
//
// Motivation for expand:
-// void f(i8 x) {
-// i16 y = (i16)x;
-// if (y == -2) {...}
-// }
+//
+// void f(i8 x) {
+// i16 y = (i16)x;
+// if (y == -2) {...}
+// }
+//
// Suppose we call f(-1), then we'll see a comparison 0xffff vs 0xfffe and be
// unable to match input vs any operands. Thus we sign extend the input and
// check the extension.
diff --git a/sys/linux/init_alg.go b/sys/linux/init_alg.go
index d0f0c4528..66d2d9a91 100644
--- a/sys/linux/init_alg.go
+++ b/sys/linux/init_alg.go
@@ -123,8 +123,10 @@ var allTypes = []algType{
}
// Algorithms can be extracted with something along the following lines:
-// cat /proc/crypto | grep -B 8 ": skcipher" | grep -B 7 "internal : no" | egrep "name |driver " | \
-// cut -b 16- | sort | uniq | awk '{printf("{\"%s\", nil},\n", $1)}'
+//
+// cat /proc/crypto | grep -B 8 ": skcipher" | grep -B 7 "internal : no" | egrep "name |driver " | \
+// cut -b 16- | sort | uniq | awk '{printf("{\"%s\", nil},\n", $1)}'
+//
// Note: the kernel needs to include all crypto configs and CPU needs to support AVX/NEON/etc.
var allAlgs = map[int][]algDesc{
ALG_AEAD: {
diff --git a/tools/syz-bisect/bisect.go b/tools/syz-bisect/bisect.go
index ba4494d18..00c1afb6e 100644
--- a/tools/syz-bisect/bisect.go
+++ b/tools/syz-bisect/bisect.go
@@ -12,8 +12,8 @@
// -kernel_commit. HEAD is used if commits are not specified.
//
// The crash dir should contain the following files:
-// - repro.cprog or repro.prog: reproducer for the crash
-// - repro.opts: syzkaller reproducer options (e.g. {"procs":1,"sandbox":"none",...}) (optional)
+// - repro.cprog or repro.prog: reproducer for the crash
+// - repro.opts: syzkaller reproducer options (e.g. {"procs":1,"sandbox":"none",...}) (optional)
//
// The tool stores bisection result into cause.commit or fix.commit.
package main
diff --git a/tools/syz-check/check.go b/tools/syz-check/check.go
index 714c195cd..7f86c2d41 100644
--- a/tools/syz-check/check.go
+++ b/tools/syz-check/check.go
@@ -3,6 +3,7 @@
// syz-check does best-effort static correctness checking of the syscall descriptions in sys/os/*.txt.
// Use:
+//
// $ go install ./tools/syz-check
// $ syz-check -obj-amd64 /linux_amd64/vmlinux -obj-arm64 /linux_arm64/vmlinux \
// -obj-386 /linux_386/vmlinux -obj-arm /linux_arm/vmlinux
diff --git a/tools/syz-cover/syz-cover.go b/tools/syz-cover/syz-cover.go
index 1e14a73fa..e161eac07 100644
--- a/tools/syz-cover/syz-cover.go
+++ b/tools/syz-cover/syz-cover.go
@@ -12,6 +12,7 @@
// or from syz-execprog with -coverfile flag.
//
// Usage:
+//
// syz-cover [-os=OS -arch=ARCH -kernel_src=. -kernel_obj=.] rawcover.file*
package main
diff --git a/tools/syz-crush/crush.go b/tools/syz-crush/crush.go
index 8ed076fc8..0ee550e79 100644
--- a/tools/syz-crush/crush.go
+++ b/tools/syz-crush/crush.go
@@ -2,7 +2,9 @@
// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
// syz-crush replays crash log on multiple VMs. Usage:
-// syz-crush -config=config.file execution.log
+//
+// syz-crush -config=config.file execution.log
+//
// Intended for reproduction of particularly elusive crashes.
package main
diff --git a/tools/syz-minconfig/minconfig.go b/tools/syz-minconfig/minconfig.go
index a77a8f47f..450968cff 100644
--- a/tools/syz-minconfig/minconfig.go
+++ b/tools/syz-minconfig/minconfig.go
@@ -3,9 +3,10 @@
// syz-minconfig is a tool for manual checking of config minimization functionality in pkg/kconfig/minimize.go.
// Example use:
-// $ go run tools/syz-minconfig/minconfig.go -sourcedir /src/linux -configs CAIF_NETDEV,CAIF_USB \
-// -base dashboard/config/linux/upstream-kasan-base.config \
-// -full dashboard/config/linux/upstream-kasan.config \
+//
+// $ go run tools/syz-minconfig/minconfig.go -sourcedir /src/linux -configs CAIF_NETDEV,CAIF_USB \
+// -base dashboard/config/linux/upstream-kasan-base.config \
+// -full dashboard/config/linux/upstream-kasan.config \
package main
import (
diff --git a/tools/syz-trace2syz/proggen/proggen.go b/tools/syz-trace2syz/proggen/proggen.go
index 553274728..eefd47b51 100644
--- a/tools/syz-trace2syz/proggen/proggen.go
+++ b/tools/syz-trace2syz/proggen/proggen.go
@@ -245,9 +245,11 @@ func (ctx *context) genStruct(syzType *prog.StructType, dir prog.Dir, traceType
}
// recurseStructs handles cases where syzType corresponds to struct descriptions like
-// sockaddr_storage_in6 {
-// addr sockaddr_in6
-// } [size[SOCKADDR_STORAGE_SIZE], align_ptr]
+//
+// sockaddr_storage_in6 {
+// addr sockaddr_in6
+// } [size[SOCKADDR_STORAGE_SIZE], align_ptr]
+//
// which need to be recursively generated. It returns true if we needed to recurse
// along with the generated argument and false otherwise.
func (ctx *context) recurseStructs(syzType *prog.StructType, dir prog.Dir, traceType *parser.GroupType) (prog.Arg, bool) {
diff --git a/tools/syz-trace2syz/trace2syz.go b/tools/syz-trace2syz/trace2syz.go
index b30cc471c..318603129 100644
--- a/tools/syz-trace2syz/trace2syz.go
+++ b/tools/syz-trace2syz/trace2syz.go
@@ -7,8 +7,10 @@
// syz-trace2syz converts strace traces to syzkaller programs.
//
// Simple usage:
+//
// strace -o trace -a 1 -s 65500 -v -xx -f -Xraw ./a.out
// syz-trace2syz -file trace
+//
// Intended for seed selection or debugging
package main
diff --git a/tools/syz-tty/syz-tty.go b/tools/syz-tty/syz-tty.go
index 8d51dd8ef..01788259e 100644
--- a/tools/syz-tty/syz-tty.go
+++ b/tools/syz-tty/syz-tty.go
@@ -2,7 +2,9 @@
// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
// syz-tty is utility for testing of usb console reading code. Usage:
-// $ syz-tty /dev/ttyUSBx
+//
+// $ syz-tty /dev/ttyUSBx
+//
// This should dump device console output.
package main
diff --git a/vm/proxyapp/mocks/ProxyAppInterface.go b/vm/proxyapp/mocks/ProxyAppInterface.go
index 95a86a8da..81ac864d6 100644
--- a/vm/proxyapp/mocks/ProxyAppInterface.go
+++ b/vm/proxyapp/mocks/ProxyAppInterface.go
@@ -1,4 +1,4 @@
-// Code generated by mockery v2.12.3. DO NOT EDIT.
+// Code generated by mockery v2.20.2. DO NOT EDIT.
package mocks
@@ -152,13 +152,13 @@ func (_m *ProxyAppInterface) RunStop(in proxyrpc.RunStopParams, out *proxyrpc.Ru
return r0
}
-type NewProxyAppInterfaceT interface {
+type mockConstructorTestingTNewProxyAppInterface interface {
mock.TestingT
Cleanup(func())
}
// NewProxyAppInterface creates a new instance of ProxyAppInterface. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
-func NewProxyAppInterface(t NewProxyAppInterfaceT) *ProxyAppInterface {
+func NewProxyAppInterface(t mockConstructorTestingTNewProxyAppInterface) *ProxyAppInterface {
mock := &ProxyAppInterface{}
mock.Mock.Test(t)
diff --git a/vm/proxyapp/mocks/subProcessCmd.go b/vm/proxyapp/mocks/subProcessCmd.go
index e39e02329..94f37256f 100644
--- a/vm/proxyapp/mocks/subProcessCmd.go
+++ b/vm/proxyapp/mocks/subProcessCmd.go
@@ -1,4 +1,4 @@
-// Code generated by mockery v2.12.3. DO NOT EDIT.
+// Code generated by mockery v2.20.2. DO NOT EDIT.
package mocks
@@ -32,6 +32,10 @@ func (_m *SubProcessCmd) StderrPipe() (io.ReadCloser, error) {
ret := _m.Called()
var r0 io.ReadCloser
+ var r1 error
+ if rf, ok := ret.Get(0).(func() (io.ReadCloser, error)); ok {
+ return rf()
+ }
if rf, ok := ret.Get(0).(func() io.ReadCloser); ok {
r0 = rf()
} else {
@@ -40,7 +44,6 @@ func (_m *SubProcessCmd) StderrPipe() (io.ReadCloser, error) {
}
}
- var r1 error
if rf, ok := ret.Get(1).(func() error); ok {
r1 = rf()
} else {
@@ -55,6 +58,10 @@ func (_m *SubProcessCmd) StdinPipe() (io.WriteCloser, error) {
ret := _m.Called()
var r0 io.WriteCloser
+ var r1 error
+ if rf, ok := ret.Get(0).(func() (io.WriteCloser, error)); ok {
+ return rf()
+ }
if rf, ok := ret.Get(0).(func() io.WriteCloser); ok {
r0 = rf()
} else {
@@ -63,7 +70,6 @@ func (_m *SubProcessCmd) StdinPipe() (io.WriteCloser, error) {
}
}
- var r1 error
if rf, ok := ret.Get(1).(func() error); ok {
r1 = rf()
} else {
@@ -78,6 +84,10 @@ func (_m *SubProcessCmd) StdoutPipe() (io.ReadCloser, error) {
ret := _m.Called()
var r0 io.ReadCloser
+ var r1 error
+ if rf, ok := ret.Get(0).(func() (io.ReadCloser, error)); ok {
+ return rf()
+ }
if rf, ok := ret.Get(0).(func() io.ReadCloser); ok {
r0 = rf()
} else {
@@ -86,7 +96,6 @@ func (_m *SubProcessCmd) StdoutPipe() (io.ReadCloser, error) {
}
}
- var r1 error
if rf, ok := ret.Get(1).(func() error); ok {
r1 = rf()
} else {
@@ -110,13 +119,13 @@ func (_m *SubProcessCmd) Wait() error {
return r0
}
-type NewSubProcessCmdT interface {
+type mockConstructorTestingTNewSubProcessCmd interface {
mock.TestingT
Cleanup(func())
}
// NewSubProcessCmd creates a new instance of SubProcessCmd. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
-func NewSubProcessCmd(t NewSubProcessCmdT) *SubProcessCmd {
+func NewSubProcessCmd(t mockConstructorTestingTNewSubProcessCmd) *SubProcessCmd {
mock := &SubProcessCmd{}
mock.Mock.Test(t)
diff --git a/vm/proxyapp/proxyappclient_test.go b/vm/proxyapp/proxyappclient_test.go
index 458e3f43e..0f199c0c8 100644
--- a/vm/proxyapp/proxyappclient_test.go
+++ b/vm/proxyapp/proxyappclient_test.go
@@ -137,8 +137,9 @@ func TestCtor_FailedStartProxyApp(t *testing.T) {
}
// TODO: reuse proxyAppServerFixture() code: func could be called here once Mock.Unset() error
-// fixed https://github.com/stretchr/testify/issues/1236
-// nolint: dupl
+//
+// fixed https://github.com/stretchr/testify/issues/1236
+// nolint: dupl
func TestCtor_FailedConstructPool(t *testing.T) {
mProxyAppServer, stdin, stdout, stderr :=
makeMockProxyAppProcess(t)
@@ -197,7 +198,8 @@ func initProxyAppServerFixture(mProxyAppServer *mockProxyAppInterface) *mockProx
}
// TODO: to remove duplicate see TestCtor_FailedConstructPool() comment
-// nolint: dupl
+//
+// nolint: dupl
func proxyAppServerFixture(t *testing.T) (*mockProxyAppInterface, *mockCommandRunner, *proxyAppParams) {
mProxyAppServer, stdin, stdout, stderr :=
makeMockProxyAppProcess(t)