Commit Graph

1577 Commits

Author SHA1 Message Date
Dmitry Vyukov
056be1b9c8 sys/linux: assorted improvements for vhci
Regenerate const files on next-20200729.

Change conn handle to 200 because it also seems to be matches
against phy_handle fields which are int8 (current 256 does not fit into int8).
Use 200 for all handle's and all phy_handle's.

Remove hci_evt_le_cis_req, it does not seem to be used in the kernel.

Restrict some event types and statuses.

Add rssi field to hci_ev_le_advertising_info.

Use bytesize for some of the data length fields.
2020-07-30 13:31:33 +02:00
TheOfficialFloW
b094755316
all: initialize vhci in linux
* all: initialize vhci in linux

* executor/common_linux.h: improve vhci initialization

* pkg/repro/repro.go: add missing vhci options

* executor/common_linux.h: fix type and add missing header

* executor, pkg: do it like NetInjection

* pkg/csource/csource.go: do not emit syz_emit_vhci if vhci is not enabled

* executor/common_linux.h: fix format string

* executor/common_linux.h: initialize with memset

For som reason {0} gets complains about missing braces...

* executor/common_linux.h: simplify vhci init

* executor/common_linux.h: try to bring all available hci devices up

* executor/common_linux.h: find which hci device has been registered

* executor/common_linux.h: use HCI_VENDOR_PKT response to retrieve device id

* sys/linux/dev_vhci.txt: fix structs of inquiry and report packets

* executor/common_linux.h: remove unnecessary return statement and check vendor_pkt read size

* executor/common_linux.h: remove unnecessary return statement and check vendor_pkt read size

* sys/linux/dev_vhci.txt: pack extended_inquiry_info_t

* sys/linux/l2cap.txt: add l2cap_conf_opt struct

* executor/common_linux.h: just fill bd addr will 0xaa

* executor/common_linux.h: just fill bd addr will 0xaa
2020-07-30 11:33:48 +02:00
Necip Fazil Yildiran
cbca8e0f04 executor: added syz_io_uring_setup to wrap both setup and mmap
It is hard for the fuzzer to generate correct programs using mmap calls
with fuzzer-provided mmap length. This wrapper ensures correct length
computation.
2020-07-29 13:44:49 +02:00
Dmitry Vyukov
9534e89c79 all: mark auto-generated files
Use the standard Go convention for Go files:
https://golang.org/pkg/cmd/go/internal/generate
Use github linguish for other files:
https://github.com/github/linguist#generated-code

Both are understood by github and should result
in these files being collapsed in PRs by default.
2020-07-29 12:55:55 +02:00
Anton Lindqvist
cb93dc6ac6 pkg/report: flag short uvm_fault reports as corrupted
They don't contain enough context to be useful.

This change makes `testdata/openbsd/report/0` to be treated as
corrupted, which is desirable since it also lacks context.
2020-07-27 07:46:35 +02:00
Necip Fazil Yildiran
0a13649c05
sys/linux: enhanced descs for io_uring
* sys/linux: enhanced descs for io_uring

Introduced pseudo-call "syz_io_uring_put_sqes_on_ring()" for writing
submission queue entries (sqes) on sq_ring, which was obtained by
mmap'ping the offsets obtained from io_uring_setup().

Added descriptions for io_ring_register operations that were missing
earlier.

Did misc changes to adapt the descriptions for the updates on the
io_uring subsystem.

* pkg/host: add io_uring pseudo-syscall

* executor/common_linux.h: fix issues with io_uring pseudo-syscall

* executor: fixed io_uring offset computation

* executor: fixes and refactorings in syz_io_uring_submit()

* executor: added syz_io_uring_complete() pseudo-syscall for io_uring

* sys/linux: added descriptions for io_uring operations

Each operation requires a different struct io_uring_sqe set up. Those
are described to be submitted to the sq ring.

* executor: use uint32 instead of uint32_t

* executor: remove nonfailing from pseudo-calls

* sys/linux: fix io_uring epoll_ctl sqe

* prog: fix TestTransitivelyEnabledCallsLinux()

The newly introduced syscall, syz_io_uring_submit$IORING_OP_EPOLL_CTL,
uses fd_epoll. Adapt TestTransitivelyEnabledCallsLinux() to account for
this.

* sys/linux: add IORING_OP_PROVIDE_BUFFERS and IORING_OP_REMOVE_BUFFERS

* sys/linux: fix IORING_OP_WRITE_FIXED and IORING_OP_READ_FIXED

addr and len are for the buffer located at buf_index

* sys/linux: io_uring: use reg. bufs for READ, READV, RECV, RECVMSG

