aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/host/features_linux.go
Commit message (Collapse)AuthorAgeFilesLines
* pkg/vminfo: move feature checking to hostDmitry Vyukov2024-05-151-355/+0
| | | | | | | | | | | | | | | | | 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/host: require fallocate for swapAleksandr Nogikh2023-08-211-0/+17
| | | | | | | | | Test the filesystem for the fallocate support. It's cheaper than having to manually zero-write the whole swap file, which can be quite slow on emulated VMs. As testing /tmp does not make much sense (it can be a totally different filesystem), create a temp file directy in the user home directory.
* all: support swap feature on LinuxAleksandr Nogikh2023-06-151-0/+12
| | | | | If the feature is supported on the device, allocate a 128MB swap file after VM boot and activate it.
* pkg/host: check for /proc/self/ns/net presence in devlink PCIDmitry Vyukov2023-02-271-0/+4
| | | | | Initialize_devlink_pci in executor fails w/o /proc/self/ns/net. See https://groups.google.com/g/syzkaller/c/yJWM1_2DxUY
* executor: add NIC PCI pass-through VF supportGeorge Kennedy2022-09-211-0/+8
| | | | | | | | | | | | | | | 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-14/+48
| | | | | | | | | | | | | | | | | | | | 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.
* sys/linux: add ieee802154 descriptionsDmitry Vyukov2021-02-121-0/+8
|
* pkg/host: use unix.Utsname instead of syscall.UtsnameDmitry Vyukov2021-02-081-11/+6
| | | | | | syscall.Utsname is hard to use portably, see: https://github.com/google/syzkaller/pull/2418#issuecomment-774858512 Switch to unix.Utsname which does not have this problem.
* pkg/host: fix kcov_remote_arg layoutDmitry Vyukov2020-12-301-0/+1
| | | | | | kcov_remote_arg has padding on 32-bit arches. Account for it, otherwise kernel reads uninit garbage after the struct and the ioctl fails with EINVAL.
* pkg/host: make wifi check more preciseDmitry Vyukov2020-11-281-0/+47
| | | | | | | | | WiFi setup fails on 4.4 kernel with: 2020/11/28 12:22:49 BUG: program execution failed: executor 0: exit status 67 initialize_wifi_devices: failed to create device #0 (errno 19) There is at least HWSIM_ATTR_PERM_ADDR not support, but maybe something else. The setup seems to work at least on 4.17 where HWSIM_ATTR_PERM_ADDR was added. So require at least 4.17 for WiFi testing.
* all: integrate with mac80211_hwsimAleksandr Nogikh2020-09-221-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
* csource, executor: add usb emulation featureAndrey Konovalov2020-04-031-1/+2
| | | | | | | | | 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: rename some featuresDmitry Vyukov2019-11-161-7/+7
| | | | | Rename some features in preparation for subsequent changes which will align names across the code base.
* executor: refactor sandbox flagsDmitry Vyukov2019-11-161-2/+2
| | | | In preparation for future changes.
* pkg/host: split files into syscalls/featuresDmitry Vyukov2019-11-161-0/+212
pkg/host does 2 things: detects supported syscalls and supported features. There is enough code for each for a separate file.