Commit Graph

18 Commits

Author SHA1 Message Date
Michael Tuexen
a2af97ddf7 executor: Fix FreeBSD such all platforms use same number of entries
FreeBSD sets the kcov buffer as number of bytes instead of number
of entries. This also fixes the mmap() call, which was failing
due to inconsistent sizes. The failing was hidden due to wrong
error handling.
2018-12-29 19:17:28 +01:00
Michael Tuexen
e8f58194c1 executor: fix error handling of mmap()
mmap() returns MAP_FAILED, which is (void *)(-1), in case
of an error. This is different from NULL.
2018-12-29 19:17:28 +01:00
Michael Tuexen
8d43fb9c5e executor: add clarifying comment for FreeBSD. 2018-12-29 19:17:28 +01:00
Michael Tuexen
e0cd1d2e84 executor: add a clarifying comment 2018-12-29 19:17:28 +01:00
Michael Tuexen
6aef08ce12 executor: use function argument instead of global variable. 2018-12-29 19:17:28 +01:00
Michael Tuexen
4898a4328e executor: improve kcov compatibility with upcoming support
Get ioctl() definitions and usage in sync with the upcoming support
reviewed in https://reviews.freebsd.org/D14599.
2018-12-28 13:34:33 +01:00
Anton Lindqvist
fc6ae81a34 executor: KIOENABLE accepts a mode argument on OpenBSD 2018-12-28 08:25:37 +01:00
Anton Lindqvist
43cf01dd41 executor: include sys/kcov.h on OpenBSD
Since we no longer cross-compile, there's no need to repeat the defines.
2018-12-27 11:06:03 +01:00
Dmitry Vyukov
7624ddd6d8 executor: move setrlimit from setup_control_pipes to bsd os_init
This broke fuchsia build. We need setrlimit only for bsd.
2018-12-14 12:13:14 +01:00
Greg Steuck
d90f8af59c executor: reapply setuid sandbox for bsd
* Revert "Revert "executor: add setuid sandbox for openbsd""

The problem is the low file descriptor limit.

This reverts commit 4093e33b13.

* executor/executor make sure the file descriptor limit is sufficient
2018-12-11 07:39:44 +01:00
Greg Steuck
4093e33b13 Revert "executor: add setuid sandbox for openbsd"
This reverts commit 6565f24da9.
2018-12-10 20:09:24 +01:00
Greg Steuck
6565f24da9 executor: add setuid sandbox for openbsd
* executor/common_bsd: add setuid sandbox

Fixes #833

cc @mptre

* Reduced duplications, resolved TODO.
2018-12-10 11:20:16 +01:00
Greg Steuck
d8988561c0 openbsd: repair pkg/csource_test 2018-11-30 19:55:51 +00:00
Anton Lindqvist
19cfcead69 executor: OpenBSD does not allow write and exec mappings by default
Since the OpenBSD target does not make use of syz_execute_func yet, just drop
PROT_EXEC for now.

Supporting write and exec would require one to edit /etc/fstab during
installation.

Regression introduced in commit a4718693 ("sys/linux: add syz_execute_func").
2018-08-31 15:04:17 -07:00
Dmitry Vyukov
a4718693a3 sys/linux: add syz_execute_func
The function executes random code.

Update #310
2018-08-30 21:45:04 -07:00
Anton Lindqvist
b771b17ec9 Add mandatory OpenBSD bits (#689)
all: add openbsd support

squash of the following commits:

* openbsd: add mandatory bits
* report: add OpenBSD support
* executor: skip building kvm on OpenBSD
* executor: add OpenBSD support
Linking against libutil is necessary due to usage of openpty(3).
* executor: fix typo in fail() message
* fixup! report: add OpenBSD support
* fixup! openbsd: add mandatory bits
* fixup! openbsd: add mandatory bits
* fixup! openbsd: add mandatory bits
* fixup! report: add OpenBSD support
* gometalinter: skip sys/openbsd
2018-08-28 10:07:26 -07:00
Dmitry Vyukov
9a791c3992 executor: remap cover fd's to higher values
Remap cover fd's to 24x range to prevent interference
with fd's used during fuzzing and also to make
fd number consistent with/without cover enabled.
2018-08-08 12:48:06 +02:00
Dmitry Vyukov
9fe4bdc5f1 executor: overhaul
Make as much code as possible shared between all OSes.
In particular main is now common across all OSes.
Make more code shared between executor and csource
(in particular, loop function and threaded execution logic).
Also make loop and threaded logic shared across all OSes.
Make more posix/unix code shared across OSes
(e.g. signal handling, pthread creation, etc).
Plus other changes along similar lines.
Also support test OS in executor (based on portable posix)
and add 4 arches that cover all execution modes
(fork server/no fork server, shmem/no shmem).

This change paves way for testing of executor code
and allows to preserve consistency across OSes and executor/csource.
2018-07-24 12:04:27 +02:00