aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/host/features_linux.go
Commit message (Collapse)AuthorAgeFilesLines
* 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.