3333 Commits

Author SHA1 Message Date
Andrey Konovalov
2cd76d2137 kcov: some fixes for extra coverage
Use PC tracing mode when detecting KCOV_REMOTE_ENABLE support in the kernel.

Also fix kcov_remote_handle_usb argument.
2019-01-17 16:06:59 +01:00
Shankara Pailoor
769e75ed8e tools/syz-trace2syz/proggen: add support to generate structs like sockaddr_storage_in6
trace2syz has trouble generating structs like sockaddr_storage_in6 which are
wrappers around other structs like sockaddr_in6 because strace just decodes the
wrapped struct (sockaddr_in6). This causes trace2syz to generate the addr field
of sockaddr_storage_in6 from the af_family field of sockaddr_in6 which triggers
an error. We now try and detect these cases and recursively generate the struct.
2019-01-17 13:44:43 +01:00
houjingyi
8f0337c5fc docs/syscall_descriptions_syntax.md: update syntax about union
* Update syscall_descriptions_syntax.md

* Update syscall_descriptions_syntax.md

* Update syscall_descriptions_syntax.md
2019-01-17 11:18:21 +01:00
Dmitry Vyukov
43689bcfed executor: remove unused kvm_asm64_vm86
-Wunused-const-variable shows it.
No idea now if it should be used or not,
seems to be the same as kvm_asm32_paged_vm86.
So let's just remove it.
2019-01-17 10:52:20 +01:00
Anton Lindqvist
04aed72692 Revert "sys/openbsd: avoid /dev/fd node creation"
This reverts commit 77c702cf1a02ef4bb695e9daa9339afb3cbd5d89.

A proper fix has instead been committed to OpenBSD[1].

[1] 650b9bc3ab
2019-01-17 10:41:04 +01:00
Andrey Konovalov
c2faf9b2d5 all: detect extra coverage support
Based on whether the kernel supports KCOV_REMOTE_ENABLE ioctl.
2019-01-16 19:19:53 +01:00
Andrey Konovalov
b5df78dc5d all: support extra coverage
Right now syzkaller only supports coverage collected from the threads that
execute syscalls. However some useful things happen in background threads,
and it would be nice to collect coverage from those threads as well.

This change adds extra coverage support to syzkaller. This coverage is not
associated with a particular syscall, but rather with the whole program.
Executor passes extra coverage over the same ipc mechanism to syz-fuzzer
with syscall number set to -1. syz-fuzzer then passes this coverage to
syz-manager with the call name "extra".

This change requires the following kcov patch:
https://github.com/xairy/linux/pull/2
2019-01-16 19:19:53 +01:00
msvoelker
c0d4a12ee7 sys/freebsd: add SCTP syscalls
* sys/freebsd: Add SCTP syscalls

* sys/freebsd: SCTP syscalls updated

* sys/freebsd: SCTP syscalls fixed
2019-01-16 18:12:07 +01:00
Shankara Pailoor
505b1767d0 tools/syz-trace2syz/proggen: add support for open, openat, syz_open_dev variants
Add support to accurately select variants for open and openat system calls.
This is needed because in order to accurately select ioctl variants we need
to use device resource types. The device resource types can only be created
by syz_open_dev and openat variants.
2019-01-16 16:34:17 +01:00
Dmitry Vyukov
d538790b53 pkg/mgrconfig: do not serialize optional fields
Since we now show manager config on web page, make it leaner.
2019-01-16 14:49:47 +01:00
Dmitry Vyukov
025b20b5cb syz-manager: fix up commit link 2019-01-16 14:48:49 +01:00
Joey Jiao
d5d60d1061 syz-manager: add repo version and config link on stats page 2019-01-16 14:38:28 +01:00
Dmitry Vyukov
352bac0db5
Update found_bugs.md 2019-01-16 10:52:18 +01:00
Dmitry Vyukov
b47fa78d18 pkg/report: more tuning for trusty reports
Update #933
2019-01-15 18:02:24 +01:00
Andrew Donnellan
4cdc0f5f6b vm/qemu: Disable VGA on ppc64le
Disable qemu VGA output on ppc64le. The current pseries console code in
the kernel has a bunch of bugs, and if you don't disable VGA syzkaller
won't see console output.

Signed-off-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
2019-01-15 16:45:20 +01:00
Andrew Donnellan
c7d8a8c07b vm/qemu: Enable KVM on ppc64le
ppc64le supports KVM, let's use it.

This obviously won't work on an x86 host, but at present there are issues
using syzkaller on ppc64le with qemu in TCG mode anyway.

Signed-off-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
2019-01-15 16:45:20 +01:00
Andrew Donnellan
f4013aa972 pkg/host: Support extracting kallsyms on ppc64le
Add a regex for syscall symbol extraction on ppc64le. ppc64le doesn't have
any special arch prefix.

