diff options
| author | Alexander Potapenko <glider@google.com> | 2025-09-17 12:16:39 +0200 |
|---|---|---|
| committer | Alexander Potapenko <glider@google.com> | 2025-09-19 08:38:14 +0000 |
| commit | 2a4c6c0dbed891610b6d10f663c797e9e80d1981 (patch) | |
| tree | 505aabccf61b05e5199a782da517b51852596665 /executor/common_kvm.h | |
| parent | bc3f649c1cdcc44bee1e351e1326a9072393736a (diff) | |
executor: sys/linux/: pkg/runtest: pkg/vminfo: add syz_kvm_assert_syzos_kvm_exit
Implement a pseudo-syscall to check the value of kvm_run.exit_reason
Diffstat (limited to 'executor/common_kvm.h')
| -rw-r--r-- | executor/common_kvm.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/executor/common_kvm.h b/executor/common_kvm.h new file mode 100644 index 000000000..fecd00922 --- /dev/null +++ b/executor/common_kvm.h @@ -0,0 +1,25 @@ +// Copyright 2025 syzkaller project authors. All rights reserved. +// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. + +// This file is shared between executor and csource package. + +// Common KVM-related definitions. + +#if SYZ_EXECUTOR || __NR_syz_kvm_assert_syzos_kvm_exit +static long syz_kvm_assert_syzos_kvm_exit(volatile long a0, volatile long a1) +{ + struct kvm_run* run = (struct kvm_run*)a0; + uint64 expect = a1; + + if (!run) { + errno = EINVAL; + return -1; + } + + if (run->exit_reason != expect) { + errno = EDOM; + return -1; + } + return 0; +} +#endif |
