| Commit message (Collapse) | Author | Age | Files | Lines |
| ... | |
| |
|
|
|
|
|
|
|
|
|
|
|
| |
This is the first step for #1541.
Move the fuzzing engine that used to be interleaved with other syz-fuzzer
code into a separate package.
For now, the algorithm is more or less the same as it was, the only
difference is that a pkg/fuzzer instance scales to the available
computing power.
Add an executor-based test that performs real fuzzing.
|
| |
|
|
|
| |
Collect PC coverage like it's done by KCOV. This will help write better
tests for the fuzzer.
|
| |
|
|
|
|
|
|
|
|
| |
IORING_SETUP_CQE32 and IORING_SETUP_SQE128 may lead to incorrect
assumptions about the ring buffer size, causing the kernel to write
outside of the mapped memory, smashing whatever follows it.
This is a hotfix for https://github.com/google/syzkaller/issues/4531
that will stop the ci-upstream-gce-arm64 from generating random
coverage.
|
| |
|
|
|
|
|
| |
The fd may be closed by an async close() call, it's not a reason to
report a failure.
Reported-by: Andrei Vagin <avagin@google.com>
|
| |
|
|
|
|
| |
When BLK_DEV_WRITE_MOUNTED is enabled, the kernel treats the loopfd
reference as a writer and does not let us issue mount() calls over the
same block device.
|
| |
|
|
|
| |
This should never be happening during fuzzing. Otherwise we let
syz-executor silently crash and restart insane number of times.
|
| |
|
|
|
|
| |
During fuzzing, it's expected that certain operations might return
errors. Don't abort the whole syz-executor process in this case, this is
too expensive.
|
| |
|
|
|
|
| |
It seems like VIRT86 and CPL3 KVM_RUN command prefixes do not work with SVM
virtualization. Detect which virtualization option is used and select
appropriate tests.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This commit fixes:
[0ms] exec opts: procid=0 threaded=1 cover=0 comps=0 dedup=1 signal=0 timeouts=50/5000/1 prog=168 filter=0
spawned worker pid 12456
--- FAIL: TestExecutorMistakes (0.09s)
style_test.go:193:
executor/test_linux.h:104: Don't use C89 var declarations. Declare vars where they are needed \
and combine with initialization
int res;
FAIL
FAIL github.com/google/syzkaller/executor 1.070s
FAIL
|
| |
|
|
|
|
|
|
|
|
|
| |
This kernel interface provides access to fds of other processes, which
is readily abused by the fuzzer to mangle parent syz-executor fds.
Pid=1 is the parent syz-executor process when PID namespace is created.
Sanitize it in the new syz_pidfd_open() pseudo-syscall.
We could not patch the argument in sys/linux/init.go because the first
argument is a resource.
|
| |
|
|
|
| |
Add new pseudo-syscall for creating a socket in init netns and connecting to
NVMe-oF/TCP server on 127.0.0.1:4420. Also add descriptions for NVMe-oF/TCP.
|
| |
|
|
|
| |
The `mmap` size is `max_destlen`, but `munmap` size is `destlen`, which
causes a memory leak.
|
| |
|
|
|
|
|
|
| |
This parameter barely increases coverage since the tail is always set
to the entry that is written, but it does increase the complexity of
the api and seems to reduce coverage when I run it locally.
Remove it.
|
| |
|
|
|
|
|
|
|
|
| |
In Linux 6.4+ it is not allowed to provide a vma to mmap(2) [1]. Change
the API to request the address from the Kernel.
Note I do not know why this was done in the first place, but it seems
not to be useful.
[1]: https://github.com/torvalds/linux/commit/d808459b2e31bd5123a14258a7a529995db974c8
|
| |
|
|
|
|
|
|
|
|
| |
The recent docker upgrade to debian `bookworm` caused
x86_64 instances to fail in `pthread_create()` due to the
android seccomp filter.
On `bookworm`, `pthread_create()` calls `clone3()` and
`set_robust_list()` which aren't on the seccomp filter (instead
of `clone()`), which is. Added these calls to the seccomp policy.
|
| |
|
|
|
|
|
|
|
| |
The loop in lookup_endpoint incorrectly iterates over endpoints.
Fixes #4038.
Reported-by: @cyruscyliu
Signed-off-by: Andrey Konovalov <andreyknvl@google.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
Its needed for FALLOC_FL_ZERO_RANGE which needs this header, it works
with glibc because fcntl.h includes this header indirectly, however the
failure comes to fore with musl C library where this header is not
included indirectly by other system headers, therefore include it as
required.
Fixes
In file included from executor/common.h:505:
executor/common_linux.h:5604:16: error: use of undeclared identifier 'FALLOC_FL_ZERO_RANGE'
fallocate(fd, FALLOC_FL_ZERO_RANGE, 0, SWAP_FILE_SIZE);
^
|
| |
|
|
|
| |
If the feature is supported on the device, allocate a 128MB swap file
after VM boot and activate it.
|
| |
|
|
|
| |
It makes these extentions much more flexible as they can now also
customize what other features set up.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We have a long history of executor managing to corrupt itself in various
interesting ways (e.g. using read with a pointer pointing to some
global/stack variable and then kernel overwrites it). Or rt_sigreturn
can corrupt other registers which won't cause immediate SIGSEGV, but
rather some random behavior later. This is the race we can't win.
We can't rely on memory consistency when the test already started, so we
should use exitf instead of fail outside of setup sequence (and relying
more on unit testing to ensure that executor works as expected for sane
programs).
Suggested-by: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: Andrei Vagin <avagin@google.com>
|
| |
|
|
|
|
|
| |
Given that we must chose only one version, fuzzing v1 of itseems to be of
higher value at the moment.
Later we might make it a configurable option and do both version.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
Adjust signal creation in syz-executor so hash
is independent of module offsets. This allows
for canonicalization of the signal between VMs.
Added signals to canonicalization/decanonicalization
between instances.
Coverts serialized Signal values as they have already
been serialized in rpc.go. Added a function in signal.go
to update serial signal elements.
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
| |
This relies on sendsyslog in sys/syslog.h which will be in OpenBSD
HEAD soon.
|
| |
|
|
|
|
|
| |
Without this change the following warning is generated:
kvm_amd64.S:95: Warning: no instruction mnemonic suffix given and no register operands; using default for `lret'
This does not change the generated code in kvm_amd64.S.h
|
| |
|
|
|
|
|
|
| |
Without this change `go generate ./executor` on gcc 12.2.0 gives:
/usr/bin/ld: warning: /tmp/ccmfWMO4.o: missing .note.GNU-stack section implies executable stack
/usr/bin/ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker
This does not change the generated code in kvm_amd64.S.h
|
| |
|
|
| |
The syscall sets PKRU register which is part of protection keys (pkey).
|
| |
|
|
|
|
|
| |
The call to mkdtemp() will fail when given
/data/data/syzkaller/syzkaller-XXXXXX, since /data/data/syzkaller/
doesn't exist. The correct temporary dir on Android is /data/local/tmp,
which exists by default.
|
| | |
|
| |
|
|
|
|
|
|
| |
Android devices often fail during the initial check with the error:
SYZFAIL: tun: ioctl(TUNSETIFF) failed
We need the same namespacing here that is used for other sandboxing
configurations.
|
| |
|
|
|
|
|
| |
This commit adds a new VM for fuzzing starnix.
The VM will boot a fuchsia image using the `ffx` tool and will connect to an adb server inside it. Fuzzing will be done using HostFuzzer mode due to some features not being implemented yet in starnix. Once this is possible, fuzzing will be performed without HostFuzzer mode.
Co-authored-by: Juampi Miceli <jpmiceli@google.com>
|
| |
|
|
| |
We already suppress them, but the current approach fails if syzkaller
slightly corrupts the options string. Do the check more rigorously.
|
| |
|
|
|
|
|
|
| |
When we decompress images for mutation or hints,
we always specially check for empty compressed data
(I assume it can apper after minimization).
Treat it as correct compressed and return empty decompressed data.
This removes the need in special handling in users.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Benchmark results:
name old time/op new time/op delta
Decompress-8 24.7ms ± 1% 13.4ms ± 4% -45.81% (p=0.000 n=16+19)
name old alloc/op new alloc/op delta
Decompress-8 67.2MB ± 0% 0.0MB ± 1% -99.98% (p=0.000 n=18+20)
name old allocs/op new allocs/op delta
Decompress-8 188 ± 0% 167 ± 0% -11.17% (p=0.000 n=20+20)
Test process memory consumption drops from 220MB to 80MB.
|
| |
|
|
|
| |
We can close memfd as soon as we passed it to LOOP_SET_FD
(it holds a reference to the file).
|
| |
|
|
|
|
| |
We symlink resulting partitions into the test dir.
If we do LOOP_CLR_FD, device and partitions disappear.
Don't do LOOP_CLR_FD on success.
|
| |
|
|
|
|
|
| |
The images we unpack has huge ranges of 0s.
Currently we write all bytes and as the result page in whole unpacked image.
Don't write 0s since we just mmaped zero memory.
This reduces btrfs_0 seed memory consumption from 130MB to 6MB.
|
| |
|
|
| |
We don't use C89 style.
|
| |
|
|
|
|
| |
This will allow us to mutate the image size.
Fixes #3527
|
| |
|
|
|
| |
zlib can calculate uncompressed output size if given NULL destination buffer.
We don't use that. Remove.
|
| | |
|
| |
|
|
|
|
| |
In executor code we commonly use the syscall interface for functions:
return -1 on erorr and set errno.
Use this interface for puff_zlib_to_file.
|
| |
|
|
|
|
| |
Update the executor to handle the new `syz_mount_image`/`syz_part_table`
pseudo-syscalls. It now expects compressed images, and decompresses
them using the new `common_zlib.h` header file before mounting.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
Create a header file to provide a clean entrypoint `puff_zlib_to_file()`,
which decompresses `zlib` data from an array to a file. This will be
used for pseudo-syscalls which accept compressed data, e.g.
`syz_mount_image`. The implementation uses a slightly-modified version
of `puff.{c,h}`, found in the `zlib` repository.
We have to be careful to ensure the copyright information from
`puff.{c,h}` gets included in generated C code and C reproducers.
Therefore, introduce the `//%` pattern to indicate comments which should
not be removed by code generation, and use this pattern for the
copyright notice.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Problem: the BT initialization logic (`initialize_vhci()` in `common_linux.h`)
expected `HCI_VENDOR_PKT` to be sent first, but this is not always the case as
the kernel sends these two packets almost at the same time (both are sent as
the result of the `open("/dev/vhci", …)` call):
* syscall thread: `HCI_VENDOR_PKT` (in `__vhci_create_device`)
* `power_on` queue thread: `HCI_OP_RESET` (from `hci_reset_sync` <-
`hci_init1_sync` <- `hci_init_sync` <- `hci_dev_open_sync` <-
`hci_dev_do_open` <- `hci_power_on` <- `hdev->power_on` <- (worker queue)
<- `hci_register_dev` <- `__vhci_create_device`)
Solution: handle both `HCI_OP_RESET` and `HCI_VENDOR_PKT` packets in
`initialize_vhci`.
Also instead of waiting for the kernel to send `HCI_VENDOR_PKT` after 1 second,
we initiate the setup by sending `HCI_VENDOR_PKT` (request) to the kernel first.
|
| | |
|
| |
|
|
|
| |
The extension point allows to setup the test process in a custom way
without overwriting any of the existing files.
|
| |
|
|
| |
Test that extension points keep stable interface and work.
|