diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2018-08-09 13:50:49 +0200 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2018-08-09 16:05:46 +0200 |
| commit | 922e8e27343704155b81f50ddd3316ec04c9d299 (patch) | |
| tree | ee5f2640775e336d923912c3249bac797dd33e05 /pkg | |
| parent | acf31536e9e570b2a5ee11a7818c96e4d177c808 (diff) | |
executor: mount binfmt_mist
We forgot to mount binfmt_misc. Mount it. Add a test.
Increase per-call timeout, otherwise last execve timesout.
Fix csource waiting for call completion at the end of program.
Diffstat (limited to 'pkg')
| -rw-r--r-- | pkg/csource/generated.go | 15 | ||||
| -rw-r--r-- | pkg/runtest/run.go | 13 |
2 files changed, 17 insertions, 11 deletions
diff --git a/pkg/csource/generated.go b/pkg/csource/generated.go index b9699c999..cd59914e3 100644 --- a/pkg/csource/generated.go +++ b/pkg/csource/generated.go @@ -2928,10 +2928,13 @@ static void setup_cgroups() } static void setup_binfmt_misc() { - if (!write_file("/proc/sys/fs/binfmt_misc/register", ":syz0:M:0:syz0::./file0:")) { + if (mount(0, "/proc/sys/fs/binfmt_misc", "binfmt_misc", 0, 0)) { + debug("mount(binfmt_misc) failed: %d\n", errno); + } + if (!write_file("/proc/sys/fs/binfmt_misc/register", ":syz0:M:0:\x01::./file0:")) { debug("write(/proc/sys/fs/binfmt_misc/register, syz0) failed: %d\n", errno); } - if (!write_file("/proc/sys/fs/binfmt_misc/register", ":syz1:M:1:yz1::./file0:POC")) { + if (!write_file("/proc/sys/fs/binfmt_misc/register", ":syz1:M:1:\x02::./file0:POC")) { debug("write(/proc/sys/fs/binfmt_misc/register, syz1) failed: %d\n", errno); } } @@ -3776,7 +3779,7 @@ static void loop() #if SYZ_TRACE printf("### start\n"); #endif - int call, thread; + int i, call, thread; #if SYZ_COLLIDE int collide = 0; again: @@ -3801,12 +3804,12 @@ again: if (collide && (call % 2) == 0) break; #endif - event_timedwait(&th->done, 25); - if (__atomic_load_n(&running, __ATOMIC_RELAXED)) - sleep_ms((call == [[NUM_CALLS]] - 1) ? 10 : 2); + event_timedwait(&th->done, 45); break; } } + for (i = 0; i < 100 && __atomic_load_n(&running, __ATOMIC_RELAXED); i++) + sleep_ms(1); #if SYZ_COLLIDE if (!collide) { collide = 1; diff --git a/pkg/runtest/run.go b/pkg/runtest/run.go index b2882595d..21724fb2c 100644 --- a/pkg/runtest/run.go +++ b/pkg/runtest/run.go @@ -232,11 +232,14 @@ func (ctx *Context) parseProg(filename string) (*prog.Prog, map[string]bool, []i } } errnos := map[string]int{ - "": 0, - "EPERM": 1, - "EBADF": 9, - "ENOMEM": 12, - "EINVAL": 22, + "": 0, + "EPERM": 1, + "ENOENT": 2, + "ENOEXEC": 8, + "EBADF": 9, + "ENOMEM": 12, + "EACCES": 13, + "EINVAL": 22, } info := make([]ipc.CallInfo, len(p.Calls)) for i, call := range p.Calls { |
