aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Potapenko <glider@google.com>2025-11-18 11:40:02 +0100
committerAlexander Potapenko <glider@google.com>2025-11-19 08:59:40 +0000
commit3bf489934f218dfcb171b6db6db3ecce818971db (patch)
tree08dc0bf59f4dcf56ea688f20dc01c52fea5abd8e
parente5e08fbade9fe503f6dd211ecaf29510f1da05b6 (diff)
executor: sys/linux: renumber SYZOS API IDs
Now that we are using volatiles in guest_main(), there is no particular need to base the numbers on primes (this didn't work well with Clang anyway). Instead, group the commands logically and leave some space between the groups for future updates.
-rw-r--r--executor/common_kvm_amd64_syzos.h26
-rw-r--r--sys/linux/dev_kvm_amd64.txt21
2 files changed, 24 insertions, 23 deletions
diff --git a/executor/common_kvm_amd64_syzos.h b/executor/common_kvm_amd64_syzos.h
index 8a144758f..9f93af017 100644
--- a/executor/common_kvm_amd64_syzos.h
+++ b/executor/common_kvm_amd64_syzos.h
@@ -11,23 +11,23 @@
#include <linux/kvm.h>
#include <stdbool.h>
-// Compilers will eagerly try to transform the switch statement in guest_main()
-// into a jump table, unless the cases are sparse enough.
-// We use prime numbers multiplied by 10 to prevent this behavior.
+// There are no particular rules to assign numbers here, but changing them will
+// result in losing some existing reproducers. Therefore, we try to leave spaces
+// between unrelated IDs.
// Remember these constants must match those in sys/linux/dev_kvm_amd64.txt.
typedef enum {
SYZOS_API_UEXIT = 0,
SYZOS_API_CODE = 10,
- SYZOS_API_CPUID = 20,
- SYZOS_API_WRMSR = 30,
- SYZOS_API_RDMSR = 50,
- SYZOS_API_WR_CRN = 70,
- SYZOS_API_WR_DRN = 110,
- SYZOS_API_IN_DX = 130,
- SYZOS_API_OUT_DX = 170,
- SYZOS_API_SET_IRQ_HANDLER = 190,
- SYZOS_API_ENABLE_NESTED = 230,
- SYZOS_API_NESTED_CREATE_VM = 290,
+ SYZOS_API_CPUID = 100,
+ SYZOS_API_WRMSR = 101,
+ SYZOS_API_RDMSR = 102,
+ SYZOS_API_WR_CRN = 103,
+ SYZOS_API_WR_DRN = 104,
+ SYZOS_API_IN_DX = 105,
+ SYZOS_API_OUT_DX = 106,
+ SYZOS_API_SET_IRQ_HANDLER = 200,
+ SYZOS_API_ENABLE_NESTED = 300,
+ SYZOS_API_NESTED_CREATE_VM = 301,
SYZOS_API_STOP, // Must be the last one
} syzos_api_id;
diff --git a/sys/linux/dev_kvm_amd64.txt b/sys/linux/dev_kvm_amd64.txt
index 41cb46d84..9beb5cd27 100644
--- a/sys/linux/dev_kvm_amd64.txt
+++ b/sys/linux/dev_kvm_amd64.txt
@@ -96,19 +96,20 @@ syzos_api_set_irq_handler {
type syzos_api_vm_id int64[0:3]
+# IDs here must match those in executor/common_kvm_amd64_syzos.h.
syzos_api_call$x86 [
uexit syzos_api$x86[0, intptr]
code syzos_api$x86[10, syzos_api_code$x86]
- cpuid syzos_api$x86[20, syzos_api_cpuid]
- wrmsr syzos_api$x86[30, syzos_api_wrmsr]
- rdmsr syzos_api$x86[50, syzos_api_rdmsr]
- wr_crn syzos_api$x86[70, syzos_api_wr_crn]
- wr_drn syzos_api$x86[110, syzos_api_wr_drn]
- in_dx syzos_api$x86[130, syzos_api_in_dx]
- out_dx syzos_api$x86[170, syzos_api_out_dx]
- set_irq_handler syzos_api$x86[190, syzos_api_set_irq_handler]
- enable_nested syzos_api$x86[230, const[0, intptr]]
- nested_create_vm syzos_api$x86[230, syzos_api_vm_id]
+ cpuid syzos_api$x86[100, syzos_api_cpuid]
+ wrmsr syzos_api$x86[101, syzos_api_wrmsr]
+ rdmsr syzos_api$x86[102, syzos_api_rdmsr]
+ wr_crn syzos_api$x86[103, syzos_api_wr_crn]
+ wr_drn syzos_api$x86[104, syzos_api_wr_drn]
+ in_dx syzos_api$x86[105, syzos_api_in_dx]
+ out_dx syzos_api$x86[106, syzos_api_out_dx]
+ set_irq_handler syzos_api$x86[200, syzos_api_set_irq_handler]
+ enable_nested syzos_api$x86[300, const[0, intptr]]
+ nested_create_vm syzos_api$x86[301, syzos_api_vm_id]
] [varlen]
kvm_text_x86 [