4921 Commits

Author SHA1 Message Date
Mark Johnston
f2e4c4ea82 sys/freebsd: add posix_fadvise(2) and posix_fallocate(2) 2020-03-27 05:51:58 +01:00
Mark Johnston
0645e7c7e9 sys/freebsd: add missing open(2) flags 2020-03-27 05:51:58 +01:00
Mark Johnston
20d6478ce7 sys/freebsd: use symbolic names for faccessat(2) flags 2020-03-27 05:51:58 +01:00
Mark Johnston
7a683c4c28 sys/freebsd: add chflags(2) and related syscalls 2020-03-27 05:51:58 +01:00
Mark Johnston
892d1075a4 sys/freebsd: add lchmod(2) 2020-03-27 05:51:58 +01:00
Mark Johnston
7c5dc2298f sys/freebsd: add copy_file_range(2) 2020-03-27 05:51:58 +01:00
Mark Johnston
31f17aa979 sys/freebsd: add minherit(2) 2020-03-27 05:51:58 +01:00
Mark Johnston
edada2ecad sys/freebsd: add FreeBSD-specific madvise(2) flags 2020-03-27 05:51:58 +01:00
Mark Johnston
0b37813464 sys/freebsd: fix mode for socket_inet_sctp.txt 2020-03-27 05:51:58 +01:00
Andrey Konovalov
6d25c5a09d
Update syzbot.md 2020-03-26 12:34:19 +01:00
Andrey Konovalov
e8e6c7d21d
Update syzbot.md 2020-03-25 13:20:15 +01:00
Anton Lindqvist
41f049cc40 docs/openbsd: update found bugs.md 2020-03-24 18:19:57 +01:00
Dmitry Vyukov
68660b21c2 tools/syz-trace2syz/proggen: fix test for new descriptions 2020-03-24 09:17:26 +01:00
Dmitry Vyukov
9fa8161a2c dashboard/config: set hung_task_all_cpu_backtrace=1
See https://lkml.org/lkml/2020/3/23/973
We still want the backtraces.
2020-03-24 08:46:17 +01:00
Dmitry Vyukov
2ab437bb1e prog: improve TestDeserializeHelper
1. Allow to not provide Out if it's the same as In.
2. Always check Out.
2020-03-24 08:43:00 +01:00
Dmitry Vyukov
ef871b2e4f sys/linux: don't use syz_open_dev when openat is enough 2020-03-24 08:43:00 +01:00
Dmitry Vyukov
8cf47975a6 pkg/compiler: truncate const values to their physical size
We do similar truncation for values in the prog package (truncateToBitSize).
Truncating them in the generated descriptions makes it possible
to directly compare values (otherwise -1 and truncated -1 don't match).
2020-03-24 08:43:00 +01:00
Dmitry Vyukov
2a504af1a3 prog: add test for truncateToBitSize 2020-03-24 08:42:59 +01:00
Dmitry Vyukov
f211a294e5 prog: don't use spaces in hints test names
Spaces are replaced with _ in testing output.
The first thing you do on failure is search for the test name.
No match. Figure out spaces were replaced. Replace each _ in the name with space.
Counterproductive.
2020-03-24 08:42:59 +01:00
Dmitry Vyukov
624509aadb prog: add helper to hints tests
Add a help to create uint64 sets with less code.
2020-03-24 08:42:59 +01:00
Andrey Konovalov
33e14df3b1
Update external_fuzzing_usb.md 2020-03-23 17:25:56 +01:00
Andrey Konovalov
84f999d631
Update external_fuzzing_usb.md 2020-03-23 16:24:52 +01:00
Dmitry Vyukov
78267cec1a vm: better handle VM diagnosis output
1. Always append diagnosis output at the end.
Don't intermix it with kernel output. It's confusing and not useful.

2. Don't include diagnosis output into Report.
It's too verbose and is not the crash. Keep it only in the Output.
2020-03-21 16:30:35 +01:00
Dmitry Vyukov
d60b9c6b0e vm/vmimpl: refactor DiagnoseFree/OpenBSD
Make signatures of these functions match vm.Diagnose.
Both more flexible, less code, more reasonable.
2020-03-21 16:08:02 +01:00
Dmitry Vyukov
a2d5b1c04d pkg/report: handle cases when whole stack is questionable
If the report is identified as corrupted because there are no frames at all,
try to re-extract using questionable frames.
This is a bit risky and may produce lots of one-off corrupted reports
at random locations. But we won't know until we deploy this...

Fixes #1216
2020-03-21 14:43:26 +01:00
Kamil Rytarowski
329c2fa6c4 netbsd/found_bugs.md: Reset to the redirection to syzbot
This list is not maintained.
2020-03-21 12:27:14 +01:00
Kamil Rytarowski
f4ae90369c netbsd: Improve README.md
Based on feedback from Maxime Villard.
2020-03-21 12:23:34 +01:00
Andrey Konovalov
4288d95ef6 pkg/report: improve report titles 2020-03-21 08:13:09 +01:00
Marco Vanotti
aa6c6a5572 sys/fuchsia: Add cprng and vmo tests.
This commit adds two new tests for fuchsia. One tests a basic syscall
(zx_cprng_draw), and the other does multiple tests over a vmo.
2020-03-21 07:02:15 +01:00
Andrey Konovalov
2c31c529a9 pkg/report: improve report titles 2020-03-18 17:41:34 +01:00
Dmitry Vyukov
0a96a13cb9 tools/syz-check: extend usage docs
Allow to run for only 1 arch and extend docs.
2020-03-18 09:23:24 +01:00
Dmitry Vyukov
97bc55cead pkg/compiler: check that flags values fit into base type
flags[foo, int8]
foo = 0x12345678

is always an error, detect these cases.
Found some bugs in mptcp, packet sockets, kvm.
2020-03-17 21:19:13 +01:00
Dmitry Vyukov
61e9cc09af pkg/compiler: preserve literal int const names
Useful for error reporting.
2020-03-17 21:19:13 +01:00
Dmitry Vyukov
fc752a617f pkg/compiler: reduce clutter in test output
Don't prefix each error with test file:line (which is pointless in this case).
2020-03-17 21:19:13 +01:00
Dmitry Vyukov
2e9037c55f pkg/compiler: check that const values fit into base type
const[0x12345678, int8] is always an error, detect these cases.
Found some bugs in mptcp, socket proto and fuchsia fidl descriptions.
2020-03-17 21:19:13 +01:00
Dmitry Vyukov
0bcbb36f9f pkg/compiler: unshare error handler
eh is shared across several tests and uses wrong t.
Unshare it.
2020-03-17 21:19:13 +01:00
Dmitry Vyukov
80d43738f1 prog: rename target.SanitizeCall to Neutralize
We will need a wrapper for target.SanitizeCall that will do more
than just calling the target-provided function. To avoid confusion
and potential mistakes, give the target function and prog function
different names. Prog package will continue to call this "sanitize",
which will include target's "neutralize" + more.
Also refactor API a bit: we need a helper function that sanitizes
the whole program because that's needed most of the time.

Fixes #477
Fixes #502
2020-03-17 21:19:13 +01:00
Dmitry Vyukov
a2f9a44649 prog: export deserialization test helper for sys/{linux,openbsd}
sys/{linux,openbsd} duplicate deserialization test logic as well.
Export and reuse the existing helper function.
2020-03-17 21:19:13 +01:00
Dmitry Vyukov
0a4d69469b prog: factor out common code in tests
Factor out a common test helper for tests that deserialize and check programs.
2020-03-17 21:19:13 +01:00
Dmitry Vyukov
1ea952c9ff pkg/compiler: calculate more precise sizes for arguments
If we have:

ioctl(fd fd, cmd int32)
ioctl$FOO(fd fd, cmd const[FOO])

Currently we assume that cmd size in ioctl$FOO is sizeof(void*).
However, we know that in ioctl it's specified as int32,
so we can infer that the actual syscall size is 4.

This massively reduces sizes of socket/setsockopt/getsockopt/ioctl
and some other syscalls, which is good because we now use physical
size in mutation/hints and some other places.

This will also enable not morphing ioctl's into other ioctl's.

Update #477
Update #502
2020-03-17 21:19:13 +01:00
Dmitry Vyukov
8bec3911ad pkg/compiler: add tests for generation phase
Add errors3.txt with tests for errors that are produced during generation phase.
Refactor tests to reduce duplication.
Tidy struct/union size errors: better locations and make testable.
2020-03-17 21:19:13 +01:00
Dmitry Vyukov
924f760604 pkg/compiler: ensure consistency of syscall argument types
Ensure that we don't have conflicting sizes for the same argument
of the same syscall, e.g.:

foo$1(a int16)
foo$2(a int32)

This is useful for several reasons:
 - we will be able avoid morphing syscalls into other syscalls
 - we will be able to figure out more precise sizes for args
   (lots of them are implicitly intptr, which is the largest
   type on most important arches)
 - found few bugs in linux descriptions

Update #477
Update #502
2020-03-17 21:19:13 +01:00
Dmitry Vyukov
5de34a784c pkg/compiler: don't specify syscall consts for test OS
This is just tedious. Fabricate them on the fly.
2020-03-17 21:19:13 +01:00
Dmitry Vyukov
acf69c5ed9 pkg/compiler: handle errors in test
Currnetly we don't have any errors in this test,
but if we get some, it crashes with nil deref.
2020-03-17 21:19:13 +01:00
Dmitry Vyukov
3e872ba1c4 pkg/compiler: emit warnings after generate stage
Description generation can also produce errors.
We don't want to emit warnings if there are any errors.
Move warnings emission to the very end of compilation.
2020-03-17 21:19:13 +01:00
Dmitry Vyukov
749688d22a executor: fix format warning 2020-03-13 19:49:29 +01:00
Dmitry Vyukov
bddb05c5eb executor: fix data race
ThreadSanitizer says:

WARNING: ThreadSanitizer: data race (pid=3)
  Atomic read of size 4 at 0x56360e562f08 by main thread:
    #0 __tsan_atomic32_load <null> (libtsan.so.0+0x64249)
    #1 event_isset executor/common_linux.h:51 (syz-executor.0+0x2cf1f)
    #2 handle_completion executor/executor.cc:886 (syz-executor.0+0x2cf1f)
    #3 execute_one executor/executor.cc:732 (syz-executor.0+0x2da3b)
    #4 loop executor/common.h:581 (syz-executor.0+0x2f1aa)
    #5 do_sandbox_none executor/common_linux.h:2694 (syz-executor.0+0x189d6)
    #6 main executor/executor.cc:407 (syz-executor.0+0x189d6)

  Previous write of size 4 at 0x56360e562f08 by thread T1:
    #0 event_reset executor/common_linux.h:32 (syz-executor.0+0x1f5af)
    #1 worker_thread executor/executor.cc:1048 (syz-executor.0+0x1f5af)
    #2 <null> <null> (libtsan.so.0+0x2b0b6)

  Location is global 'threads' of size 2560 at 0x56360e562f00 (syz-executor.0+0x00000008bf08)

  Thread T1 (tid=6, running) created by main thread at:
    #0 pthread_create <null> (libtsan.so.0+0x2d55b)
    #1 thread_start executor/common.h:256 (syz-executor.0+0x2d707)
    #2 thread_create executor/executor.cc:1037 (syz-executor.0+0x2d707)
    #3 schedule_call executor/executor.cc:811 (syz-executor.0+0x2d707)
    #4 execute_one executor/executor.cc:719 (syz-executor.0+0x2d707)
    #5 loop executor/common.h:581 (syz-executor.0+0x2f1aa)
    #6 do_sandbox_none executor/common_linux.h:2694 (syz-executor.0+0x189d6)
    #7 main executor/executor.cc:407 (syz-executor.0+0x189d6)
2020-03-13 13:16:53 +01:00
Dmitry Vyukov
008f58d77e executor: add more debugging output for running=-1
The running=-1 check fires periodically for the past 2 years.
I can't reproduce nor understand how this happens.
Add more debugging output, maybe it will shed some light.

Update #502
2020-03-13 13:16:53 +01:00
Dmitry Vyukov
9b1f3e6653 prog: control program length
We have _some_ limits on program length, but they are really soft.
When we ask to generate a program with 10 calls, sometimes we get
100-150 calls. There are also no checks when we accept external
programs from corpus/hub. Issue #1630 contains an example where
this crashes VM (executor limit on number of 1000 resources is
violated). Larger programs also harm the process overall (slower,
consume more memory, lead to monster reproducers, etc).

Add a set of measure for hard control over program length.
Ensure that generated/mutated programs are not too long;
drop too long programs coming from corpus/hub in manager;
drop too long programs in hub.
As a bonus ensure that mutation don't produce programs with
0 calls (which is currently possible and happens).

Fixes #1630
2020-03-13 13:16:53 +01:00
Dmitry Vyukov
05359321bb all: fix new golangci-lint warnings
Newer version started producing more warnings. Fix them.
2020-03-13 08:26:02 +01:00