Skip to content

Commit c0fcc05

Browse files
executor: add test_syzos() for arm64
Make sure regressions in guest code validation are reported during testing rather than fuzzing.
1 parent eb80f4c commit c0fcc05

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

executor/test.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright 2017 syzkaller project authors. All rights reserved.
22
// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
33

4-
#if GOOS_linux && (GOARCH_amd64 | GOARCH_ppc64 | GOARCH_ppc64le)
4+
#if GOOS_linux && (GOARCH_amd64 || GOARCH_ppc64 || GOARCH_ppc64le || GOARCH_arm64)
55
#include "test_linux.h"
66
#endif
77

@@ -372,8 +372,11 @@ static struct {
372372
{"test_copyin", test_copyin},
373373
{"test_csum_inet", test_csum_inet},
374374
{"test_csum_inet_acc", test_csum_inet_acc},
375-
#if GOOS_linux && (GOARCH_amd64 || GOARCH_ppc64 || GOARCH_ppc64le)
375+
#if GOOS_linux && (GOARCH_amd64 || GOARCH_ppc64 || GOARCH_ppc64le || GOARCH_arm64)
376376
{"test_kvm", test_kvm},
377+
#endif
378+
#if GOOS_linux && GOARCH_arm64
379+
{"test_syzos", test_syzos},
377380
#endif
378381
{"test_cover_filter", test_cover_filter},
379382
{"test_glob", test_glob},

executor/test_linux.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,3 +304,19 @@ static int cpu_feature_enabled(uint32_t function, uint32_t eax_bits, uint32_t eb
304304
return 0;
305305
}
306306
#endif
307+
308+
#ifdef GOARCH_arm64
309+
static int test_syzos()
310+
{
311+
int mem_size = SYZ_PAGE_SIZE * 4;
312+
void* mem = mmap(0, mem_size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
313+
if (mem == MAP_FAILED) {
314+
printf("mmap failed (%d)\n", errno);
315+
return 1;
316+
}
317+
// Right now SyzOS testing just boils down to installing code into memory.
318+
install_syzos_code(mem, mem_size);
319+
munmap(mem, mem_size);
320+
return 0;
321+
}
322+
#endif

0 commit comments

Comments
 (0)