Skip to content

Commit 400e8b4

Browse files
docs: minor changes to syzos.md
Make it clearer how to add new commands.
1 parent 44392eb commit 400e8b4

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

docs/syzos.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,8 @@ Modify the architecture-specific executor header (e.g., `executor/common_kvm_amd
165165
GUEST_CODE static void guest_handle_nested_amd_vmcb_write_mask(struct api_call_5* cmd, uint64 cpu_id);
166166
```
167167

168+
Note: make sure to choose the optimal api_call_N structure that exactly matches the number of arguments required by your new primitive (e.g., use struct api_call_2 for a command needing two arguments).
169+
168170
### Step 2: Implement Guest Logic and Dispatch
169171
In the same file (or corresponding source), implement the guest logic.
170172

@@ -189,6 +191,16 @@ In the same file (or corresponding source), implement the guest logic.
189191
Expose the new command to `syzkaller` in the description file (e.g., `sys/linux/dev_kvm_amd64.txt`).
190192

191193
1. **Define Structures:** Define any necessary constants or structures.
194+
```
195+
syzos_api_nested_amd_vmcb_write_mask {
196+
vm_id syzos_api_vm_id
197+
offset vmcb_offset
198+
set_mask int64
199+
unset_mask int64
200+
flip_mask int64
201+
}
202+
```
203+
192204
2. **Map Command ID:** Add the command to the `syzos_api_call` union. **Crucial:** The ID (e.g., `380`) must match the enum in the C header.
193205
```
194206
syzos_api_call$x86 [

0 commit comments

Comments
 (0)