Commit Graph

65 Commits

Author SHA1 Message Date
Dmitry Vyukov
65a0d61939 pkg/host: don't fail if CONFIG_FAIL_FUTEX is not enabled
See #991 and added comments.

Fixes #991
2019-02-11 18:35:46 +01:00
Anton Lindqvist
badbbeee69 pkg/host: enable FeatureComparisons on OpenBSD 2019-01-21 11:23:19 +01:00
Michael Tuexen
fd37a550bb pkg/host: enable FeatureComparisons on FreeBSD
Same as https://github.com/google/syzkaller/pull/952, just for FreeBSD.
2019-01-20 16:26:56 +01:00
Andrey Konovalov
2cd76d2137 kcov: some fixes for extra coverage
Use PC tracing mode when detecting KCOV_REMOTE_ENABLE support in the kernel.

Also fix kcov_remote_handle_usb argument.
2019-01-17 16:06:59 +01:00
Andrey Konovalov
c2faf9b2d5 all: detect extra coverage support
Based on whether the kernel supports KCOV_REMOTE_ENABLE ioctl.
2019-01-16 19:19:53 +01:00
Andrew Donnellan
f4013aa972 pkg/host: Support extracting kallsyms on ppc64le
Add a regex for syscall symbol extraction on ppc64le. ppc64le doesn't have
any special arch prefix.

Signed-off-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
2019-01-15 16:45:20 +01:00
Andrey Konovalov
010ed08bc6 fuzzer: fix syscall detection
As pointed out my Mark Rutland, kallsyms entries have format of
__ia32_sys_${NAME} rather than __ia32_${NAME}. Fix the regexps.
2019-01-08 19:52:59 +01:00
Andrey Konovalov
baa5c8e247 fuzzer: speed up syscall support detection
Right now syz-fuzzer does a search through /proc/kallsyms for each syscall
to check whether it's supported. Do one search instead and save the results
to a map. This speeds up syscall detection ~60 times when testing arm64 kernel
on x86. Also add another search pattern for arm64 and add some logging.
2019-01-08 16:06:27 +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
Michael Tüxen
5a58167323 executor: add support for tap interfaces on FreeBSD 2018-12-01 10:22:39 +00:00
Greg Steuck
9bc2a903f0 openbsd: enable packet injection 2018-11-19 20:29:38 -08:00
Dmitry Vyukov
a9495352a0 pkg/host: improve KMEMLEAK detection
EBUSY is returned when KMEMLEAK is in fact turned off,
not when scanning is already turned off.
That can't be recovered.
So instead check that we can write to the file in the check
function and give useful diagnostics.
2018-10-10 15:38:06 +02:00
Dmitry Vyukov
7296c0747f pkg/host: improve KMEMLEAK support
Rewind kmemleak fd before reading it second time,
otherwise we will read truncated reports.

