aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Potapenko <glider@google.com>2024-07-29 15:15:09 +0200
committerAlexander Potapenko <glider@google.com>2024-07-29 15:29:47 +0000
commita4e01e1e70da6b4954a12cae3495f7d754f4b1da (patch)
treeee9d07d1e153ffcc832cb8f454975b6661bbf228
parente3d92500d33aba2aa8289656b0ad937cf484d6bc (diff)
sys/linux/test: add basic test for syz_kvm_setup_cpu$arm64
This is the initial test to help seed syzos program generation. We'll need to add assertions to it once we implement them.
-rw-r--r--sys/linux/test/syz_kvm_setup_cpu_arm6422
1 files changed, 22 insertions, 0 deletions
diff --git a/sys/linux/test/syz_kvm_setup_cpu_arm64 b/sys/linux/test/syz_kvm_setup_cpu_arm64
new file mode 100644
index 000000000..02f8c07f4
--- /dev/null
+++ b/sys/linux/test/syz_kvm_setup_cpu_arm64
@@ -0,0 +1,22 @@
+#
+# requires: arch=arm64
+#
+r0 = openat$kvm(0, &AUTO='/dev/kvm\x00', 0x0, 0x0)
+r1 = ioctl$KVM_CREATE_VM(r0, 0xae01, 0x0)
+r2 = ioctl$KVM_CREATE_VCPU(r1, 0xae41, 0x0)
+r3 = ioctl$KVM_GET_VCPU_MMAP_SIZE(r0, 0xae04)
+r4 = mmap$KVM_VCPU(&(0x7f0000009000/0x1000)=nil, r3, 0x3, 0x1, r2, 0x0)
+# Perform two uexits. The first one is done via a code blob:
+# d2802000 mov x0, #0x100 // #256
+# f2bbbba0 movk x0, #0xdddd, lsl #16
+# f900001f str xzr, [x0]
+# , which assumes registers x24-28 are zeroes.
+# The second uexit is done via a syzos API command that sets uexit exit code to 0xaaaa.
+#
+syz_kvm_setup_cpu$arm64(r1, r2, &(0x7f0000e8a000/0x18000), &AUTO=[{0x0, &AUTO=[@code={0x1, 0x20, "002080d2a0bbbbf21f0000f9", 0xd65f03c0}, @uexit={0x0, 0x18, 0xaaaa}], 0x38}], 0x1, 0x0, 0x0, 0x0)
+# Run till the first uexit.
+#
+ioctl$KVM_RUN(r2, 0xae80, 0x0)
+# Run till the second uexit.
+#
+ioctl$KVM_RUN(r2, 0xae80, 0x0)