aboutsummaryrefslogtreecommitdiffstats
path: root/executor/common_fuchsia.h
Commit message (Collapse)AuthorAgeFilesLines
* executor: fix driver.h import path in common_fuchsia.hMarco Vanotti2021-04-091-1/+1
| | | | The `driver.h` header moved from `ddk/driver.h` to `lib/ddk/driver.h`.
* pkg/report: detect executor failuresDmitry Vyukov2021-02-211-1/+2
| | | | | | | | | | | | 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: msvc support syz-executorSuraj K Suresh2020-10-031-3/+6
|
* executor: warn about C89-style var declarationsDmitry Vyukov2020-08-141-5/+2
| | | | | | | | | | | | | | | | | 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/fuchsia: Don't map memory as executable.Marco Vanotti2020-06-051-20/+15
| | | | | | | | | | | | | | | | | | | Fuchsia has strict controls over who can map memory as executable. Refactoring syz-executor to be able to do that involves a non trivial amount of work: it needs to run as a fuchsia component and replace stdin for some other mechanism to communicate with syz-fuzzer (probably a fidl service and a thin client that proxies stdin/stdout to syz-fuzzer via ssh). Mapping memory as executable doesn't seem to be used or needed in syz-executor at all. After talking with Dmitry, he mentioned that it was used in a deprecated feature: `syz_execute_func` which would execute random code. It also allows more scenarios during fuzzing. For now, I'm removing that option to allow syzkaller continue fuzzing. This change also refactors all of the error messages adding a string representation of the `zx_status_t` in error logs.
* sys/fuchsia: remove deprecated exception APIsDavid Pursell2019-11-141-37/+54
| | | | | | The port-based exception APIs have been deprecated on Fuchsia and will be removed shortly. Delete them from the syscall definitions and modify the Fuchsia executor to use the new channel-based APIs instead.
* executor/fuchsia: close vmo handle in syz_mmap.Marco Vanotti2019-09-121-0/+7
| | | | | | | | | | | | This commit fixes a handle leak in syz_mmap. The bug was pointed out by mdempsky during a code review. The `syz_mmap` function creates a VMO and maps it to a VMAR in the address specified by the `syz_mmap` parameters. Once a VMO is mapped to a vmar, the handle to the vmo can be closed without problems. The new code makes sure that `zx_handle_close(vmo_handle)` gets called before the `syz_mmap` function returns.
* executor/fuchsia: don't crash on syz_mmap failure.Marco Vanotti2019-09-111-3/+7
| | | | | | | | | | | | | | | | | syz_mmap is a pseudo-syscall that can be used by syzkaller in fuzzing programs, however, it is also used to setup the environment for syz-executor. syz-executor already checks the return value[0] when it is used for setting up the environment, so it doesn't make sense for the function to crash (most probably, in a fuzzing program it will be called with arguments that would make it fail). The previous behavior was causing a bunch of "Lost connection to test machine" syzkaller crashes which were meaningless. An example of a program in which syz_mmap would crash would be any program in which the handle to the root vmar is closed before calling syz_mmap. [0]: https://github.com/google/syzkaller/blob/a60cb4cd840ce786236a00480e8bb1025e0c5fef/executor/executor_fuchsia.h#L15
* sys/fuchsia: update zx_clock_get syscall (#1292)Marco Vanotti2019-07-161-1/+2
| | | | | | | | | | | | * sys/fuchsia: update zx_clock_get. zx_clock_get was deprecated and replaced by zx_clock_get_new. In a recent CL[0], they replaced the zx_clock_get by zx_clock_get_new and moved all client. This commit updates syzkaller to use the new function. [0]: https://fuchsia-review.googlesource.com/c/fuchsia/+/298575 * run make extract && make generate
* executor: don't fallthrough in switches in fuchsia (#1103)Marco Vanotti2019-04-031-0/+3
| | | | | | This commit modifies the common_fuchsia.h file changing the behavior of the `syz_future_time function`. Before, the function used to have a switch case that would fallthrough, making it always set the delta_ms to 10000. The fix is to add a `break;` statement after each switch case.
* executor: prevent non-null expected warningsDmitry Vyukov2019-03-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | 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: update fdio import pathMarco Vanotti2019-03-201-1/+1
| | | | | | | | | | | The Fuchsia team is going to remove the `lib/fdio/util.h` library. They have already moved all the functions to new header files. I have seen that fuchsia uses `fdio_service_connect`, which has been moved to the `lib/fdio/directory.h` header file. This commit just changes the import path in the fuchsia executor, and in the corresponding generated go file (I made that change by running `make generate`).
* executor: add newline in debug callDmitry Vyukov2019-02-271-1/+1
| | | | debug does not add newlines.
* executor: update syntax for making W+X fuchsia memoryJulia Hansbrough2019-02-271-1/+5
| | | | | | | Fuchsia recently changed such that zx_vmar_map can't be declared executable and writeable at the same time; use a new syscall for this purpose. Also made a few errors more informative.
* sys/fuchsia: update VMAR syscallsMarco Vanotti2018-11-211-3/+3
| | | | | | | | | | | | | | | | | | | | | | | * sys/fuchsia: update vmar syscalls. In a previous zircon commit[0], the vmar related syscalls (like `zx_vmar_map`, `zx_vmar_protect` and `zx_vmar_allocate`) changed the order of their parameters, making putting the flags parameter as the second parameter, and renaming it to "options". This commit modifies vmars.txt so that it reflects the latest state of the syscalls in zircon. I also modified the usage in `executor/common_fuchsia.h` I ran make extract, make generate and compiled syzkaller to test this change. [0]: https://fuchsia-review.googlesource.com/c/zircon/+/168060 * sys/fuchsia run make generate This commit is just the result of running make generate after its parent. This regenerates the definitions for the modified VMAR syscalls.
* executor: Fuchsia: Use zx_task_resume_from_exception()Scott Graham2018-10-101-2/+2
| | | | | zx_task_resume() is deprecated; switch to using zx_task_resume_from_exception() instead.
* executor: make sandboxes more modularDmitry Vyukov2018-09-171-6/+0
| | | | | | | | Currently we have a global fixed set of sandboxes, which makes it hard to add new OS-specific ones (all OSes need to updated to say that they don't support this sandbox). Let it each OS say what sandboxes it supports instead.
* RFC: android: Add support for untrusted_app sandboxing (#697)Zach Riggle2018-09-171-0/+1
| | | | | | | | | | | | | | | | | | | | | 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
* executor: fix gcc warnings in fuchsia generated codeDmitry Vyukov2018-08-191-7/+14
| | | | | | gcc complains about function declarations not being prototypes, signed/unsigned cast mismatch and casts between incompatible functions. Fix them.
* executor: remove unnecessary hooks on fuchsiaDmitry Vyukov2018-08-091-5/+0
| | | | These are not needed now.
* sys/fuchsia: add syscall description for binding channels to LauncherDokyung Song2018-08-081-0/+1
|
* pkg/csource: tidy generated codeDmitry Vyukov2018-07-271-0/+3
| | | | | | | | | | | 1. Remove unnecessary includes. 2. Remove thunk function in threaded mode. 3. Inline syscalls into main for the simplest case. 4. Define main in common.h rather than form with printfs. 5. Fix generation for repeat mode (we had 2 infinite loops: in main and in loop). 6. Remove unused functions (setup/reset_loop, setup/reset_test, sandbox_namespace, etc).
* executor: overhaulDmitry Vyukov2018-07-241-295/+59
| | | | | | | | | | | | | | | | | 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.
* executor: executor fix fuchsia buildDmitry Vyukov2018-07-071-0/+1
|
* executor: remove unnecessary parensDmitry Vyukov2018-07-051-1/+1
|
* executor: include more headers on fuchsiaDmitry Vyukov2018-06-301-0/+2
| | | | | Since we are taking address of functions in syscall table, we need all headers even if we don't use them directly.
* pkg/csource: don't use pthread_cond_timedwait for fuchsiaDmitry Vyukov2018-06-301-25/+8
| | | | We removed it in executor, do the same in csource.
* executor, pkg/ipc: support output over pipesDmitry Vyukov2018-06-291-1/+1
|
* pkg/csource: support fuchsiaDmitry Vyukov2018-06-291-8/+276
| | | | Lots of assorted heavylifting to support csource on fuchsia.
* executor: fix zx_port_wait useDmitry Vyukov2018-06-061-1/+1
| | | | The call signature has changed in zircon.
* fuchsia: Update syzkaller to build with current Fuchsia API. (#543)Julia Hansbrough2018-03-211-31/+17
| | | | | | | | | | | | | | | | | | | | | * fuchsia: Fix the `extractor` tool. The include path in Zircon has changed; updated syz-extract/fuchsia.go to include this, and re-ran extract to get updated *.const files. * fuchsia: Update syzkaller to build with current Fuchsia API. Fuchsia doesn't have a stable API right now, so alas, this will probably continue to change until that's nailed down. But, useful to get this up-to-date at least. Relevant notes: * zx_channel_call_finish and _retry aren't technically public; leave them out until we have a less-cludgy way to expose them * musl supports setjmp/longjmp but not _setjmp/_longjump * remove some unsupported syscalls * update the build invocation
* executor: introduce uint64/32/16/8 typesDmitry Vyukov2017-12-271-5/+5
| | | | | | | | | | | | | | | The "define uint64_t unsigned long long" were too good to work. With a different toolchain I am getting: cstdint:69:11: error: expected unqualified-id using ::uint64_t; ^ executor/common.h:34:18: note: expanded from macro 'uint64_t' Do it the proper way: introduce uint64/32/16/8 types and use them. pkg/csource then does s/uint64/uint64_t/ to not clutter code with additional typedefs.
* executor: fix build breakages due to doexitDmitry Vyukov2017-10-191-0/+5
| | | | | Some standard libraries contain "using ::exit;", which breaks with the current redefinition of exit.
* sys/fuchsia: more descriptionsDmitry Vyukov2017-10-161-0/+43
|
* executor: fix fuchsia syz_mmapDmitry Vyukov2017-10-161-7/+9
|
* executor: repair fuchsia nonfailing modeDmitry Vyukov2017-10-161-23/+66
|
* executor, pkg/ipc: unify ipc protocol between linux and other OSesDmitry Vyukov2017-10-161-1/+0
| | | | | | | | | | | | | | | | | We currently use more complex and functional protocol on linux, and a simple ad-hoc protocol on other OSes. This leads to code duplication in both ipc and executor. Linux supports coverage, shared memory communication and fork server, which would also be useful for most other OSes. Unify communication protocol and parametrize it by (1) use of shmem or only pipes, (2) use of fork server. This reduces duplication in ipc and executor and will allow to support the useful features for other OSes easily. Finally, this fixes akaros support as it currently uses syz-stress running on host (linux) and executor running on akaros.
* executor: automatically infer base of root vmarDmitry Vyukov2017-09-271-6/+10
|
* executor, sys/windows: initial windows supportDmitry Vyukov2017-09-251-0/+66
|
* sys/fuchsia: describe more syscallsDmitry Vyukov2017-09-251-0/+28
|
* all: more assorted fuchsia supportDmitry Vyukov2017-09-221-0/+51