syzkaller/executor
Anton Lindqvist ce441f065b executor: improve opendir(3) error handling
While investigating an OpenBSD reproducer[1][2] I discovered the
following:

* All threads are stuck on the last `sleep(1000000)` syscall in main(),
  hence no output for the test machine.

* Each executor process created in loop() performs one iteration but
  exits abnormally during the call to remove_dir().

* Calling remove_dir() will eventually invoke itself recursively since
  one of the executed syscall is `mkdir("./file0", 0)` meaning that it
  will try to remove the directory created by execute_one(). However,
  `opendir(3)` fails with `EACCES` due to the permissions passed to
  `mkdir(2)` is zero.

Instead of exiting, trying to remove the problematic directory in a best
effort manner makes the reproducer continue executing the generated
syscalls. This work around might be considered to narrow. Another option
would be to replace the `sleep(1000000)` with `waitpid(-1, NULL, 0)`
until ECHILD is hit.

[1] https://syzkaller.appspot.com/bug?id=6f7ce2a0536580a94f65f44e478732ec505e88af
[2] https://syzkaller.appspot.com/text?tag=ReproC&x=10fd1a71900000
2020-09-12 13:21:21 +02:00
..
android executor: minor cleanup of android sandbox 2020-03-11 12:09:17 +01:00
common_akaros.h executor: fix do_sandbox_none on akaros and test 2019-01-31 11:35:53 +01:00
common_bsd.h executor: warn about C89-style var declarations 2020-08-14 09:40:08 +02:00
common_fuchsia.h executor: warn about C89-style var declarations 2020-08-14 09:40:08 +02:00
common_kvm_amd64.h executor: warn about C89-style var declarations 2020-08-14 09:40:08 +02:00
common_kvm_arm64.h executor: warn about C89-style var declarations 2020-08-14 09:40:08 +02:00
common_linux.h executor/common_linux.h: add missing FUSE opcodes 2020-08-27 07:47:59 +02:00
common_test.h sys/test/test: add a hanging test 2020-09-12 13:03:27 +02:00
common_usb_linux.h executor: warn about C89-style var declarations 2020-08-14 09:40:08 +02:00
common_usb_netbsd.h executor: warn about C89-style var declarations 2020-08-14 09:40:08 +02:00
common_usb.h executor: warn about C89-style var declarations 2020-08-14 09:40:08 +02:00
common_windows.h executor: fix do_sandbox_none on akaros and test 2019-01-31 11:35:53 +01:00
common.h executor: improve opendir(3) error handling 2020-09-12 13:21:21 +02:00
executor_akaros.h executor: change syscall argument type to intptr_t 2019-05-07 08:48:35 +02:00
executor_bsd.h executor: warn about C89-style var declarations 2020-08-14 09:40:08 +02:00
executor_fuchsia.h executor/fuchsia: Don't map memory as executable. 2020-06-05 16:46:48 -03:00
executor_linux.h executor: detect gvisor 2020-09-12 13:03:35 +02:00
executor_test.h executor: change syscall argument type to intptr_t 2019-05-07 08:48:35 +02:00
executor_windows.h executor: change syscall argument type to intptr_t 2019-05-07 08:48:35 +02:00
executor.cc sys/test/test: add a hanging test 2020-09-12 13:03:27 +02:00
gen.go executor: enable KVM generator only on AMD64 arch 2020-06-17 17:43:56 +02:00
kvm_gen.cc Makefile: enable clang-tidy in presubmit tests 2020-08-04 16:54:02 +02:00
kvm.h sys: improve kvm description 2017-01-28 19:58:31 +01:00
kvm.S executor: remove unused kvm_asm64_vm86 2019-01-17 10:52:20 +01:00
kvm.S.h all: fix marking of auto-generated files 2020-07-29 13:36:11 +02:00
nocover.h executor: Protect the coverage buffer 2019-06-04 16:24:36 +02:00
stub.go .golangci.yml: enable godot checker 2020-06-05 12:23:19 +02:00
style_test.go executor: warn about C89-style var declarations 2020-08-14 09:40:08 +02:00
test_linux.h executor: add some code style checks 2020-08-06 15:27:41 +02:00
test.h executor: warn about C89-style var declarations 2020-08-14 09:40:08 +02:00