Signed-off-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
2019-01-15 16:45:20 +01:00
Dmitry Vyukov
0fbab0d71a
Update found_bugs.md 2019-01-15 15:14:13 +01:00
Dmitry Vyukov
79cb1a7cf8
Update executing_syzkaller_programs.md
-cover=0 is the default now
-procs=16 looks too high, syzbot uses 6-8 so let's suggest 8
2019-01-15 14:53:53 +01:00
Dmitry Vyukov
ebacf5cb4d Makefile: fix double $(GO) $(GO) 2019-01-14 18:24:22 +01:00
Dmitry Vyukov
e9b3467100 sys/linux: add trusty support
Add support for trusty tipc devices and several trusty app ports.

Update #933
2019-01-14 18:23:43 +01:00
Zubin Mithra
b38a805a0c sys/linux: Add syscalls to read from sockets for crypto operations
sockaddr_alg with salg_type as "skcipher", "aead", "hash" and "rng"
support for reading from these sockets. Add read descriptions to
socket_alg.txt.
2019-01-14 18:21:55 +01:00
Dmitry Vyukov
2a23bd7754 docs/trusty: add instructions on building trusty
Update #933
2019-01-14 17:51:50 +01:00
Shankara Pailoor
31648909f9 tools/syz-trace2syz/proggen: deleting unnecessary code in genSockaddrStorage()
genSockaddrStorage() determines the correct sockaddr_storage union option when we
cannot identify the system call variant. We used to have custom logic per system
call which was not tested and is actually unnecessary. This patch deletes that
code and adds a test to make sure there are no regressions.
2019-01-14 17:47:18 +01:00
Dmitry Vyukov
f034b65dea pkg/report: add parsing of trusty crashes
Update #933
2019-01-14 17:41:04 +01:00
Dmitry Vyukov
744a007c19 pkg/report: strip trailing deadlock reports for real
Oops messages frequently induce possible deadlock reports
because oops reporting introduces unexpected locking chains.
So if we have enough of the actual oops, strip the deadlock message.
2019-01-14 17:24:39 +01:00
Dmitry Vyukov
3085f2752e pkg/report: strip trailing deadlock reports
Oops messages frequently induce possible deadlock reports
because oops reporting introduces unexpected locking chains.
So if we have enough of the actual oops, strip the deadlock message.
2019-01-14 16:47:11 +01:00
Kamil Rytarowski
ecb717ca89 executor: adapt switching to user nobody to be more portable on BSDs
NetBSD uses different uid/gid than FreeBSD/OpenBSD for the user
nobody. Instead of hardcoding the values, retrieve it from the
password entry database.

While there, switch to setuid(2) and setgid(2) calls as they are
good enough and portable. setresgid(2) and setresuid(2) aren't
available on NetBSD.
2019-01-14 09:53:58 +01:00
Kamil Rytarowski
95485883f6 executor: do not call setrlimit(2) for RLIMIT_AS for NetBSD
Setting the limit caused abnormal failure during early init on NetBSD.
2019-01-14 09:52:03 +01:00
Siddharth M
7ffdc16788 docs/netbsd.md: updated documentation for NetBSD
Refactored the document and updated the changes.
2019-01-14 09:51:10 +01:00
Michael Tuexen
9eb9389ab9 executor: update KCOV support for FreeBSD
KCOV support has been added to FreeBSD in r342962. Use
the header file and update the code to latest changes
introduced in the review process.
2019-01-14 09:50:07 +01:00
Michael Tuexen
95f1d718cf tools/kcovtrace: add FreeBSD support
KCOV support has been committed to FreeBSD in r342962. Therefore,
allow this program to be run on FreeBSD.
2019-01-14 09:50:07 +01:00
Greg Steuck
77c702cf1a sys/openbsd: avoid /dev/fd node creation
Prevents corpus explosion with corrupted coverage data.

The two parallel runs of:
`doas ./syz-execprog -cover -coverfile /tmp/{fixed,unfixed} r.syz`
show markedly different coverage pictures:

unfixed:
```
2019/01/12 13:55:38 parsed 1 programs
2019/01/12 13:55:38 executed programs: 0
2019/01/12 13:55:38 call #0: signal 821, coverage 2438
2019/01/12 13:55:38 call #1: signal 243, coverage 1363
2019/01/12 13:55:38 call #2: signal 502, coverage 1993
2019/01/12 13:55:38 call #3: signal 15, coverage 44
2019/01/12 13:55:38 call #4: signal 335, coverage 8196
```

fixed:
```
2019/01/12 13:51:57 parsed 1 programs
2019/01/12 13:51:57 executed programs: 0
2019/01/12 13:51:57 call #0: signal 837, coverage 2491
2019/01/12 13:51:57 call #1: signal 241, coverage 1341
2019/01/12 13:51:57 call #2: signal 27, coverage 61
2019/01/12 13:51:57 call #3: signal 13, coverage 44
2019/01/12 13:51:57 call #4: signal 39, coverage 299
```

