Commit Graph

52 Commits

Author SHA1 Message Date
Dmitry Vyukov
73964a9b3a pkg/instance: extend debug output on syzkaller make error
For debugging of:
https://groups.google.com/forum/#!topic/syzkaller-bugs/2lgvlHd8t1c
2020-05-25 12:53:19 +02:00
Dmitry Vyukov
3d789641a3 pkg/report: add Report.SkipPos
SkipPos is what pkg/instance needs,
but also will be needed for ParseAll.
2020-05-13 20:37:26 +02:00
Jouni Hogander
bc0712ac2b pkg/instance: Use syz or c source file when testing
Currenlty only syz file is taken into account when testing.
Use also c source file if available. Still use syz as a "main"
reproducer.
2020-04-29 11:20:26 +02:00
Marco Vanotti
607350e438 syz/targets: add SyzExecutorCmd flag
This commit adds a new attribute to syzkaller targets that tells
syzkaller how to invoke the syz-executor command.

Some systems, like Fuchsia, are now building syz-executor as part of the
build, and there is no need to copy it over, or to run it from `/tmp`.
In fact, that might stop working at some time in the future in Fuchsia.

All places that used to copy syz-executor into the target machine will
now check for the SyzExecutorCmd flag, and won't copy it if the flag is
set.
2019-12-09 15:13:49 -08:00
Dmitry Vyukov
b5c36524a2 sys/targets: add HostFuzzer flag
Move HostFuzzer from vm/qemu.
It's needed in a number of other packages
and strictly saying is not specific to qemu
(it just happened that both fuchsia and akaros only support qemu).
2019-11-16 09:58:54 +01:00
Dmitry Vyukov
30cb7f98cd pkg/bisect: detect wrong bisections
Detect bisection to merge commits and to commits that don't affect
kernel binary (comments, other arches, whitespaces, etc).
Such bisections are not reported in emails (but shown on web).

Update #1271
2019-11-07 11:07:03 +01:00
Dmitry Vyukov
424cf6e8a1 pkg/build: add build signatures
Add optional build signature for images, currently only implemented for linux.
This can be used in bisection process to detect changes that does not affect kernel.

Update #1271
2019-11-06 11:41:05 +01:00
Dmitry Vyukov
c487cd4633 pkg/build: refactor Image function arguments
Image takes too many arguments, so we need to do lots of forwarding,
adding new argumnets is painful and most OSes are not interested
in lots of arguments.
Combine all arguments into a params struct.
2019-11-06 11:41:05 +01:00
Zubin Mithra
a2bdbd8c37 pkg/bisect: add initial testing support for cause bisection
(note: incomplete change)

Refactor existing code as follows:
* Move reusable test utility functions from git_repo_test.go to
pkg/vcs/test_util.go and make them exported.
* Split Run() into Run()+runImpl().
* Change type of bisect.go:env.inst to `instance.BuilderTester`.
Change usage inside syz-testbuild/testbuild.go accordingly.
* Move most of linux.PreviousReleaseTags() into vcs/git.go as
git.previousReleaseTags().
* Allow build.CompilerIdentity to be mocked.

Introduce the following changes:
* instance.BuilderTester is an interface with methods
	BuildSyzkaller()
	BuildKernel()
	Test()
NewEnv() now returns this interface.
* type testEnv implements instance.BuilderTester.
* type testBuilder implements builder interface. Add a entry into table
inside pkg/build/build.go:getBuilder() to return testBuilder object.
2019-10-22 10:09:57 +02:00
Matthew Dempsky
fd37b39ea8 all: convert Fuchsia to use "host fuzzing" mode
Go support is not a priority for Fuchsia at the moment, so it's
preferable to use host fuzzing mode for Fuchsia like currently done
for Akaros.