As a result, IOSQE_BUFFER_SELECT_BIT is included in the iosqe_flags.

* sys/linux: io_uring: misc fixes

* sys/linux: io_uring: add IORING_SETUP_ATTACH_WQ

* executor: refactorings on io_uring pseudo syscalls

* sys/linux: io_uring: fix desc for params.cq_entries

* executor: fix SQ_ARRAY_OFFSET computation

This is required with the fix in io_uring kernel code.
https://lore.kernel.org/io-uring/CACT4Y+bgTCMXi3eU7xV+W0ZZNceZFUWRTkngojdr0G_yuY8w9w@mail.gmail.com/T/#t

* executor: added pseudosyscall syz_io_uring_cq_eventfd_toggle()

The usage of cq_ring->flags is only for manipulating
IORING_CQ_EVENTFD_DISABLED bit. This is achieved by a pseudo-syscall,
which toggles the bit.

* executor: added pseudocall syz_io_uring_put_ring_metadata

Removed syz_io_uring_cq_eventfd_toggle() and introduced
syz_io_uring_put_ring_metadata() instead. We have many pieces of
metadata for both sq_ring and cq_ring, for which we are given the
offsets, and some of are not supposed to be manipulated by the
application. Among them, both sq and cq flags can be changed. Both valid
and invalid cases might cause interesting outcomes. Use the newly
introduced pseudo syscall to manipulate them randomly while also
manipulating the flags to their special values.

* executor: added pseudo-syscall syz_memcpy_off

Removed syz_io_uring_put_ring_metadata() and instead added a much more
generic pseudo systemcall to achieve the task. This should benefit other
subsystems as well.

* sys/linux: refactored io_uring descriptions

syz_io_uring_submit() is called with a union of sqes to reduce
duplication of other parameters of the function.

io_uring_sqe is templated with io_uring_sqe_t, and this template type is
used to describe sqes for different ops.

The organization of io_uring.txt is changed.

* sys/linux: io_uring: improved descs to utilize registered files

The files are registered using
io_uring_register$IORING_REGISTER_FILES(). When IOSQE_FIXED_FILE_BIT is
enabled in iosqe_flags in sqe, a variety of operations can use those
registered files using the index of the file instead of fd.

Changed the sqe descriptions for the eligible operations to utilize
this.

* sys/linux: io_uring: improved the descs to utilize personality_id in sqes

A personality_id can be registered for a io_uring fd using
io_uring_register$IORING_REGISTER_PERSONALITY(). This id can be utilized
within sqes. This commit improves the descs for io_uring to utilize it.

In addition, the descriptions for the misc field in io_uring_sqe_t is
refactored as most are shared among sqes.

* sys/linux: io_uring: utilized cqe.res

io_uring_cqe.res is used to carry the return value of operations
achieved through io_uring. The only operations with meaningful return
values (in terms of their possible usage) are openat and openat2. The
pseudo-syscall syz_io_uring_complete() is modified to account for this
and return those fds. The description for sqe_user_data is splitted into
two to identify openat and non-openat io_uring ops.

IORING_OP_IOCTL was suggested but never supported in io_uring. Thus, the
note on this is removed in the descriptions.

tee() expects pipefds, thus, IORING_OP_TEE. The descriptions for the
pipe r/w fds are written as ordinary fd. Thus, in the description for
IORING_OP_TEE, which is io_uring_sqe_tee, fd is used in the place where
pipefds are expected. The note on this is removed in the descriptions.

* sys/linux/test: added test for io_uring

This is not tested yet.

* sys/linux/test: fixed the test for io_uring

The changes successfully pass the sys/linux/test/io_uring test.

sys/linux/io_uring.txt: sq_ring_ptr and cq_ring_ptr are really the same.
Thus, they are replaced with ring_ptr.

executor/common_linux.h: thanks to io_uring test, a bug is found in
where the sq_array's address is computed in syz_io_uring_submit().
Fixed. In addition, similar to the descriptions, the naming for the
ring_ptr is changed from {sq,cq}_ring_ptr to ring_ptr.

* sys/linux: io_uring: misc fixes

* sys/linux: io_uring: changed the sqe_user_data enum

Used a smaller range to ease the collisions. Used comperatively unique
and magic numbers for openat user_data to avoid thinking as if the cqe
belongs to openat while the user_data is coming from some random
location.

* pkg/host: added checks for io_uring syscall

* pkg/host: fixed checks for io_uring syscall

* sys/linux: fixed io_uring test
2020-07-24 18:51:04 +02:00
Dmitry Vyukov
70c104a18f pkg/compiler: fix crash on fmt[flags]
Flags with only 1 value 0 are transformed to ConstType.
Fmt did not expect that.