Auto-learn what leak reports we've already seen
and ignore them in future. This is required because
there are some false positives and some fire too frequently.
So now we will hit each leak only once per manager run,
but we still will try to reproduce them.
2018-09-28 14:57:20 +02:00
Zach Riggle
0eca949a6c RFC: android: Add support for untrusted_app sandboxing (#697)
executor: add support for android_untrusted_app sandbox

This adds a new sandbox type, 'android_untrusted_app', which restricts
syz-executor to the privileges which are available to third-party applications,
e.g. those installed from the Google Play store.

In particular, this uses the UID space reserved for applications (instead of
the 'setuid' sandbox, which uses the traditional 'nobody' user / 65534)
as well as a set of groups which the Android-specific kernels are aware of,
and finally ensures that the SELinux context is set appropriately.

Dependencies on libselinux are avoided by manually implementing the few
functions that are needed to change the context of the current process,
and arbitrary files.  The underlying mechanisms are relatively simple.

Fixes google/syzkaller#643

Test: make presubmit
Bug: http://b/112900774
2018-09-17 11:33:11 +02: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
Dmitry Vyukov
edb2f5f1e1 sys/linux: add ext4 ioctls and overlayfs
Update #533
2018-08-29 15:59:16 -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
bf3cf0c965 pkg/host: enable coverage on freebsd, disable on netbsd
I messed it up during refactoring.
It's freebsd that has coverage support.
2018-08-25 08:59:51 -07:00
Dmitry Vyukov
5cbdd9f444 gometalinter: strengthen gocyclo limit
Strengthen gocycle limit 35->24! Yay! No more jumbo functions!

Fixes #538
2018-08-02 16:57:32 +02:00
Dmitry Vyukov
c67a9331a4 gometalinter: clean up some errcheck warnings
Check some errors where relevant.
Unfortunately enabling errcheck does not look feasible, too many warnings.

Update #538
2018-08-02 16:57:31 +02:00
Dmitry Vyukov
4dcfea28eb pkg/host: support test OS
test OS parasitizeson other OSes just as akaros,
and there is nothing to detect as well.
So use the same stub for test as for akaros.
2018-07-27 10:22:23 +02:00
Dmitry Vyukov
92a4950507 pkg/host: add "network devices" feature
Linux executor sets up some network devices for testing,
detect when that's supported on the machine and don't
do it if it's not supported.
2018-07-13 12:46:32 +02:00
Dmitry Vyukov
95e7a88b97 sys/linux: implement fuse as normal syscalls
Remove syz_fuse* and implement them as normal syscalls.
We not have enough expressive power to form mount options.
2018-07-10 16:18:45 +02:00
Dmitry Vyukov
01e3571841 pkg/host: check that we can open files rather than that they exist
See issue #640 where /dev/net/tun is present, but open fails with ENODEV.
Check that we can actually open all these files.

Fixes #640
2018-07-10 13:44:59 +02:00
Dmitry Vyukov
0b95b8ec49 pkg/host: disable for akaros
akaros can't have own host version
because fuzzer does not run on akaros,
so just disable it all.
2018-07-06 20:18:05 +02:00
Dmitry Vyukov
c31f96a8c6 executor: rework fallback coverage
We have fallback coverage implmentation for freebsd.
1. It's broken after some recent changes.
2. We need it for fuchsia, windows, akaros, linux too.
3. It's painful to work with C code.

Move fallback coverage to ipc package,
fix it and provide for all OSes.
2018-06-22 16:40:45 +02:00
Dmitry Vyukov
095ef80678 pkg/host: fix race in test 2018-06-19 14:33:56 +02:00
Dmitry Vyukov
ed73f9c3aa pkg/host: more precise detection for syz_mount_image support 2018-06-18 19:45:50 +02:00
Dmitry Vyukov
af9f337ea6 pkg/host: support trial supported syscall detection
Detect supported syscall by directly executing them
if kallsyms is not present. This is required for gvisor testing.
2018-06-18 19:45:45 +02:00
Dmitry Vyukov
7bd97c6ff6 pkg/host: better detection of supported sockets
Check socketpair.
Check non-constant socket types.
2018-06-18 19:45:45 +02:00
Dmitry Vyukov
27c5f59f50 all: fix gometalinter warnings 2018-06-12 20:10:58 +02:00
Dmitry Vyukov
06ece2ca66 pkg/host: rework host feature detection/setup
Currently host feature detection/setup code is spread
across platform-independent fuzzer code, pkg/host, pkg/ipc
and executor.
Move this all into pkg/host and show readable info
about features on manager start.

Fixes #46
2018-06-12 14:53:22 +02:00
Dmitry Vyukov
08141db61a gometalinter: enable line length checking
120 columns looks like a reasonable limit
and requires few changes to existing code.

Update #538
2018-05-04 14:24:51 +02:00
Dmitry Vyukov
6e2ce6613b pkg/host: fix syz_mount_image detection
Only init admin can mount filesystems with images.
2018-04-29 18:45:45 +02:00
Dmitry Vyukov
3c7caf1d6e pkg/host: enable more fault injection 2018-04-27 15:43:29 +02:00
Dmitry Vyukov
81daaca980 pkg/host: fix kallsyms names again
Some x86 syscalls now seem to be __x64_ and __ia32_ instead of sys_ or ksys_.
2018-04-19 16:58:24 +02:00
Dmitry Vyukov
829f023456 pkg/host: fix kallsyms check
Recent kernel changes to not call syscalls directly from kernel code
renamed syscall symbols from sys_foo to ksys_foo.
Support both formats.
2018-04-18 16:30:13 +02:00
Dmitry Vyukov
77bd5117c3 pkg/host: refactor code
Fix warnings pointed out by gometalinter.
2018-04-08 13:38:07 +02:00
Dmitry Vyukov
2a9c3edcda pkg/prog: explain why syscalls are transitively disabled 2018-04-06 19:43:06 +02:00
Dmitry Vyukov
4daf8570eb pkg/host: explain why syscalls are disabled 2018-04-06 18:47:56 +02:00
Dmitry Vyukov
99e3b0a7e8 sys/linux: add support for reading partition tables 2018-04-01 18:29:56 +02:00
Dmitry Vyukov
7c923cf8d4 sys/linux: add support for mounting filesystem images 2018-03-30 19:51:27 +02:00
Dmitry Vyukov
2675f92065 sys/linux: add cgroup descriptions 2018-03-25 12:46:05 +02:00
Dmitry Vyukov
7c62f71804 sys/linux: add netlink fou descriptions 2018-03-21 12:18:36 +01:00
Dmitry Vyukov
36d1c4540a all: fix gometalinter warnings
Fix typos, non-canonical code, remove dead code, etc.
2018-03-08 18:48:26 +01:00
Dmitry Vyukov
42467f5b7b sys/linux: add syz_init_net_socket syscall
The new pseudo syscall allows opening sockets that can only
be created in init net namespace (BLUETOOTH, NFC, LLC).
Use it to open these sockets.

Unfortunately this only works with sandbox none at the moment.
The problem is that setns of a network namespace requires CAP_SYS_ADMIN
in the target namespace, and we've lost all privs in the init namespace
during creation of a user namespace.
2018-03-05 12:10:27 +01:00
Dmitry Vyukov
019cf5f235 sys: move test syscalls to a separate target
We have them in linux solely for historical reasons.

Fixes #462
2017-12-17 11:39:14 +01:00
Dmitry Vyukov
8257de047b sys/linux: open files from /proc 2017-11-27 09:08:59 +01:00