aboutsummaryrefslogtreecommitdiffstats
path: root/executor/common_bsd.h
Commit message (Collapse)AuthorAgeFilesLines
* executor: pull in errno.h on BSD systemsMark Johnston2025-02-261-0/+1
| | | | | The error handling for the setsid() call in sandbox_common() requires it. Without it, some csource builds fail.
* executor: avoid setsid() errorsMark Johnston2024-07-171-1/+1
| | | | | See commit bc144f9a58782daa2399d417b56aad80e82a219e. The justification applies to other BSDs as well, so apply the same workaround.
* executor: rework feature setupDmitry Vyukov2024-06-031-9/+14
| | | | | | | | | | | | | Return failure reason from setup functions rather than crash. This will provide better error messages, but also allow setup w/o creating subprocesses which will be needed when we combine fuzzer and executor. Also close all resources created during setup. This is also useful for in-process setup, but also should improve chances of reproducing a bug with C reproducer. Currently leaked file descriptors may disturb repro execution (e.g. it may act on a wrong fd).
* pkg/vminfo: move feature checking to hostDmitry Vyukov2024-05-151-0/+4
| | | | | | | | | | | | | | | | | 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
* executor: resolve pseudo syscall compilation problemsAleksandr Nogikh2023-05-041-1/+1
|
* executor: remove openbsd bits out of common_bsd.hGreg Steuck2023-04-271-47/+1
|
* sys/targets: switch openbsd to SyscallNumbers: falseGreg Steuck2023-04-271-2/+23
| | | | | This relies on sendsyslog in sys/syslog.h which will be in OpenBSD HEAD soon.
* all: create 8 tun devices for OpenBSDAleksandr Nogikh2022-01-141-2/+2
| | | | | Currently only 4 are created by default. This limits the maximum number of simultaneously running syz-executors.
* executor: bump on FreeBSD the maximum number of tun devices to 256 (#2956)Michael Tüxen2021-12-311-0/+5
| | | | | | | syz-execprog now uses twice the number of CPU cores as the number of processes. Each process might use a tun device. So bump the maximum number of tun devices to the maximum of 256, which allows syz-execprog to run with default settings on systems with up to 128 cores.
* executor: support larger maximum number of tun devices on *BSD (#2953)Michael Tüxen2021-12-301-9/+17
|
* executor: spread overlapping fdsAleksandr Nogikh2021-12-061-1/+1
| | | | | | | There's a chance that the methods from common_bsd.h and common_linux.h could dup2 (and thus close) an fd belonging to a kcov instance. Prevent this by adjusting fd consts.
* all: refactor fault injection into call propsAleksandr Nogikh2021-09-221-1/+1
| | | | | | | | | | | | Now that call properties mechanism is implemented, we can refactor fault injection. Unfortunately, it is impossible to remove all traces of the previous apprach. In reprolist and while performing syz-ci jobs, syzkaller still needs to parse the old format. Remove the old prog options-based approach whenever possible and replace it with the use of call properties.
* executor: add missing includes to BSD's setup_faultAleksandr Nogikh2021-09-221-0/+1
|
* executor: ifconfig destroy wants the interface (not device) name (#2739)Greg Steuck2021-09-021-1/+1
| | | | | | | | At least on OpenBSD this is the behavior: % doas ifconfig tun5 create % doas ifconfig tun5 destroy % doas ifconfig tun5 create % doas ifconfig /dev/tun5 destroy ifconfig: SIOCIFDESTROY: Invalid argument
* executor: initialize scope in fault_ioc_infoChuck Silvers2021-07-021-0/+1
| | | | | The "scope" field of struct fault_ioc_info is an input to the ioctl, so initialize it to FAULT_SCOPE_LWP to match other fault_ioc_* usage.
* executor: initial darwin supportPatrick Meyer2021-05-201-12/+14
|
* pkg/report: detect executor failuresDmitry Vyukov2021-02-211-9/+8
| | | | | | | | | | | | Currently all executor fail errors go into "lost connection" bucket. This is not very useful. First, there are different executor failures. Second, it's not possible to understand what failures happen how frequently. Third, there are not authentic lost connection. Create separate SYZFAIL: bugs for them. Update #573 Update #502 Update #318
* executor: skip setsid() for threaded reproducersAnton Lindqvist2020-12-091-2/+7
| | | | | | | | | | | | Lately, I've been looking into why such low amount of syz reproducers on OpenBSD are turned into C reproducers. One thing I did notice is that such syz reproducers have one thing in common: they use the threaded=true and sandbox=none parameters. Such C reproducer always exits non-zero early on since the call to setsid() fails with EPERM. Meaning, the calling process is already a process group leader. Not sure if the preprocessor conditional should be tweaked in order to avoid unwanted side effects on other BSDs or configurations.
* executor: check for \n in fail/exitf messagesDmitry Vyukov2020-09-281-2/+2
|
* executor: warn about C89-style var declarationsDmitry Vyukov2020-08-141-14/+7
| | | | | | | | | | | | | | | | | We generally use the newer C99 var declarations combined with initialization because: - declarations are more local, reduced scope - fewer lines of code - less potential for using uninit vars and other bugs However, we have some relic code from times when we did not understand if we need to stick with C89 or not. Also some external contributions that don't follow style around. Add a static check for C89-style declarations and fix existing precedents. Akaros toolchain uses -std=gnu89 (or something) and does not allow variable declarations inside of for init statement. And we can't switch it to -std=c99 because Akaros headers are C89 themselves. So in common.h we need to declare loop counters outside of for.
* executor: add some code style checksDmitry Vyukov2020-08-061-1/+1
| | | | | | | Move the test from pkg/csource to executor/ in order to be able to (1) run it on *.cc files, (2) run on unprocessed *.h files, (3) produce line numbers. Add a check for missed space after //.
* executor: remove block commentsDmitry Vyukov2020-08-041-2/+2
| | | | | | | | | 1. We don't generally use /* */ block comments, few precedents we have are inconsistent with the rest of the code. 2. pkg/csource does not strip them from the resulting code. Remove the cases we have and add a test to prevent new ones being added.
* executor: remove NONFAILING from pseudo-syscallsDmitry Vyukov2020-07-151-2/+2
| | | | | | This is not needed anymore afer the previous commit. Fixes #1918
* executor/netbsd: base nth on 2 (#1874)m00nbsd2020-06-271-2/+2
|
* sys/netbsd: support multiple vHCI buses (#1822)m00nbsd2020-06-131-2/+20
|
* sys/netbsd: add support for fault injection (#1817)m00nbsd2020-06-111-0/+49
|
* executor: fix a USB define on NetBSDm00nbsd2020-05-211-1/+3
|
* executor: use the SYZ_USB define for NetBSDm00nbsd2020-05-211-1/+1
|
* executor: add support for USB fuzzing on NetBSDm00nbsd2020-05-191-0/+11
|
* executor: rename some macrosDmitry Vyukov2019-11-161-7/+7
| | | | | Rename some macros in preparation for subsequent changes which will align names across the code base.
* pkg/csoruce: test that executor does not mis-spell any of the SYZ_* macrosDmitry Vyukov2019-11-161-5/+3
|
* executor: rename some flagsDmitry Vyukov2019-11-161-1/+1
| | | | | Rename some flags in preparation for subsequent changes which will align names across the code base.
* executor: remove pointless macro checksDmitry Vyukov2019-11-161-5/+2
| | | | | common_bsd.h is used for 3 OSes, so checking if it's any of these 3 OSes is pointless. Remove these checks.
* executer/common_bsd.h: increase the number of tap/tun devices for NetBSDR3x2019-08-081-0/+6
|
* executor: add network packet injection for NetBSDSiddharth M2019-07-141-6/+22
| | | | | | | | | | | | * Initial Commit * working build of network packet fuzzing * Add missed csource file * pkg/csource: fix build * executor/common_bsd.h: Add comment stating reason for ifconfig create
* executor: unbreak on OpenBSD at runtimeAnton Lindqvist2019-05-021-0/+4
| | | | | | | | Not using `elif GOOS_freebsd' since it could cause breakage on other *BSDs due to unused variables. Regression introduced in commit c7c3f772 (executor: improve setup for packet handling on *BSD).
* executor: improve setup for packet handling on *BSD (#1153)Michael Tüxen2019-05-011-1/+20
| | | | | | | | Improve the handling of packets by: * setting the local MAC address. * configuring the local IPv4 address with prefix /24. * adding an entry in the arp cache for the remote IPv4 address. * adding an entry in the IPv6 neighbour cache for the remote IPv6 address.
* executor: prevent non-null expected warningsDmitry Vyukov2019-03-211-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | The added test triggers warnings like these: <stdin>: In function ‘syz_mount_image.constprop’: <stdin>:298:3: error: argument 1 null where non-null expected [-Werror=nonnull] In file included from <stdin>:26:0: /usr/include/x86_64-linux-gnu/sys/stat.h:320:12: note: in a call to function ‘mkdir’ declared here extern int mkdir (const char *__path, __mode_t __mode) ^~~~~ cc1: all warnings being treated as errors <stdin>: In function ‘syz_open_procfs.constprop’: <stdin>:530:41: error: ‘%s’ directive argument is null [-Werror=format-truncation=] <stdin>:85:110: note: in definition of macro ‘NONFAILING’ <stdin>:532:41: error: ‘%s’ directive argument is null [-Werror=format-truncation=] <stdin>:85:110: note: in definition of macro ‘NONFAILING’ <stdin>:534:41: error: ‘%s’ directive argument is null [-Werror=format-truncation=] <stdin>:85:110: note: in definition of macro ‘NONFAILING’ Use volatile for all arguments of syz_ functions to prevent compiler from treating the arguments as constants in reproducers. Popped up during bisection that used a repro that previously worked. Update #501
* executor: adapt switching to user nobody to be more portable on BSDsKamil Rytarowski2019-01-141-5/+10
| | | | | | | | | NetBSD uses different uid/gid than FreeBSD/OpenBSD for the user nobody. Instead of hardcoding the values, retrieve it from the password entry database. While there, switch to setuid(2) and setgid(2) calls as they are good enough and portable. setresgid(2) and setresuid(2) aren't available on NetBSD.
* executor: do not call setrlimit(2) for RLIMIT_AS for NetBSDKamil Rytarowski2019-01-141-2/+4
| | | Setting the limit caused abnormal failure during early init on NetBSD.
* pkg/csource: support tun and setuid repros on {free,open}bsdGreg Steuck2018-12-131-1/+6
| | | | | | * expose procid on BSD for tun, always declare loop() * deal with terrible bsd includes * replicate loop() declaration
* executor: reapply setuid sandbox for bsdGreg Steuck2018-12-111-0/+74
| | | | | | | | | | * Revert "Revert "executor: add setuid sandbox for openbsd"" The problem is the low file descriptor limit. This reverts commit 4093e33b1338f274ae0062f555de9d6af8640d61. * executor/executor make sure the file descriptor limit is sufficient
* Revert "executor: add setuid sandbox for openbsd"Greg Steuck2018-12-101-74/+0
| | | | This reverts commit 6565f24da9f4eb36702339ba290213995fcc902f.
* executor: add setuid sandbox for openbsdGreg Steuck2018-12-101-0/+74
| | | | | | | | | | * executor/common_bsd: add setuid sandbox Fixes #833 cc @mptre * Reduced duplications, resolved TODO.
* pkg/csource: use defines from sys/syscall.h on *bsdGreg Steuck2018-12-021-0/+1
| | | Fixes #841
* executor: add support for tap interfaces on FreeBSDMichael Tüxen2018-12-011-2/+16
|
* openbsd: repair pkg/csource_testGreg Steuck2018-11-301-49/+44
|
* executor: Use correct macros.Michael Tuexen2018-11-301-1/+1
| | | | Suggested by Dmitry Vyukov.
* Whitespace change.Michael Tuexen2018-11-301-1/+0
|
* executor: Fix compilation on FreeBSDMichael Tuexen2018-11-301-5/+5
| | | | | Fix the compilation on FreeBSD when not supporting the tun interface.