diff options
| author | Alexander Potapenko <glider@google.com> | 2025-10-16 15:05:18 +0200 |
|---|---|---|
| committer | Alexander Potapenko <glider@google.com> | 2025-10-17 06:51:20 +0000 |
| commit | bc0cbe5709e294d9755f481e7f41be68413e14f9 (patch) | |
| tree | 0ff4025a1500621c48a769145be05d1e247595d1 /executor | |
| parent | e253a80f735974088faae059a2fa9593550370b6 (diff) | |
executor: unify ARM64_ADDR_EXECUTOR_CODE and X86_SYZOS_ADDR_EXECUTOR_CODE
Use SYZOS_ADDR_EXECUTOR_CODE instead of both. Also put platform-specific
definitions under #if GOARCH_xxx.
Diffstat (limited to 'executor')
| -rw-r--r-- | executor/common_kvm_amd64.h | 2 | ||||
| -rw-r--r-- | executor/common_kvm_arm64.h | 2 | ||||
| -rw-r--r-- | executor/kvm.h | 14 |
3 files changed, 13 insertions, 5 deletions
diff --git a/executor/common_kvm_amd64.h b/executor/common_kvm_amd64.h index e0c4a68a2..1783b7686 100644 --- a/executor/common_kvm_amd64.h +++ b/executor/common_kvm_amd64.h @@ -230,7 +230,7 @@ static const struct mem_region syzos_mem_regions[] = { // SYZOS user code (generated by the fuzzer). {X86_SYZOS_ADDR_USER_CODE, KVM_MAX_VCPU, MEM_REGION_FLAG_READONLY | MEM_REGION_FLAG_USER_CODE}, // Executor guest code. - {X86_SYZOS_ADDR_EXECUTOR_CODE, 4, MEM_REGION_FLAG_READONLY | MEM_REGION_FLAG_EXECUTOR_CODE}, + {SYZOS_ADDR_EXECUTOR_CODE, 4, MEM_REGION_FLAG_READONLY | MEM_REGION_FLAG_EXECUTOR_CODE}, // Scratch memory for code generated at runtime. {X86_SYZOS_ADDR_SCRATCH_CODE, 1, 0}, // CPU stack. diff --git a/executor/common_kvm_arm64.h b/executor/common_kvm_arm64.h index badfcf417..0837017ef 100644 --- a/executor/common_kvm_arm64.h +++ b/executor/common_kvm_arm64.h @@ -108,7 +108,7 @@ static void setup_vm(int vmfd, void* host_mem, void** text_slot) struct addr_size host_text = alloc_guest_mem(&allocator, 4 * KVM_PAGE_SIZE); install_syzos_code(host_text.addr, host_text.size); - vm_set_user_memory_region(vmfd, slot++, KVM_MEM_READONLY, ARM64_ADDR_EXECUTOR_CODE, host_text.size, (uintptr_t)host_text.addr); + vm_set_user_memory_region(vmfd, slot++, KVM_MEM_READONLY, SYZOS_ADDR_EXECUTOR_CODE, host_text.size, (uintptr_t)host_text.addr); struct addr_size next = alloc_guest_mem(&allocator, 2 * KVM_PAGE_SIZE); vm_set_user_memory_region(vmfd, slot++, KVM_MEM_LOG_DIRTY_PAGES, ARM64_ADDR_DIRTY_PAGES, next.size, (uintptr_t)next.addr); diff --git a/executor/kvm.h b/executor/kvm.h index eb0bb7b56..104bd45fc 100644 --- a/executor/kvm.h +++ b/executor/kvm.h @@ -1,6 +1,8 @@ // Copyright 2017 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. +// x86-specific definitions. +#if GOARCH_amd64 #define X86_ADDR_TEXT 0x0000 #define X86_ADDR_PD_IOAPIC 0x0000 #define X86_ADDR_GDT 0x1000 @@ -33,7 +35,6 @@ #define X86_ADDR_VAR_USER_CODE 0x9100 #define X86_ADDR_VAR_USER_CODE2 0x9120 -// x86 SYZOS definitions. // Zero page (0x0 - 0xfff) is deliberately unused. #define X86_SYZOS_ADDR_ZERO 0x0 #define X86_SYZOS_ADDR_GDT 0x1000 @@ -52,7 +53,8 @@ #define X86_SYZOS_ADDR_UEXIT (X86_SYZOS_ADDR_EXIT + 256) #define X86_SYZOS_ADDR_DIRTY_PAGES 0x41000 #define X86_SYZOS_ADDR_USER_CODE 0x50000 -#define X86_SYZOS_ADDR_EXECUTOR_CODE 0x54000 +// Location of the SYZOS guest code. Name shared with ARM64 SYZOS. +#define SYZOS_ADDR_EXECUTOR_CODE 0x54000 #define X86_SYZOS_ADDR_SCRATCH_CODE 0x58000 #define X86_SYZOS_ADDR_STACK_BOTTOM 0x90000 #define X86_SYZOS_ADDR_STACK0 0x90f80 @@ -163,6 +165,7 @@ #define X86_NEXT_INSN $0xbadc0de #define X86_PREFIX_SIZE 0xba1d +#endif // x86-specific definitions. #define KVM_MAX_VCPU 4 #define KVM_PAGE_SIZE (1 << 12) @@ -174,6 +177,8 @@ (((~0ULL) - (1ULL << (l)) + 1ULL) & \ (~0ULL >> (63 - (h)))) +// ARM64 SYZOS definitions. +#if GOARCH_arm64 // GICv3 distributor address. #define ARM64_ADDR_GICD_BASE 0x08000000 // GICv3 ITS address. @@ -188,7 +193,8 @@ // Two writable pages with KVM_MEM_LOG_DIRTY_PAGES explicitly set. #define ARM64_ADDR_DIRTY_PAGES 0xdddd1000 #define ARM64_ADDR_USER_CODE 0xeeee0000 -#define ARM64_ADDR_EXECUTOR_CODE 0xeeee8000 +// Location of the SYZOS guest code. Name shared with x86 SYZOS. +#define SYZOS_ADDR_EXECUTOR_CODE 0xeeee8000 #define ARM64_ADDR_SCRATCH_CODE 0xeeef0000 #define ARM64_ADDR_EL1_STACK_BOTTOM 0xffff1000 @@ -201,3 +207,5 @@ #define ARM64_ADDR_ITS_ITT_TABLES (ARM64_ADDR_ITS_CMDQ_BASE + SZ_64K) #define ARM64_ADDR_ITS_PROP_TABLE (ARM64_ADDR_ITS_ITT_TABLES + SZ_64K * ITS_MAX_DEVICES) #define ARM64_ADDR_ITS_PEND_TABLES (ARM64_ADDR_ITS_PROP_TABLE + SZ_64K) + +#endif // ARM64 SYZOS definitions |