This commit basically looks for all the places where there was special
logic for OS=="akaros" and extends the same logic for OS=="fuchsia".
2019-08-27 14:39:18 -07:00
Dmitry Vyukov
a963689197 pkg/log: rename -v to -vv
To avoid conflicts with programs that import both syzkaller packages
and github.com/golang/glog which also defines -v flag.
2019-07-16 11:18:12 +02:00
Dmitry Vyukov
4d4a4420e7 pkg/report: add Type/Frame to Report
In several places we do special handling for some crash types.
Currently we compare report title with magic strings,
which is error-prone. Add explicit Type to reports.
2019-05-20 19:40:20 +02:00
Dmitry Vyukov
5a4461b07f pkg/instance: fix types in OverrideVMCount
vmConfig value is interface{}, not string.
So compare with nil and assign int.
2019-05-18 08:41:48 +02:00
Greg Steuck
ddba9a616e
pkg/instance: break the line to appease linter (#1173)
* pkg/instance: break the line to appease linter

* fix up format
2019-05-12 23:38:17 -07:00
Dmitry Vyukov
39449875b6 syz-ci: don't assume kernel config is called .config
.config is linux-ism. We have a convention that kernel config
is copied to kernel.config file. Use it.
2019-05-12 11:38:18 +02:00
Dmitry Vyukov
8f24b7d63e syz-ci: always use 10 VMs for bisection
If a manager has less then 10 VMs override it to 10 for bisection.
If a manager has only 1 VM, bisection won't end well.
2019-05-10 11:06:17 +02:00
Dmitry Vyukov
742f448304 vm/gce: allow non-preemptible VMs
We are seeing some flakes during bisection and image testing.
Hard to tell what's the root cause because they are episodic.
But using non-preemptible VMs for bisection and image testing
looks good on all fronts.

Update #501
2019-03-28 13:22:37 +01:00
Dmitry Vyukov
e6d1a816d8 pkg/csource: allow to ignore warnings during build
Running bisection using an older repro failed with:

    <stdin>: In function ‘syz_mount_image.constprop’:
    <stdin>:298:3: error: argument 1 null where non-null expected [-Werror=nonnull]
    In file included from <stdin>:26:0:
    /usr/include/x86_64-linux-gnu/sys/stat.h:320:12: note: in a call to function ‘mkdir’ declared here
     extern int mkdir (const char *__path, __mode_t __mode)

Let's be safe and ignore warnings during repro/bisect.
Everything that runs during tests still has all warnings.

Update #501
2019-03-21 13:30:12 +01:00
Dmitry Vyukov
dc89691385 pkg/instance: fix boot error detection
Currently we truncate output up to rep.EndPos after unexpected reboot.
But report sets EndPos to the _last_ report in output,
so if there are any other errors they are all skipped after
truncation to EndPos. Truncate just one line instead.
2019-03-17 18:06:44 +01:00
Dmitry Vyukov
699923ce73 pkg/instance: clean up temp file 2019-03-17 18:06:44 +01:00
Dmitry Vyukov
c693e273b3 pkg/instance: use -fpermissive -w when building old syzkaller
Since we can be building very old revisions for bisection here,
make the build as permissive as possible.
Newer compilers tend to produce more warnings also kernel headers may be broken, e.g.:
ebtables.h:197:19: error: invalid conversion from ‘void*’ to ‘ebt_entry_target*’

Update #501
2019-03-17 18:06:44 +01:00
Ed Maste
f2468c12ea pkg/instance: use gmake on FreeBSD as on OpenBSD 2019-02-26 17:25:22 +01:00
Dmitry Vyukov
0a49c954ff pkg/instance: test coverage during instance testing
Currently we always pass cover=false during instance testing
and as the result covereage is not tested. This can result in
broken images. Pass the actual value of coverage for testing.
2019-02-13 15:58:42 +01:00
Dmitry Vyukov
88f5934633 vm: allow fine-grained control over program exit conditions
Currently we only support canExit flag.
However there are actually 3 separate conditions:
 - program can exit normally
 - program can timeout (e.g. fuzzer test or runtest can't)
 - program can exit with error (e.g. C test can)
Allow to specify these 3 conditions separately.
2018-12-24 09:59:56 +01:00
Dmitry Vyukov
1749e412ca pkg/instance: make kernel reboot detection portable
The current code is linux specific, generalize it to other OSes.
2018-12-16 16:48:05 +01:00
Dmitry Vyukov
19e9088bb7 syz-ci: use gmake instead of make on openbsd
Update #712
2018-09-13 12:13:54 +02:00
Dmitry Vyukov
4ae17b1f4c pkg/instance: support injected boot for vmm
If pkg/build produces a kernel, inject it into vmm config too.
This will allow continuous build with vmm VM type.

Update #712
2018-09-11 16:10:50 +02:00
Dmitry Vyukov
a54c2b7b92 syz-ci: de-hardcode list of VMs that support overcommit
We currently have this list in multiple places (somewhat diverged).
Specify this "overcommit" property in VM implementations.
In particular, we also want to allow overcommit for "vmm" type.

Update #712
2018-09-11 15:33:45 +02:00
Dmitry Vyukov
6c7e9d3daa pkg/instance: fix gometalinter warnings 2018-08-29 17:54:51 -07:00
Dmitry Vyukov
a1b245b4dd pkg/instance: fix job testing
New FuzzerCmd generates flags that can't be parsed by an old fuzzer.
Fix that and add a test.
2018-08-29 17:45:13 -07:00
Dmitry Vyukov
2763e04c22 tools/syz-runtest: add tool for program unit testing
The tool is run as:

$ syz-runtest -config manager.config

This runs all programs from sys/*/test/* in different modes
on actual VMs and checks results.

Fixes #603
2018-08-03 21:08:02 +02:00
Dmitry Vyukov
fbedd425b5 pkg/mgrconfig: move from syz-manager/mgrconfig
mgrconfig was used only by syz-manager initially,
but now it's used by a dozen of packages and it's
weird to import from under a binary dir.
pkg/ is much more reasonable dir for a widely used
helper package.
2018-08-02 16:57:32 +02:00
Dmitry Vyukov
04bd6c3d9e pkg/instance: pass -os to execprog/fuzzer only for akaros
Only akaros needs OS, because the rest assume host OS.
But speciying OS for all OSes breaks patch testing on syzbot
because old execprog does not have os flag.
2018-07-06 14:43:24 +02:00
Dmitry Vyukov
7e2e7aa3e4 pkg/instance: pass os flag to execprog/fuzzer 2018-07-05 13:09:40 +02:00
Dmitry Vyukov
c45c8c2a07 pkg/instance: fix Accept error check 2018-06-29 12:58:02 +02:00
Dmitry Vyukov
68ce63c468 pkg/build: support fuchsia builds 2018-06-28 13:42:07 +02:00
Dmitry Vyukov
58e8587f64 pkg/vcs: pave way for multi-vcs support
Wrap current git interface in abstract interface.
Provide constructor that create repo interface for the given os/vm.
2018-06-27 13:57:21 +02:00
Dmitry Vyukov
43da5e3a1b pkg/vcs: move from pkg/git
Rename pkg/git to pkg/vcs because we need to support not only git.
2018-06-27 13:07:03 +02:00
Dmitry Vyukov
b0294c53d0 syz-fuzzer: partially revert "syz-fuzzer: fix gvisor testing"
This breaks patch testing on syz-ci as it can use older version of syz-fuzzer.
2018-06-26 16:42:22 +02:00
Dmitry Vyukov
089f11817e syz-fuzzer: fix gvisor testing
Testing code wasn't ready to dial stdin.
Make it use the same logic rpc package uses
to connecto to host.
2018-06-26 14:12:43 +02:00
Dmitry Vyukov
802897bc33 pkg/instance: say that gvisor can create instances out of thin air 2018-06-23 10:12:35 +02:00
Dmitry Vyukov
ea804a7120 pkg/build: pave way for multi-OS support
Unify kernel and image build, that distinction is really uninteresting.
Define interface that each OS needs to implement.
Add gvisor stub.
2018-06-22 16:40:45 +02:00
Dmitry Vyukov
94ef62054c pkg/build: move from pkg/kernel
Rename pkg/kernel to pkg/build and prepare for multi-OS support.
2018-06-22 16:40:45 +02:00
Dmitry Vyukov
2a075d57ab pkg/report: allow to specify suppressions per OS
Currently all (linux-specific) suppressions are hardcoded in mgrconfig.
This is very wrong. Move them to pkg/report and allow to specify per OS.
Add gvisor-specific suppressions.
This required a bit of refactoring. Introduce mgrconfig.KernelObj finally.
Make report.NewReporter and vm.Create accept mgrconfig directly
instead of passing it as multiple scattered args.
Remove tools/syz-parse and it always did the same as tools/syz-symbolize.
Simplify global vars in syz-manager/cover.go.
Create reporter eagerly in manager. Use sort.Slice more.
Overall -90 lines removed.
2018-06-22 16:40:45 +02:00
Dmitry Vyukov
9a7d0a5412 pkg/report: pass vm type to NewReporter
For the case when VM type affects output.
Will be needed for gvisor. It is kinda linux, but kinda not.
2018-06-22 16:40:45 +02:00
Dmitry Vyukov
87bfb99cfe vm: pass instance to MonitorExecution
It may need it later to try to obtain additional
diagnostic from hanged instances.
2018-06-22 16:40:45 +02:00
Dmitry Vyukov
62d1af2467 pkg/instance: more robust instance testing
Strictly saying, we may not get the connection when
the fuzzer process exits. The accepting goroutine
may have not been scheduled yet.
For the connection for up to 10 seconds.
2018-06-11 16:47:12 +02:00
Dmitry Vyukov
606f9a96d8 pkg/csource: allow to build source fom memory
In most cases we have source in memory,
so provide a function to build right from memory
without creating temp files.
2018-06-06 10:30:54 +02:00
Dmitry Vyukov
be47ebb0eb pkg/kernel: allow to split full make output
Currently kernel build failures are insanely verbose
(contain full kernel build output) and there is no
way to separate short descriptions from full output.
Make it possible.
Also try to extract failure root cause froom build log.
Use this in pkg/bisect to not pollute log on build failures.

Update #501
2018-05-17 17:18:24 +02:00
Dmitry Vyukov
6595937c34 tools/create-gce-image.sh: support both nbd and loop
Pass target OS/arch and VM type to kernel.CreateImage.
Use nbd for gce and loop for qemu VM type.
2018-05-17 14:50:18 +02:00