aboutsummaryrefslogtreecommitdiffstats
path: root/executor/test_linux.h
diff options
context:
space:
mode:
authorAlexander Potapenko <glider@google.com>2024-12-05 11:21:48 +0100
committerAlexander Potapenko <glider@google.com>2024-12-05 10:57:12 +0000
commit31e83944d0a78e544fe45fb61f21f929607d08e3 (patch)
treed78b57535060b8c2250394733e09c832625255e9 /executor/test_linux.h
parent3255c6513f118900b5c41e9cf7a93c09118e2a29 (diff)
executor: add test_syzos() for arm64
Make sure regressions in guest code validation are reported during testing rather than fuzzing.
Diffstat (limited to 'executor/test_linux.h')
-rw-r--r--executor/test_linux.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/executor/test_linux.h b/executor/test_linux.h
index 8c9493539..6d36d201e 100644
--- a/executor/test_linux.h
+++ b/executor/test_linux.h
@@ -304,3 +304,19 @@ static int cpu_feature_enabled(uint32_t function, uint32_t eax_bits, uint32_t eb
return 0;
}
#endif
+
+#ifdef GOARCH_arm64
+static int test_syzos()
+{
+ int mem_size = SYZ_PAGE_SIZE * 4;
+ void* mem = mmap(0, mem_size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
+ if (mem == MAP_FAILED) {
+ printf("mmap failed (%d)\n", errno);
+ return 1;
+ }
+ // Right now SyzOS testing just boils down to installing code into memory.
+ install_syzos_code(mem, mem_size);
+ munmap(mem, mem_size);
+ return 0;
+}
+#endif