The contents of `r.syz` is
```
mknod(&(0x7f0000000180)='./file0\x00', 0x2006, 0x10000016e8)
r0 = open(&(0x7f0000000100)='./file0\x00', 0x0, 0x0)
mmap(&(0x7f0000000000/0x3000)=nil, 0x3000, 0x2, 0x10, r0, 0x0, 0x0)
writev(0xffffffffffffffff, &(0x7f0000002480)=[{&(0x7f0000001480)="<junk>", 0x573}], 0x1)
lstat(&(0x7f0000000240)='./file0\x00', &(0x7f0000000000))
```

So, it's the final lstat which was getting that extra coverage.  In
particular, the end of unfixed.4 has some 4734 values
0xffffffff00000000.
2019-01-14 09:48:45 +01:00
Dmitry Vyukov
c3f3344c78
Update syzbot.md
Mention i386 userspace arch and -m32 flag.
2019-01-11 14:42:31 +01:00
Dmitry Vyukov
a90e03cc92
Update syzbot.md
Mention chmod 0600 on the ssh key, otherwise it's rejected by ssh.
2019-01-11 14:36:23 +01:00
Shankara Pailoor
80dde1721e tools/syz-trace2syz/proggen.go: delete reorderStructFields()
strace incorrectly printed sin6_addr before sin6_flowinfo. To fix this,
trace2syz added reorderStructFields() which swapped back the order. Incorrect
orderings of structs is a bug in strace or in our descriptions so we should
fix the source rather than work around. We have submitted a patch to fix the
sockaddr_in6 decoding in strace so we can safely delete this function.
2019-01-10 17:24:09 +01:00
Dmitry Vyukov
da53282acc pkg/vcs: relax check on git hash length
We've seen 15 and 17 char hashes already.
And 14 wasn't initially in the list, but somebody used it.
Relax the check to 8..40 chars.
2019-01-10 14:35:45 +01:00
Kamil Rytarowski
7835524884 executor: disable gen.go for NetBSD
kvm is Linux specific.
2019-01-10 12:50:45 +01:00
Shankara Pailoor
db9b657915 tools/syz-trace2syz/proggen/proggen_test.go: test ipv6 address conversion 2019-01-10 12:34:28 +01:00
Shankara Pailoor
f9ccea26eb tools/syz-trace2syz/proggen: convert strace byte arrays to int args
strace decodes certain arguments like sockaddr_in.sin_port or sin_addr
as hex strings under -Xraw. This is because the arguments are in network byte
order. This patch supports converting those hex strings to int args if the size
of the string is 1, 2, 4, or 8.
2019-01-10 12:34:28 +01:00
Shankara Pailoor
0108829095 sys/linux: add rand_addr option to ipv6_addr union
rand_addr option is the first option for the ipv6_addr union
and is just an array of 16 bytes. This option makes it easy
for trace2syz to convert ipv6 address as strace decodes
the ipv6 address as a hex string.
2019-01-10 12:34:28 +01:00
Dmitry Vyukov
45c0c1b10e
Update found_bugs.md 2019-01-09 07:23:29 +01:00
Kamil Rytarowski
432a811564 AUTHORS/CONTRIBUTORS: register myself as an author and a contributor 2019-01-09 07:19:02 +01:00
Kamil Rytarowski
fe1c444d38 executor: adapt os_init() to NetBSD with PaX MPROTECT
Initialize syz data segment with protection allowed by PaX MPROTECT.

PROT_MPROTECT() registers future potential protection that is allowed
to be enabled in future.
2019-01-09 06:02:05 +01:00
Andrey Konovalov
204b8f5906 sys/linux: chmod -x *.txt
For some reason some syscall description txt files are +x. Do chmod -x.
2019-01-09 05:46:47 +01:00
Andrey Konovalov
010ed08bc6 fuzzer: fix syscall detection
As pointed out my Mark Rutland, kallsyms entries have format of
__ia32_sys_${NAME} rather than __ia32_${NAME}. Fix the regexps.
2019-01-08 19:52:59 +01:00
Andrey Konovalov
baa5c8e247 fuzzer: speed up syscall support detection
Right now syz-fuzzer does a search through /proc/kallsyms for each syscall
to check whether it's supported. Do one search instead and save the results
to a map. This speeds up syscall detection ~60 times when testing arm64 kernel
on x86. Also add another search pattern for arm64 and add some logging.
2019-01-08 16:06:27 +01:00
Anton Lindqvist
37dd2683f5 docs/openbsd: update found_bugs.md 2019-01-08 07:41:30 +01:00
houjingyi
69d69aa92d Update hints_test.go 2019-01-07 10:01:28 +01:00
houjingyi
fdc2fbc53d Update CONTRIBUTORS 2019-01-07 10:01:28 +01:00