Commit Graph

93 Commits

Author SHA1 Message Date
Dmitry Vyukov
fcf6db1996 sys: remove autogenerated files
They were necessary when they were the source of constant values
extracted from kernel code (hard to do). Now constants are checked-in
separately, and these large files can be easily regenerated with 'make generate'.
Now they are only a source of large uninteresting diffs in commits.
Remove them.
2016-09-02 18:57:29 +02:00
Dmitry Vyukov
8278953eb4 csource: teach how to execute pseudo syz_ syscalls
Update #59
2016-08-28 16:33:32 +02:00
Dmitry Vyukov
9b91ede860 executor, csource: share some common code between executor and csource 2016-08-28 14:59:48 +02:00
Dmitry Vyukov
0d0fbbe73f overhaul syscall description generation process
This splits generation process into two phases:
1. Extract values of constants from linux kernel sources.
2. Generate Go code.

Constant values are checked in.
The advantage is that the second phase is now completely independent
from linux source files, kernel version, presence of headers for
particular drivers, etc. This allows to change what Go code we generate
any time without access to all kernel headers (which in future won't be
limited to only upstream headers).

Constant extraction process does require proper kernel sources,
but this can be done only once by the person who added the driver
and has access to the required sources. Then the constant values
are checked in for others to use.
Consant extraction process is per-file/per-arch. That is,
if I am adding a driver that is not present upstream and that
works only on a single arch, I will check in constants only for
that driver and for that arch.
2016-08-26 07:09:25 +02:00
Dmitry Vyukov
34120ddc6e executor: add experimental mode to skip paging faults
Ignore SIGSEGV/SIGBUS during copyin/copyout of arguments.
The memory may not be addressable. The ignoring allows to
pass partially-addressable input data to kernel.
It's unclear if it's a good idea or not yet.
2016-08-22 17:50:49 -07:00
Dmitry Vyukov
4782c2b8e6 executor: revive setuid sandbox
The new namespace-based sanboxing is good,
but it's not always what one wants
(and also requires special kernel configs).

Change dropprivs config value to sandbox,
which can have different values (currently: none, setuid, namespace).
Setuid mode uses setuid(nobody) before fuzzing as before.

In future we can add more sandboxing modes or, say,
extend -sandbox=setuid to -sandbox=setuid:johndoe
to impersonolate into given user.
2016-07-01 22:26:33 +02:00
Dmitry Vyukov
32061a606f executor: add support for 386 arch (COMPAT syscalls)
This is not fully working now: e.g. prog and sys packages assume
that pointer size is 8. But at least it compiles and works.
2016-06-30 20:11:04 +02:00
Dmitry Vyukov
2ce72987a6 executor: don't consider failures to remove temp dirs as crashes
There is a number of known, low-frequency reasons for failures in remove_dir.
Make the failures non-fatal.

Fixes #45
2016-06-28 13:47:50 +02:00
Dmitry Vyukov
da7529ea51 sys: update generated files 2016-06-13 12:50:32 +02:00
Dmitry Vyukov
259b4724c9 executor: prevent test processes from ptracing parent processes 2016-03-10 19:12:23 +01:00
Dmitry Vyukov
764449a269 executor: ignore NOFILE errors during cleanup
This is a common source of false positives.
2016-03-10 17:47:13 +01:00
Dmitry Vyukov
4b4dc9d1f3 executor: ignore the case when test process kills loop process
This lead to lots of false positives.
2016-03-10 17:47:13 +01:00
Dmitry Vyukov
f419fc90dd executor: make loop killing non-fatal 2016-03-10 17:47:13 +01:00
Dmitry Vyukov
b21bafb97d sys: fix /dev/snd/pcm description 2016-02-05 22:12:15 +01:00
Dmitry Vyukov
4997f546d2 ipc: give executor some time to startup
Namespace-based sandbox can take some time to setup.
In particular, lots of parallel executors block on net
namespace creation.
2016-01-27 14:44:15 +01:00
Dmitry Vyukov
66b440bd17 sys: regenerate after tun/random support 2016-01-26 16:53:23 +01:00
Dmitry Vyukov
efe43dc071 sys: open a bunch of new devices 2016-01-26 16:48:37 +01:00
Dmitry Vyukov
b5f1cae8dd sysgen: use __ppc64__ || __PPC64__ || __powerpc64__ to detect ppc
Different macros are defined by different compilers...
2016-01-25 11:06:30 +01:00
Dmitry Vyukov
0d4b201150 sys: allow to open all devices as stopgap 2016-01-24 20:28:38 +01:00
Dmitry Vyukov
f5311fac95 sys: add basic netlink support for real 2016-01-23 21:27:57 +01:00
Dmitry Vyukov
0a98e8c14a executor: restore nodropprivs mode 2016-01-23 00:04:34 +01:00
Dmitry Vyukov
81438c4ddd sys: use kernel headers instead of host headers
This solves several problems:
 - host usually have outdates headers, so previously we need to define missing consts
 - host may not have some headers at all
 - generation depends on linux distribution and version
 - some of the consts cannot be defined at all (e.g. ioctls that use struct arguments)
