diff options
| author | Alexander Potapenko <glider@google.com> | 2025-11-21 12:38:35 +0100 |
|---|---|---|
| committer | Alexander Potapenko <glider@google.com> | 2025-11-21 13:50:47 +0000 |
| commit | accb0c33653744b8f36fdfea18d4d5888188b2fb (patch) | |
| tree | 618cfada1bfeba4c099a567b43792a73b19b1f0c /sys/linux/dev_kvm_amd64.txt | |
| parent | c31c1b0b7447502cdda234f0f43ab793644ffe83 (diff) | |
executor: sys/linux: implement SYZOS_API_NESTED_INTEL_VMWRITE_MASK
The new command allows mutation of Intel VMCS fields with the help
of vmwrite instruction.
In addition to VM ID and field ID, @nested_intel_vmwrite_mask takes
three 64-bit numbers: the set mask, the unset mask, and the flip mask.
This allows to make bitwise modifications to VMCS without disturbing
the execution too much.
Also add sys/linux/test/amd64-syz_kvm_nested_vmwrite_mask to test the
new command behavior.
Diffstat (limited to 'sys/linux/dev_kvm_amd64.txt')
| -rw-r--r-- | sys/linux/dev_kvm_amd64.txt | 61 |
1 files changed, 46 insertions, 15 deletions
diff --git a/sys/linux/dev_kvm_amd64.txt b/sys/linux/dev_kvm_amd64.txt index d3dac2cf9..29dab16e4 100644 --- a/sys/linux/dev_kvm_amd64.txt +++ b/sys/linux/dev_kvm_amd64.txt @@ -101,23 +101,54 @@ syzos_api_nested_load_code { insns text[x86_64] } [packed] +# VMCS Component Encoding is a 32-bit value, but only bits 0:15 are used. +# Certain bit combinations are invalid, because the number encodes additional +# parameters like access type and width. +# Constants as per Intel SDM vol. 3C, Appendix B. +vmcs_field_encoding [ + control16 int64[0x0:0x4, 2] + guest16 int64[0x800:0x812, 2] + host16 int64[0xc00:0xc0c, 2] + control64 int64[0x2000:0x2033] + ro64 int64[0x2400:0x2401] + guest64 int64[0x2800:0x2813] + host64 int64[0x2c00:0x2c05] + control32 int64[0x4000:0x4022, 2] + ro32 int64[0x4400:0x440e, 2] + guest32 int64[0x4800:0x482e, 2] + host32 int64[0x4c00:0x4c00] + control_nat int64[0x6000:0x600e, 2] + ro_nat int64[0x6400:0x640a, 2] + guest_nat int64[0x6800:0x6826, 2] + host_nat int64[0x6c00:0x6c16, 2] +] + +syzos_api_nested_intel_vmwrite_mask { + vm_id syzos_api_vm_id + field vmcs_field_encoding + set_mask int64 + unset_mask int64 + flip_mask int64 +} + # 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[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] - nested_load_code syzos_api$x86[302, syzos_api_nested_load_code] - nested_vmlaunch syzos_api$x86[303, syzos_api_vm_id] - nested_vmresume syzos_api$x86[304, syzos_api_vm_id] + uexit syzos_api$x86[0, intptr] + code syzos_api$x86[10, syzos_api_code$x86] + 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] + nested_load_code syzos_api$x86[302, syzos_api_nested_load_code] + nested_vmlaunch syzos_api$x86[303, syzos_api_vm_id] + nested_vmresume syzos_api$x86[304, syzos_api_vm_id] + nested_intel_vmwrite_mask syzos_api$x86[340, syzos_api_nested_intel_vmwrite_mask] ] [varlen] kvm_text_x86 [ |