Fixes #1965
2020-07-23 17:13:55 +02:00
Denis Efremov
e562dd8adf executor: fix build errors in setup_32bit_idt()
GCC10 fails to build the code with errors:
executor/common_kvm_amd64.h:143:64: error: ‘gate.kvm_segment::type’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
executor/common_kvm_amd64.h:143:56: error: ‘gate.kvm_segment::base’ may be used uninitialized in this function [-Werror=maybe-uninitialized]

Replace 'case 6' with 'case 5' since 'i % 6' results in [0..5].

Signed-off-by: Denis Efremov <efremov@linux.com>
2020-07-21 13:04:43 +02:00
Albert van der Linde
d7a01d53f7 sys/linux: add descriptions for raw character devices 2020-07-20 11:30:15 +02:00
Dmitry Vyukov
8caeeeb724 pkg/report: parse linux undead task reports 2020-07-20 10:42:01 +02:00
Zubin Mithra
9c8124727c sys/linux: add descriptions for i915 driver 2020-07-17 15:26:11 +02:00
Dmitry Vyukov
c4b454fc54 pkg/runtest: tell ASAN to not mess with our NONFAILING
It seems that different gcc's have different defaults for ASAN flags.
Some fail with:

        run.go:67: nonfailing none/thr/repeat            : FAIL: run 0: call 0 is not executed
            	ASAN:DEADLYSIGNAL
            	=================================================================
            	==67143==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x7f7b0befb0a2 bp 0x7f7b0cfdad10 sp 0x7f7b0cfda490 T1)
            	    #0 0x7f7b0befb0a1  (/usr/lib/x86_64-linux-gnu/libasan.so.3+0x8d0a1)
            	    #1 0x404bbb in syz_compare(long, long, long, long) (/tmp/utor355225125.0+0x404bbb)
            	    #2 0x403cdf in execute_call(thread_t*) (/tmp/utor355225125.0+0x403cdf)
            	    #3 0x404006 in worker_thread(void*) (/tmp/utor355225125.0+0x404006)
            	    #4 0x7f7b0bc584a3 in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x74a3)
            	    #5 0x7f7b0b99ad0e in __clone (/lib/x86_64-linux-gnu/libc.so.6+0xe8d0e)

            	AddressSanitizer can not provide additional info.
            	SUMMARY: AddressSanitizer: SEGV (/usr/lib/x86_64-linux-gnu/libasan.so.3+0x8d0a1)
            	Thread T1 created by T0 here:
            	    #0 0x7f7b0be9ef59 in __interceptor_pthread_create (/usr/lib/x86_64-linux-gnu/libasan.so.3+0x30f59)
            	    #1 0x406117 in execute_one() (/tmp/utor355225125.0+0x406117)
2020-07-16 12:22:57 +02:00
Dmitry Vyukov
13d5e89e02 executor: remove NONFAILING from pseudo-syscalls
This is not needed anymore afer the previous commit.

Fixes #1918
2020-07-15 09:26:23 +02:00
Dmitry Vyukov
b458f2c1a6 executor: wrap all syscalls into NONFAILING
Currently we sprinkle NONFAILING all over pseudo-syscall code,
around all individual accesses to fuzzer-generated pointers.
This is tedious manual work and subject to errors.
Wrap execute_syscall invocation with NONFAILING in execute_call once instead.
Then we can remove NONFAILING from all pseudo-syscalls and never get back to this.
Potential downsides: (1) this is coarser-grained and we will skip whole syscall
on invalid pointer, but this is how normal syscalls work as well,
so should not be a problem; (2) we will skip any clean up (closing of files, etc)
as well; but this may be fine as well (programs can perfectly leave open file
descriptors as well).

Update #1918
2020-07-15 09:26:23 +02:00
Dmitry Vyukov
6b24f02a11 pkg/runtest: allow to select a subset of tests to run 2020-07-15 09:26:23 +02:00
Dmitry Vyukov
e2f6c0c1b5 sys/targets: don't use HostFuzzer mode for test OS
We set HostFuzzer for all test targets b/c in some contexts
they needed the same special behavior as real HostFuzzer targets
(e.g no checking enabled syscalls).
However, in some other contexts they don't the same special
behavior as real HostFuzzer targets. For example, pkg/ipc
does rate limiting for HostFuzzer and pkg/runtest don't run
C tests for HostFuzzer.