2016-01-22 21:18:33 +01:00
Dmitry Vyukov
1e06d2bafc executor: new namespace-based sandbox 2016-01-22 18:09:32 +01:00
Dmitry Vyukov
8cff5843fb vm/adb: use a more reliable way to reboot devices 2016-01-20 13:58:57 +01:00
Dmitry Vyukov
aa1b7fe3a8 executor: start moving sandboxing code into executor 2016-01-20 13:49:06 +01:00
Dmitry Vyukov
d5c2595f05 executor: adopt for new kcov
Now kcov exposes only uintptr-sized PCs.
2016-01-19 15:08:11 +01:00
Dmitry Vyukov
9c277c7974 sys: describe more dri syscalls 2016-01-16 00:23:47 +01:00
Dmitry Vyukov
81dc7f8dc8 sys: support /dev/input/event ioctls 2016-01-15 20:16:02 +01:00
Dmitry Vyukov
a670fa2035 executor: reportat after clang-format bug fix
http://reviews.llvm.org/rL257763
2016-01-15 10:33:27 +01:00
Dmitry Vyukov
b217dcb509 sys: support /dev/input/{mouse,mice,event} 2016-01-13 20:45:35 +01:00
Dmitry Vyukov
d399ab9dc9 executor: don't create all threads when spot a root syscall 2016-01-13 20:44:05 +01:00
Dmitry Vyukov
9e2ea41475 executor: don't print all waitpid debug messages 2016-01-13 19:26:51 +01:00
Dmitry Vyukov
a92b8c76c3 sys: introduce a generic syz_open_dev helper syscall 2016-01-13 18:57:12 +01:00
Dmitry Vyukov
91630fe39d sys: add support for /dev/snd/control 2016-01-13 16:54:29 +01:00
Dmitry Vyukov
bca57831a5 sys: add support for /dev/snd/timer 2016-01-12 20:14:56 +01:00
Dmitry Vyukov
15128d47bd sys: support /dev/snd/seq 2016-01-11 22:26:09 +01:00
Dmitry Vyukov
46fa57f3b4 executor: use mknodat instead of mknod (the latter is not implemented on android) 2016-01-11 17:30:08 +01:00
Dmitry Vyukov
bb47c6540d sys: add kvm support 2016-01-08 22:41:36 +01:00
Dmitry Vyukov
33950d306a executor: fix some bugs found by clang 2015-12-31 17:52:26 +01:00
Dmitry Vyukov
28b3d1e1ab sys: add sctp support 2015-12-30 13:04:00 +01:00
Dmitry Vyukov
e6529b30ec sys: add union type 2015-12-29 15:00:57 +01:00
Dmitry Vyukov
b17c5726f6 sys: support for AF_UNIX sockets 2015-12-28 19:11:03 +01:00
Dmitry Vyukov
bd768c8f40 sys: move more subsystems into separate files 2015-12-28 16:11:15 +01:00
Dmitry Vyukov
eef80b3d76 sys: split syscall description into several files 2015-12-28 15:53:32 +01:00
Dmitry Vyukov
4d3db6d4c8 host: detect unsupported syscalls
Also detect transitively unsupported syscalls,
that is, syscalls for which all syscalls that can create
input arguments are disabled.
2015-12-27 12:20:00 +01:00
Dmitry Vyukov
524a2ae38f sysgen: fix syscall number assignment for syzkalls 2015-12-24 21:27:21 +01:00
Dmitry Vyukov
a9a7744776 executor: get rid of sigtimedwait
Wait with spin loop instead.
See the comment for explanation.
2015-12-24 20:29:48 +01:00
Dmitry Vyukov
d9b493f203 executor: don't use WUNTRACED in wait
WUNTRACED wait returns when child has stopped.
That's not what we want to wait for.
If it's stopped we need to timeout wait and kill
the stopped child.
2015-12-24 19:14:15 +01:00
Dmitry Vyukov
af4e0c0b7a sysgen: pull in syscall numbers from kernel headers
Syscall numbers for different architectures are now pulled in
from kernel headers. This solves 2 problems:
 - we don't need to hardcode numbers for new syscalls (that don't present in typical distro headers)
 - we have correct number for different archs (previously hardcoded numbers were for x86_64)
This also makes syscall numbers available for Go code, which can be useful.
2015-12-24 19:13:08 +01:00
Dmitry Vyukov
58509c75a2 prog: remove padding checking
So far it has found only false positives.
Let's leave this to KMSAN.
2015-12-23 19:58:15 +01:00