aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/host/features.go
Commit message (Collapse)AuthorAgeFilesLines
* executor: add runner modeDmitry Vyukov2024-06-241-80/+0
| | | | | | | Move all syz-fuzzer logic into syz-executor and remove syz-fuzzer. Also restore syz-runtest functionality in the manager. Update #4917 (sets most signal handlers to SIG_IGN)
* pkg/host: return slices of pointersDmitry Vyukov2024-05-171-6/+6
| | | | | Flatbuffers compiler generates slices of pointers for these types, so return slices of pointers to avoid converting the whole slice.
* pkg/vminfo: move feature checking to hostDmitry Vyukov2024-05-151-183/+44
| | | | | | | | | | | | | | | | | Feature checking procedure is split into 2 phases: 1. syz-fuzzer invokes "syz-executor setup feature" for each feature one-by-one, and checks if executor does not fail. Executor can also return a special "this feature does not need custom setup", this allows to not call setup of these features in each new VM. 2. pkg/vminfo runs a simple program with ipc.ExecOpts specific for a concrete feature, e.g. for wifi injection it will try to run a program with wifi feature enabled, if setup of the feature fails, executor should also exit with an error. For coverage features we also additionally check that we actually got coverage. Then pkg/vminfo combines results of these 2 checks into final result. syz-execprog now also uses vminfo package and mimics the same checking procedure. Update #1541
* pkg/repro, pkg/ipc: use flatrpc.FeatureDmitry Vyukov2024-05-061-0/+63
| | | | | | | Start switching from host.Features to flatrpc.Features. This change is supposed to be a no-op, just to reduce future diffs that will change how we obtain features.
* pkg/runtest: enable coverage for some TestOS targetsAleksandr Nogikh2024-03-121-4/+18
|
* all: support swap feature on LinuxAleksandr Nogikh2023-06-151-0/+5
| | | | | If the feature is supported on the device, allocate a 128MB swap file after VM boot and activate it.
* executor: add NIC PCI pass-through VF supportGeorge Kennedy2022-09-211-0/+2
| | | | | | | | | | | | | | | Add support for moving a NIC PCI pass-through VF into Syzkaller's network namespace so that it will tested. As DEVLINK support is triggered by setting the pass-through device to "addr=0x10", NIC PCI pass-through VF support will be triggered by setting the device to "addr=0x11". If a NIC PCI pass-through VF is detected in do_sandbox, setup a staging namespace before the fork() and transfer the NIC VF interface to it. After the fork() and in the child transfer the NIC VF interface to Syzkaller's network namespace and rename the interface to netpci0 so that it will be tested. Signed-off-by: George Kennedy <george.kennedy@oracle.com>
* all: adapt to how mmapping a kcov instance works in LinuxAleksandr Nogikh2021-12-091-0/+2
| | | | | | | | | | | | | | | | | | | | It turns out that the current Linux implementation of KCOV does not properly handle multiple mmap invocations on the same instance. The first one succeedes, but the subsequent ones do not actually mmap anything, yet returning no error at all. The ability to mmap that memory multiple times allows us to increase syz-executor performance and it would be a pity to completely lose it (especially given that mmapping kcov works fine on *BSD). In some time a patch will be prepared, but still we will have to support both versions at the same time - the buggy one and the correct one. Detect whether the bug is present by writing a value at the pointer returned by mmap. If it is present, disable dynamic kcov mmapping and pre-mmap 5 instances in the main() function - it should be enough for all reasonable uses. Otherwise, pre-mmap 3 and let syz-executor mmap them as needed.
* pkg/host: log executor setup outputDmitry Vyukov2021-10-121-1/+3
| | | | | Executor prints what's failed during setup command. Log this output so that it's visible in syz-execprog/fuzzer output.
* pkg/host: fail loudly when coverage collection is enable w/o shmemPatrick Meyer2021-05-201-0/+4
| | | | Otherwise coverage collection just doesn't work.
* sys/linux: add ieee802154 descriptionsDmitry Vyukov2021-02-121-0/+5
|
* sys/targets: add OS/Arch name constsDmitry Vyukov2020-10-261-3/+3
| | | | | | | | | | | | We use strings to identify OS/Arch. These strings are duplicated throughout the code base massively. golangci-lint points to possiblity of typos and duplication. We already had to define these names in pkg/csource and disable checking for prog package. A future change triggers such warnings in another package. Add OS/Arch name consts to sys/targets so that they can be used to refer to OS/Arch. Use the consts everywhere.
* all: integrate with mac80211_hwsimAleksandr Nogikh2020-09-221-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Two virtual wireless devices are instantiated during network devices initialization. A new flag (-wifi) is added that controls whether these virtual wifi devices are instantiated and configured during proc initialization. Also, two new pseudo syscalls are added: 1. syz_80211_inject_frame(mac_addr, packet, packet_len) -- injects an arbitrary packet into the wireless stack. It is injected as if it originated from the device identitied by mac_addr. 2. syz_80211_join_ibss(interface_name, ssid, ssid_len, mode) -- puts a specific network interface into IBSS state and joins an IBSS network. Arguments of syz_80211_join_ibss: 1) interface_name -- null-terminated string that identifies a wireless interface 2) ssid, ssid_len -- SSID of an IBSS network to join to 3) mode -- mode of syz_80211_join_ibss operation (see below) Modes of operation: JOIN_IBSS_NO_SCAN (0x0) -- channel scan is not performed and syz_80211_join_ibss waits until the interface reaches IF_OPER_UP. JOIN_IBSS_BG_SCAN (0x1) -- channel scan is performed (takes ~ 9 seconds), syz_80211_join_ibss does not await IF_OPER_UP. JOIN_IBSS_BG_NO_SCAN (0x2) -- channel scan is not performed, syz_80211_join_ibss does not await IF_OPER_UP. Local testing ensured that these syscalls are indeed able to set up an operating network and inject packets into mac80211.
* all: initialize vhci in linuxTheOfficialFloW2020-07-301-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
* sys/targets: don't use HostFuzzer mode for test OSDmitry Vyukov2020-07-151-2/+8
| | | | | | | | | | | | | | 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).
* pkg/host: increase executor setup timeoutDmitry Vyukov2020-06-291-1/+1
| | | | | For context see: https://groups.google.com/d/msg/syzkaller/7yOtIJGW2sw/Siw8mtu0CAAJ
* pkg/host: support wrapping of executor binaryDmitry Vyukov2020-04-171-1/+4
| | | | | | | pkg/ipc has this logic for executor binary as well. Allows to run e.g. executor under strace as: syz-execprog -executor "/bin/strace -o /tmp/log /bin/syz-executor" prog
* csource, executor: add usb emulation featureAndrey Konovalov2020-04-031-0/+5
| | | | | | | | | The feature gets enabled when /dev/raw-gadget is present and accessible. With this feature enabled, executor will do chmod 0666 /dev/raw-gadget on startup, which makes it possible to do USB fuzzing in setuid and namespace sandboxes. There should be no backwards compatibility issues with syz reproducers that don't explicitly enable this feature, as they currently only work in none sandbox.
* pkg/host: add Features.SupportedDmitry Vyukov2019-11-161-0/+4
| | | | To reduce diff in future changes. Currently no-op.
* pkg/host: rename some featuresDmitry Vyukov2019-11-161-10/+10
| | | | | Rename some features in preparation for subsequent changes which will align names across the code base.
* executor: refactor sandbox flagsDmitry Vyukov2019-11-161-13/+13
| | | | In preparation for future changes.
* pkg/host: split files into syscalls/featuresDmitry Vyukov2019-11-161-0/+100
pkg/host does 2 things: detects supported syscalls and supported features. There is enough code for each for a separate file.