Add special case for test targets in pkg/host,
and don't set HostFuzzer for all test targets
(keep it for one target for better coverage).
2020-07-15 09:26:23 +02:00
Albert van der Linde
230553f68f prog/types.go: add Type.Alignment() and TypeCommon.TypeAlign
Type.Alignment() can be used to obtain byte alignment for
correctly allocating aligned memory for the Type.
2020-07-14 12:20:37 +02:00
Dmitry Vyukov
c1147c8df7 all: fix comments format
Fix capitalization, dots at the end
and two spaces after a period.

Update #1876
2020-07-12 08:22:44 +02:00
Dmitry Vyukov
0faffd0438 syz-ci: set Timeout for bisections
Add Timeout config param for bisections.
Specify timeout in syz-ci as 8h based on the following data.

Out of 1049 cause bisections that we have now:
-  891 finished under  6h (84.9%)
-  957 finished under  8h (91.2%)
-  980 finished under 10h (93.4%)
-  989 finished under 12h (94.3%)
- 1011 finished under 18h (96.3%)
- 1025 finished under 24h (97.7%)

There is also a significant increase in errors/inconclusive bisections after ~8h.
Out of 4075 fix bisections:
- 4015 finished under  6h (98.5%)
- 4020 finished under  8h (98.7%)
- 4026 finished under 10h (98.8%)
- 4032 finished under 12h (98.9%)
Significant increase in errors starts after ~12h.

