Skip to content

Commit 7dc1cb3

Browse files
executor: add include guards to KVM headers
Not having these results in three copies of every KVM-related #define in each reproducer.
1 parent c0460fc commit 7dc1cb3

File tree

9 files changed

+45
-0
lines changed

9 files changed

+45
-0
lines changed

executor/common_kvm.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
// Copyright 2025 syzkaller project authors. All rights reserved.
22
// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
33

4+
#ifndef EXECUTOR_COMMON_KVM_H
5+
#define EXECUTOR_COMMON_KVM_H
6+
47
// This file is shared between executor and csource package.
58

69
// Common KVM-related definitions.
@@ -52,3 +55,5 @@ static long syz_kvm_assert_syzos_kvm_exit(volatile long a0, volatile long a1)
5255
return 0;
5356
}
5457
#endif
58+
59+
#endif // EXECUTOR_COMMON_KVM_H

executor/common_kvm_386.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
// Copyright 2025 syzkaller project authors. All rights reserved.
22
// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
33

4+
#ifndef EXECUTOR_COMMON_KVM_386_H
5+
#define EXECUTOR_COMMON_KVM_386_H
6+
47
// This file is shared between executor and csource package.
58

69
#if SYZ_EXECUTOR || __NR_syz_kvm_setup_syzos_vm
@@ -37,3 +40,5 @@ static volatile long syz_kvm_setup_cpu(volatile long a0, volatile long a1, volat
3740
return 0;
3841
}
3942
#endif
43+
44+
#endif // EXECUTOR_COMMON_KVM_386_H

executor/common_kvm_amd64.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
// Copyright 2017 syzkaller project authors. All rights reserved.
22
// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
33

4+
#ifndef EXECUTOR_COMMON_KVM_AMD64_H
5+
#define EXECUTOR_COMMON_KVM_AMD64_H
6+
47
// This file is shared between executor and csource package.
58

69
// Implementation of syz_kvm_setup_cpu pseudo-syscall.
@@ -1182,3 +1185,5 @@ static long syz_kvm_assert_syzos_uexit(volatile long a0, volatile long a1)
11821185
return 0;
11831186
}
11841187
#endif
1188+
1189+
#endif // EXECUTOR_COMMON_KVM_AMD64_H

executor/common_kvm_amd64_syzos.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
// Copyright 2025 syzkaller project authors. All rights reserved.
22
// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
33

4+
#ifndef EXECUTOR_COMMON_KVM_AMD64_SYZOS_H
5+
#define EXECUTOR_COMMON_KVM_AMD64_SYZOS_H
6+
47
// This file provides guest code running inside the AMD64 KVM.
58

69
#include "common_kvm_syzos.h"
@@ -394,3 +397,5 @@ GUEST_CODE static noinline void guest_handle_set_irq_handler(struct api_call_2*
394397
handler_addr = executor_fn_guest_addr(uexit_irq_handler);
395398
set_idt_gate(vector, handler_addr);
396399
}
400+
401+
#endif // EXECUTOR_COMMON_KVM_AMD64_SYZOS_H

executor/common_kvm_arm64.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
#ifndef EXECUTOR_COMMON_KVM_ARM64_H
2+
#define EXECUTOR_COMMON_KVM_ARM64_H
3+
14
// Copyright 2017 syzkaller project authors. All rights reserved.
25
// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
36

@@ -395,3 +398,5 @@ static long syz_kvm_assert_reg(volatile long a0, volatile long a1, volatile long
395398
return 0;
396399
}
397400
#endif
401+
402+
#endif // EXECUTOR_COMMON_KVM_ARM64_H

executor/common_kvm_arm64_syzos.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
// Copyright 2024 syzkaller project authors. All rights reserved.
22
// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
33

4+
#ifndef EXECUTOR_COMMON_KVM_ARM64_SYZOS_H
5+
#define EXECUTOR_COMMON_KVM_ARM64_SYZOS_H
6+
47
// This file provides guest code running inside the ARM64 KVM.
58

69
#include "common_kvm_syzos.h"
@@ -1348,3 +1351,5 @@ GUEST_CODE static void guest_prepare_its(int nr_cpus, int nr_devices, int nr_eve
13481351
guest_setup_its_mappings(ARM64_ADDR_ITS_CMDQ_BASE, ARM64_ADDR_ITS_ITT_TABLES, nr_events, nr_devices, nr_cpus);
13491352
guest_invalidate_all_rdists(ARM64_ADDR_ITS_CMDQ_BASE, nr_cpus);
13501353
}
1354+
1355+
#endif // EXECUTOR_COMMON_KVM_ARM64_SYZOS_H

executor/common_kvm_ppc64.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
// Copyright 2020 syzkaller project authors. All rights reserved.
22
// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
33

4+
#ifndef EXECUTOR_COMMON_KVM_PPC64_H
5+
#define EXECUTOR_COMMON_KVM_PPC64_H
6+
47
// This file is shared between executor and csource package.
58

69
// Implementation of syz_kvm_setup_cpu pseudo-syscall.
@@ -409,3 +412,5 @@ static volatile long syz_kvm_setup_cpu(volatile long a0, volatile long a1, volat
409412

410413
return 0;
411414
}
415+
416+
#endif // EXECUTOR_COMMON_KVM_PPC64_H

executor/common_kvm_syzos.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
// Copyright 2025 syzkaller project authors. All rights reserved.
22
// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
33

4+
#ifndef EXECUTOR_COMMON_KVM_SYZOS_H
5+
#define EXECUTOR_COMMON_KVM_SYZOS_H
6+
47
// Common SYZOS definitions.
58

69
// Prevent function inlining. This attribute is applied to every guest_handle_* function,
@@ -37,3 +40,5 @@
3740

3841
// Start/end of the guest section.
3942
extern char *__start_guest, *__stop_guest;
43+
44+
#endif // EXECUTOR_COMMON_KVM_SYZOS_H

executor/kvm.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
// Copyright 2017 syzkaller project authors. All rights reserved.
22
// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
33

4+
#ifndef EXECUTOR_KVM_H
5+
#define EXECUTOR_KVM_H
6+
47
// x86-specific definitions.
58
#if GOARCH_amd64
69
#define X86_ADDR_TEXT 0x0000
@@ -209,3 +212,5 @@
209212
#define ARM64_ADDR_ITS_PEND_TABLES (ARM64_ADDR_ITS_PROP_TABLE + SZ_64K)
210213

211214
#endif // ARM64 SYZOS definitions
215+
216+
#endif // EXECUTOR_KVM_H

0 commit comments

Comments
 (0)