The current timeout also take into account that bisection jobs
compete with patch testing jobs (it's bad delaying patch testing).
When/if bisection jobs don't compete with patch testing,
it makes sense to increase this to 12-24h.

Fixes #1923
2020-07-12 08:22:14 +02:00
Dmitry Vyukov
1ad470c265 pkg/vcs: don't sandbox syzkaller repo
Currently we sandbox all repos b/c we assumed
that all builds are also sandboxes. But this causes
havoc for bisection/patch testing b/c syzkaller build
is not actually sandboxed anywhere. Build creates
root-owned files and then git can't do anything with them
but don't report errors either:

$ git checkout 8eda0b95 && echo OK
error: unable to unlink old 'sys/linux/gen/386.go': Permission denied
error: unable to unlink old 'sys/linux/gen/ppc64le.go': Permission denied
...
HEAD is now at 8eda0b957e
OK

We trust own sources and we don't test syzkaller patches,
so don't sandbox syzkaller repos.
2020-07-12 08:22:14 +02:00
Mark Johnston
7ba05d2dd6 pkg/build: always truncate loader.conf on FreeBSD
Otherwise we append the same lines to the file upon each build.
2020-07-11 08:49:28 +02:00
Mark Johnston
ca5272b763 pkg/build: load the SCTP and IPSec stacks on FreeBSD
IPSec is not compiled into GENERIC kernels and must be loaded.  SCTP
currently is compiled into GENERIC, but this is expected to change.
2020-07-11 08:49:28 +02:00
Dmitry Vyukov
78178cfb8c tools/syz-linter: fix comments check
Turns out ast.Inspect does not visit most comments.
Walk file.Comments manually.

Update #1876
2020-07-10 19:15:46 +02:00
Alexander Egorenkov
56d01184e3 executor: fix bitfields for big-endian arch
Add bitfield tests for big-endian arch

Issue: #1885

Signed-off-by: Alexander Egorenkov <Alexander.Egorenkov@ibm.com>
2020-07-10 10:25:58 +02:00
Dmitry Vyukov
353d190191 dashboard/app: add navigation buttons
Currently we have only "fixed" link at the top of the page.
"invalid" is missing and this is not scalable.
Add natigation buttons (tabs) for main pages.
2020-07-09 19:40:12 +02:00
Dmitry Vyukov
894db56cb2 pkg/html: add function to format JS time 2020-07-09 19:40:12 +02:00
Dmitry Vyukov
bae5742c50 pkg/report: tune synchronize_srcu name for older kernels 2020-07-08 09:26:48 +02:00
Dmitry Vyukov
08fc4ef14d pkg/report: make smp_call_function anchor instead of on_each_cpu
Right after committing the on_each_cpu change,
another report come in where smp_call_function
is not called from on_each_cpu. And there are
actually more such callers in code, and also
as existing tests show. smp_call_function seems
to be the better root cause indication.
2020-07-07 12:04:22 +02:00
Dmitry Vyukov
f7b01f08a3 pkg/vcs: fix config bisection tests more
config-bisect.pl uses bash-isms and can't run on non-linux.
It also silently ignores all errors which made failures
very obscure -- the script happily succeeds in presence
of any errors. So the test failed later reading .config.
Use "set -eu" to not fail silently.
Also trace all config-bisect.pl invocations and output.
good/bad decisions are important and we always log them
in the normal bisection.
2020-07-07 10:40:55 +02:00
Dmitry Vyukov
e419f4e6d8 pkg/report: consider on_each_cpu as stall anchor function
Kernel frequently hangs in on_each_cpu,
it seems to be more indicative of the root cause
than subsequent frames.
2020-07-07 10:40:55 +02:00
Dmitry Vyukov
3f3be050c0 pkg/vcs: fix config bisection test
/bin/bash is usually installed on linux'es,
but not on other OSes, e.g. *BSDs.
Use /bin/sh instead of /bin/bash.
2020-07-07 08:47:36 +02:00
Dmitry Vyukov
ef6b94b522 pkg/vcs: fix config minimization test
The test requires new git binary.
It's not necessary installed everywhere.
Skip the test if git binary does not support bisection.

Also reoder functions from more important to less important.
Mark the test as parallel.
Move individual tests into subtests.
Split trace per subtest.
2020-07-07 08:36:58 +02:00
Dmitry Vyukov
ef278c737f pkg/report: use rtnetlink_rcv_msg as stall anchor frame
It also hash high branching factor and a bug is more likely in the callback.
For the added test we used to say:
INFO: rcu detected stall in __sys_sendmsg
now we say more useful:
INFO: rcu detected stall in tc_modify_qdisc
2020-07-06 17:26:25 +02:00
Dmitry Vyukov
36db93ffb9 pkg/osutil: remove appengine tag
Appengine doesn't provide appengine tag anymore.
Resort to use of syscall package for ExitStatus instead.
2020-07-06 15:59:35 +02:00
Dmitry Vyukov
4e3820bfb2 pkg/osutil: don't use os.ProcessState.ExitCode on appengine
It's not present in Go 1.11.
2020-07-06 15:04:35 +02:00
Dmitry Vyukov
3940e7a64f all: fix log/error text starting with capital letter
Update #1876
2020-07-05 10:55:16 +02:00
Dmitry Vyukov
813f363bff all: fix dup types in func args 2020-07-04 15:05:30 +02:00
Dmitry Vyukov
fcb219b67e all: don't compare string len with 0
For strings it's more readable to compare the string itself with "",
instead of comparing len with 0. Fix all such cases.

Update #1876
2020-07-04 15:05:30 +02:00
Dmitry Vyukov
74cb4e09a5 go.mod: add go-fuzz-build
Otherwise go-fuzz-build now fails with:

+ go-fuzz-build -libfuzzer -func FuzzDeserialize -o fuzzer.a ./prog/test
-: cannot find package "." in:
	/syzkaller/gopath/src/github.com/google/syzkaller/vendor/github.com/dvyukov/go-fuzz/go-fuzz-dep
2020-07-04 15:05:30 +02:00
Dmitry Vyukov
c7d7f10bdf go.mod: vendor golangci-lint 2020-07-04 15:05:30 +02:00
Dmitry Vyukov
0bb197026a pkg/vcs: reset state even more
"git clean -fd" does not remove ignored files,
while can mess state when .gitignore changes across commits.
Use "git clean -fdx" to delete ignored files as well.
2020-07-04 08:35:28 +02:00
Dmitry Vyukov
6e569755ce pkg/mgrconfig: extend proc param description 2020-07-03 13:09:05 +02:00
Dmitry Vyukov
f30c14bfec pkg/bisect: fix noop change detection with config minimization
Config minimization did not update test results for the starting commit.
Test result for the starting commit still refered to the original config,
not the minimized config that was actually used during bisection.
2020-07-02 10:56:05 +02:00
Dmitry Vyukov
39ffeee9d8 pkg/bisect: improve config minimization tests
Change a test to actually produce a new config as it is supposed
to do during config minimization and check the resulting config.

Add a regression test for the bug where we committed a broken config.
2020-07-02 10:56:05 +02:00
Dmitry Vyukov
8531773447 pkg/bisect: move checking of minimized config into common code
That part is not linux-specific, move it to the common code.
The more code we have in the common code, the more code we can test.
2020-07-02 10:56:05 +02:00
Dmitry Vyukov
63b5e2d7d2 pkg/bisect: don't overwrite user configuration
We don't own this object and should not touch,
it may be unexpected by the caller and may cause data races.
2020-07-02 10:56:05 +02:00
Dmitry Vyukov
a1f1bc47d3 pkg/bisect: test resulting config
One of main outputs of the config minimization is the new config,
but tests don't do any single check of it.
Check the resulting config (is it correct in all cases?).
2020-07-02 10:56:05 +02:00
Dmitry Vyukov
e8fcf811ec pkg/bisect: don't ignore errors during config minimization
Ignoring errors is bad. It leads to silent failures.
If there is some particular error condition that is expected
to happen and we want to ignore, we need to ignore that one only
rather than all potenital errors in the whole process.
2020-07-02 10:56:05 +02:00
Dmitry Vyukov
1640a9d528 pkg/bisect: minor style fix ups 2020-07-02 10:56:05 +02:00
Dmitry Vyukov
31792dba46 pkg/bisect: fix crash when all releases are broken
Currently we crash with nil deref in this special case.
2020-07-02 10:56:05 +02:00
Jouni Hogander
f8885dc4ce pkg/bisect: Implement config bisection
Implement Linux kernel configuration bisection. Use bisected minimalistic
configuration in commit bisection. Utilizes config_bisect.pl script from Linux
kernel tree in bisection.

Modify syz-bisect to read in kernel.baseline_config. This is used as a "good"
configuration when bisection is run.
2020-07-02 09:32:57 +02:00
Jukka Kaartinen
d42301aa2f Pass baseline config around
Add new new Syzkaller configuration option kernel_baseline_config. This option
is supposed to be used by kernel configruation bisection as a "good" config"

Signed-off-by: Jukka Kaartinen <jukka.kaartinen@unikie.com>
Signed-off-by: Jouni Hogander <jouni.hogander@unikie.com>
2020-07-02 09:32:57 +02:00
Tobias Klauser
df01f6fc27 pkg/osutil: use functionality from x/sys/unix
Use unix.Unmount instead of manually wrapping SYS_UMOUNT2.

Use unix.IoctlSetPointerInt instead of manually wrapping SYS_IOCTL. This
also allows to use FS_IOC_SETFLAGS instead of manually defining it for
each GOARCH.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2020-06-29 13:34:06 +02:00
Necip Fazil Yildiran
3ff434cc0a executor: enable cgroup/cpuset memory pressure calc.
Enable the cpuset.memory_pressure_enabled flag in the root cpuset.
2020-06-29 11:07:03 +02:00
Dmitry Vyukov
0375051c14 pkg/host: increase executor setup timeout
For context see:
https://groups.google.com/d/msg/syzkaller/7yOtIJGW2sw/Siw8mtu0CAAJ
2020-06-29 07:13:19 +02:00
m00nbsd
a2cdad9d42
executor/netbsd: base nth on 2 (#1874) 2020-06-27 17:24:37 +02:00
Tobias Klauser
9506ea6dcf pkg/host: add support for linux/riscv64
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2020-06-26 16:41:30 +02:00
Tobias Klauser
1cbaafd119 executor: add support for linux/riscv64
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2020-06-26 16:41:30 +02:00
Tobias Klauser
a8829ad274 pkg/cover: add support for linux/riscv64
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2020-06-26 16:41:30 +02:00
Tobias Klauser
9a9f703898 pkg/osutil: implement support for linux/riscv64
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2020-06-26 16:41:30 +02:00
Alexander Egorenkov
b202c7a8a2 pkg/csource: fix casting of parameters for trampolines
Signed-off-by: Alexander Egorenkov <Alexander.Egorenkov@ibm.com>
2020-06-26 12:01:33 +02:00
Alexander Egorenkov
aea82c003a sys/linux: first 64bit big-endian architecture s390x
* mmap syscall is special on Linux s390x because
  the parameters for this syscall are passed as a struct
  on user stack instead of registers.
* Introduce the SyscallTrampolines table into targets.Target
  to address the above problem.
* There is a bug in Linux kernel s390x which causes QEMU TCG
  to hang when KASAN is enabled. The bug has been fixed
  in the forthcoming Linux 5.8 version. Until then do not enable
  KASAN when using QEMU TCG, QEMU KVM shall have no problems with
  KASAN.

Signed-off-by: Alexander Egorenkov <Alexander.Egorenkov@ibm.com>
2020-06-25 23:08:45 +02:00
Alexander Egorenkov
bbad15ae75 target: support of big-endian architectures
* Introduce the new target flag 'LittleEndian' which specifies
  of which endianness the target is.
* Introduce the new requires flag 'littleendian' for tests to
  selectively enable/disable tests on either little-endian architectures
  or big-endian ones.
* Disable KD unit test on s390x architecture because the test
  works only on little-endian architecture.

Signed-off-by: Alexander Egorenkov <Alexander.Egorenkov@ibm.com>
2020-06-23 21:24:30 +02:00
Alexander Egorenkov
e5d10a4327 ipc: fix endianness issues
Use native byte-order for IPC and program serialization.
This way we will be able to support both little- and big-endian
architectures.

Signed-off-by: Alexander Egorenkov <Alexander.Egorenkov@ibm.com>
2020-06-23 16:18:44 +02:00
Alexander Egorenkov
c655ec77ca executor: fix endianness problem in internet checksum
csum_inet_update does not handle odd number of bytes
on big-endian architectures correctly. When calculating
the checksum of odd number of bytes, the last byte must be
interpreted as LSB on little-endian architectures and
as MSB on big-endian ones in a 16-bit half-word.

Futhermore, the checksum tests assume that the underlying architecture
is always little-endian. When a little-endian machine stores
a calculated checksum into memory, then the checksum's bytes
are automatically swapped. But this is NOT true on a big-endian
architecture.

Signed-off-by: Alexander Egorenkov <Alexander.Egorenkov@ibm.com>
2020-06-19 20:49:11 +02:00
Alexander Egorenkov
bc258b506d pkg: support compiler triple for 'nm' and 'addr2line'
In preparation to support big-endian architectures.
2020-06-18 19:31:40 +02:00
Alexander Egorenkov
7c48e54f9c pkg/ipc: support C compiler in non-standard location
If C compiler is installed e.g. in /opt then
we have to import LD_LIBRARY_PATH.

Signed-off-by: Alexander Egorenkov <Alexander.Egorenkov@ibm.com>
2020-06-18 16:48:02 +02:00
Andrey Konovalov
4d2d1ebee3 pkg/report: stop using questionable frames
Most likely reports without proper stack traces were caused by a bug in the
unwinder and are now fixed in 187b96db5ca7 "x86/unwind/orc: Fix
unwind_get_return_address_ptr() for inactive tasks".

Disable trying to use questionable frames for now.

Fixes #1834
2020-06-17 17:42:50 +02:00
Marco Elver
8e3ab94116 executor: Improve used terminology
Improve used terminology by using better verbs to express the effect of
the whitelist/blacklist.

This also changes executor to exclusively show respectful log messages,
and as per recent conversion, converts the last such case.
2020-06-15 09:56:18 +02:00
Dmitry Vyukov
f5ba047583 pkg/build: extract "multiple definition" linker errors 2020-06-14 11:48:08 +02:00
m00nbsd
dbce178a0e
sys/netbsd: support multiple vHCI buses (#1822) 2020-06-13 12:10:16 +02:00
Dmitry Vyukov
6fe5725de8 pkg/report: ingore another android debug output that looks like kernel crash 2020-06-12 08:23:36 +02:00
Alexey Kardashevskiy
c6ec8ed9ce cover/report: Extend call instruction parser for PPE64 little endian
This adds one more pattern in the list of recognized once as this is
what they look like in objdump:
c0000000001c21a8:       f9 d2 11 48     bl      c0000000002df4a0 <__sanitizer_cov_trace_pc>

Signed-off-by: Alexey Kardashevskiy <aik@linux.ibm.com>
2020-06-12 05:54:26 +02:00
Dmitry Vyukov
588020678f all: use more respective language
Some terms are normalised on the technical level
but may be oppressive on a societal level.
Replace them with more technically neutral terms.
See the following doc for a longer version:
https://tools.ietf.org/id/draft-knodel-terminology-00.html
2020-06-11 23:19:34 +02:00
m00nbsd
0f23e882fa
sys/netbsd: add support for fault injection (#1817) 2020-06-11 23:16:52 +02:00
Ricardo Cañuelo
8648bd1f6d tools: add custom udev rules to generated images
Add a default udev rule file to the image creation process in
create-gce-image.sh and create-image.sh.

This change creates a default rule to make udev create a custom-named
symlink for the specific vim2m device.
2020-06-10 13:09:12 +02:00
Dmitry Vyukov
2c2b926cb7 .golangci.yml: reduce function line count from 200 to 140
140 lines should be enough for everyone.
2020-06-07 10:41:01 +02:00
Dmitry Vyukov
3f04838a10 .golangci.yml: make goconst checker more strict 2020-06-07 10:41:01 +02:00
Dmitry Vyukov
cdf1aa4dc3 pkg/report: deduplicate code across netbsd and openbsd 2020-06-07 10:41:01 +02:00
Dmitry Vyukov
21b79583f1 .golangci.yml: enable receiver name check for pkg/ast 2020-06-07 10:41:01 +02:00
Dmitry Vyukov
70854cd639 .golangci.yml: enable lll for pkg/report/linux.go 2020-06-07 10:41:01 +02:00
Dmitry Vyukov
0e2e52a87a .golangci.yml: reduce scope of suppressions
Reduce scope of some suppressions (some are violated only in some packages).
Remove some outdated, fix and enable the type switch warning.
2020-06-07 10:41:01 +02:00
Marco Vanotti
c3e9afb345 executor/fuchsia: Don't map memory as executable.
Fuchsia has strict controls over who can map memory as executable.
Refactoring syz-executor to be able to do that involves a non trivial
amount of work: it needs to run as a fuchsia component and replace stdin
for some other mechanism to communicate with syz-fuzzer (probably a fidl
service and a thin client that proxies stdin/stdout to syz-fuzzer via
ssh).

Mapping memory as executable doesn't seem to be used or needed in
syz-executor at all. After talking with Dmitry, he mentioned that it was
used in a deprecated feature: `syz_execute_func` which would execute
random code. It also allows more scenarios during fuzzing.

For now, I'm removing that option to allow syzkaller continue fuzzing.

This change also refactors all of the error messages adding a string
representation of the `zx_status_t` in error logs.
2020-06-05 16:46:48 -03:00
Dmitry Vyukov
48b44e1ce0 .golangci.yml: reenable dupl checker
At some point it was enabled, but then somehow got disabled.
Re-enable and fix some regressions.
2020-06-05 12:23:19 +02:00
Dmitry Vyukov
2b2857bd21 .golangci.yml: enable funlen checker
Checks for too long functions (based on lines and statements).
2020-06-05 12:23:19 +02:00
Dmitry Vyukov
2fcb2b5c16 .golangci.yml: enable gocognit checker
Finds too complex functions.
Similar to gocyclo, but uses somewhat different metric.
2020-06-05 12:23:19 +02:00
Dmitry Vyukov
e3d77cf2a3 .golangci.yml: enable godot checker
A good one. Lots of fixed comments are contributed by episodic contributors.
So it's good to catch these earlier.
2020-06-05 12:23:19 +02:00
Dmitry Vyukov
26ae0a0edd .golangci.yml: enable goprintffuncname checker
Only 1 warning. Good to fix and enable before we get more.
2020-06-05 12:23:19 +02:00
Dmitry Vyukov
6c22a3d2dd .golangci.yml: enable nestif checker
Prevents functions with too many nested if's.
2020-06-05 12:23:19 +02:00
Dmitry Vyukov
503fd5b2f7 .golangci.yml: enable whitespace checker
Points to bad empty lines very precisely.
2020-06-05 12:23:19 +02:00
Dmitry Vyukov
555756280e pkg/compiler: remove unused statement 2020-06-05 12:23:19 +02:00
Dmitry Vyukov
1f837d8b35 pkg/report: improve "using smp_processor_id() in preemptible code" parsing 2020-06-04 12:16:25 +02:00
Dmitry Vyukov
a5ce5de0ae pkg/report: update "using X in preemptible code" bug 2020-06-03 12:46:37 +02:00
Dmitry Vyukov
2ba71ec506 pkg/repro: don't enable features missing on the target
Manager has already checked what features are present on the target.
But if we detected that, say, USB is missing, we still enabled it
in the starting csource options. This is wrong, increases configuration
minimization time and may lead to some obscure bugs.
2020-06-03 11:35:08 +02:00
Matthew Dempsky
a86ce602b3 syz-runtest: disable csource tests for HostFuzzer targets
HostFuzzer targets require that we cross-compile the csource tests and
then copy them to the target system. The code to copy files is
currently missing from syz-runtest; also, at least for Fuchsia (which
uses HostFuzzer mode), cross-compiling is non-trivial.
2020-06-03 10:30:14 +02:00
Dmitry Vyukov
06417ff868 pkg/report: add tests for rcu stalls in kmem_cache_alloc
I though maybe we need special handling for them:
stop at kmem_cache_alloc function. But now I am not sure.
This can also be an infinite loop which calls kmalloc/kfree.
Let's not change code for now, just fix things with tests
(this is a good representative set).
2020-06-02 17:47:56 +02:00
Andrey Konovalov
c98aaf984a pkg/report: improve report titles 2020-06-02 17:23:51 +02:00
Dmitry Vyukov
2b26ad000f pkg/cover: skip test on akaros
Akaros compiler does not support coverage.
2020-06-02 13:39:30 +02:00
Dmitry Vyukov
d56234396c pkg/cover: support coverage reports on fuchsia 2020-06-02 13:39:30 +02:00
Dmitry Vyukov
6f3e1c7c67 pkg/build: chmod key file before running qemu
In case the original key has wrong permissions.
Ssh is very picky about key permissions.
2020-05-30 11:04:21 +02:00