/src/SockFuzzer/fuzz/fakes/osfmk_stubs.c
Line | Count | Source (jump to first uncovered line) |
1 | | /* |
2 | | * Copyright 2021 Google LLC |
3 | | * |
4 | | * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ |
5 | | * |
6 | | * This file contains Original Code and/or Modifications of Original Code |
7 | | * as defined in and that are subject to the Apple Public Source License |
8 | | * Version 2.0 (the 'License'). You may not use this file except in |
9 | | * compliance with the License. The rights granted to you under the License |
10 | | * may not be used to create, or enable the creation or redistribution of, |
11 | | * unlawful or unlicensed copies of an Apple operating system, or to |
12 | | * circumvent, violate, or enable the circumvention or violation of, any |
13 | | * terms of an Apple operating system software license agreement. |
14 | | * |
15 | | * Please obtain a copy of the License at |
16 | | * http://www.opensource.apple.com/apsl/ and read it before using this file. |
17 | | * |
18 | | * The Original Code and all software distributed under the License are |
19 | | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER |
20 | | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, |
21 | | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, |
22 | | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. |
23 | | * Please see the License for the specific language governing rights and |
24 | | * limitations under the License. |
25 | | * |
26 | | * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ |
27 | | */ |
28 | | |
29 | | #include <kern/assert.h> |
30 | | #include <kern/btlog.h> |
31 | | #include <kern/counter.h> |
32 | | #include <kern/locks.h> |
33 | | #include <stdbool.h> |
34 | | #include <vm/vm_kern.h> |
35 | | |
36 | 2 | void kheap_startup_init() {} |
37 | | |
38 | 1 | void zone_view_startup_init() {} |
39 | | |
40 | 4 | void lck_attr_startup_init(struct lck_attr_startup_spec *sp) {} |
41 | | |
42 | 17 | void lck_grp_startup_init() {} |
43 | | |
44 | 48 | lck_attr_t *lck_attr_alloc_init() { return (void *)1; } |
45 | | |
46 | 77.7M | void lck_mtx_assert() {} |
47 | | |
48 | 1.62M | void lck_mtx_init() {} |
49 | | |
50 | 41.1M | void lck_mtx_lock() {} |
51 | | |
52 | 0 | void lck_spin_init() {} |
53 | | |
54 | 5 | void lck_rw_startup_init(struct lck_rw_startup_spec *spec) {} |
55 | | |
56 | | // fake these so they aren't null but still invalid |
57 | | lck_grp_attr_t *lck_grp_attr_alloc_init( |
58 | 48 | void) { |
59 | 48 | return (void*)1; |
60 | 48 | } |
61 | | |
62 | | lck_grp_t *lck_grp_alloc_init( |
63 | | const char* grp_name, |
64 | 55 | lck_grp_attr_t *attr) { |
65 | 55 | return (void*)1; |
66 | 55 | } |
67 | | |
68 | | lck_rw_t *lck_rw_alloc_init( |
69 | | lck_grp_t *grp, |
70 | 3 | lck_attr_t *attr) { return (void*)1; } |
71 | | |
72 | | lck_mtx_t *lck_mtx_alloc_init( |
73 | | lck_grp_t *grp, |
74 | 5 | lck_attr_t *attr) { return (void*)1; } |
75 | | |
76 | | lck_spin_t *lck_spin_alloc_init( |
77 | | lck_grp_t *grp, |
78 | 1 | lck_attr_t *attr) { return (void*)1; } |
79 | | |
80 | 18.3M | void lck_mtx_lock_spin() {} |
81 | | |
82 | 1.71M | void lck_mtx_convert_spin() {} |
83 | | |
84 | 0 | void lck_mtx_free() {} |
85 | | |
86 | 28 | void lck_rw_init() {} |
87 | | |
88 | 61.5M | void lck_mtx_unlock() {} |
89 | | |
90 | 7 | void lck_attr_free() {} |
91 | | |
92 | 1 | void lck_attr_setdebug() {} |
93 | | |
94 | | OS_OVERLOADABLE |
95 | 0 | uint64_t counter_load(unsigned long long **counter) { assert(false); } |
96 | | |
97 | 0 | int32_t sysctl_get_bound_cpuid(void) { assert(false); } |
98 | | |
99 | 0 | kern_return_t sysctl_thread_bind_cpuid(int32_t cpuid) { assert(false); } |
100 | | |
101 | | kern_return_t kernel_memory_allocate(vm_map_t map, vm_offset_t *addrp, |
102 | | vm_size_t size, vm_offset_t mask, |
103 | 0 | kma_flags_t flags, vm_tag_t tag) { |
104 | 0 | assert(false); |
105 | 0 | } |
106 | | |
107 | 11 | void lck_mtx_startup_init(struct lck_mtx_startup_spec *spec) {} |
108 | | |
109 | | void |
110 | | btlog_add_entry(btlog_t *btlog, |
111 | | void *element, |
112 | | uint8_t operation, |
113 | | void *bt[], |
114 | | size_t btcount) |
115 | 0 | {} |
116 | | |
117 | | void |
118 | | btlog_remove_entries_for_element(btlog_t *btlog, |
119 | 0 | void *element) {} |
120 | | |
121 | | btlog_t * |
122 | | btlog_create(size_t numrecords, |
123 | | size_t record_btdepth, |
124 | 0 | boolean_t caller_will_remove_entries_for_element) { |
125 | 0 | assert(false); |
126 | 0 | } |
127 | | |
128 | 0 | void machine_init(void) { assert(false); } |
129 | | |
130 | 0 | void device_service_create(void) { assert(false); } |
131 | | |
132 | 0 | void bsd_init(void) { assert(false); } |
133 | | |
134 | 0 | void slave_machine_init(__unused void *param) { assert(false); } |
135 | | |
136 | 0 | void phys_carveout_init() { assert(false); } |
137 | 0 | void hv_support_init() { assert(false); } |
138 | 0 | void vm_mem_bootstrap() { assert(false); } |
139 | 0 | void kdp_init() { assert(false); } |
140 | 0 | void workq_init() { assert(false); } |
141 | 0 | void machine_lockdown() { assert(false); } |
142 | 0 | void thread_max() { assert(false); } |
143 | 0 | void kperf_init_early() { assert(false); } |
144 | 0 | void thread_daemon_init() { assert(false); } |
145 | 0 | void mac_policy_initmach() { assert(false); } |
146 | 0 | void vm_kernel_reserved_entry_init() { assert(false); } |
147 | 0 | void kdebug_free_early_buf() { assert(false); } |
148 | 0 | void turnstiles_init() { assert(false); } |
149 | 0 | void vm_commpage_text_init() { assert(false); } |
150 | 0 | void machine_load_context() { assert(false); } |
151 | 0 | void ipc_pthread_priority_init() { assert(false); } |
152 | 0 | void PE_i_can_has_debugger() { assert(false); } |
153 | 0 | void sfi_init() { assert(false); } |
154 | 0 | void dtrace_early_init() { assert(false); } |
155 | 0 | void sched_startup() { assert(false); } |
156 | 0 | void ml_get_interrupts_enabled() { assert(false); } |
157 | 0 | void kernel_list_tests() { assert(false); } |
158 | 0 | void thread_machine_init_template() { assert(false); } |
159 | 0 | void task_max() { assert(false); } |
160 | 0 | void thread_get_perfcontrol_class() { assert(false); } |
161 | 0 | void ml_set_interrupts_enabled() { assert(false); } |
162 | 0 | void processor_up() { assert(false); } |
163 | 0 | void exception_init() { assert(false); } |
164 | 0 | void vm_set_restrictions() { assert(false); } |
165 | 0 | void thread_init() { assert(false); } |
166 | 0 | void console_init() { assert(false); } |
167 | 0 | void idle_thread_create() { assert(false); } |
168 | 0 | void PE_init_iokit() { assert(false); } |
169 | 0 | void mac_policy_init() { assert(false); } |
170 | 0 | void bsd_scale_setup() { assert(false); } |
171 | 0 | void mapping_adjust() { assert(false); } |
172 | 0 | void trust_cache_init() { assert(false); } |
173 | | |
174 | | vm_size_t mem_size = 4000000; |
175 | | |
176 | 0 | void version_minor() { assert(false); } |
177 | 0 | void restartable_init() { assert(false); } |
178 | 0 | void clock_init() { assert(false); } |
179 | 0 | void kpc_init() { assert(false); } |
180 | 0 | void vnguard_policy_init() { assert(false); } |
181 | 0 | void coalitions_init() { assert(false); } |
182 | 0 | void PE_lockdown_iokit() { assert(false); } |
183 | 0 | void work_interval_subsystem_init() { assert(false); } |
184 | 0 | void kernel_do_post() { assert(false); } |
185 | 0 | void stack_alloc_try() { assert(false); } |
186 | 0 | void vm_commpage_init() { assert(false); } |
187 | 0 | void serial_keyboard_init() { assert(false); } |
188 | 0 | void stackshot_init() { assert(false); } |
189 | 0 | void task_threadmax() { assert(false); } |
190 | 0 | void version() { assert(false); } |
191 | 0 | void mach_init_activity_id() { assert(false); } |
192 | 0 | void current_processor() { assert(false); } |
193 | 0 | void telemetry_init() { assert(false); } |
194 | 0 | void vm_pageout() { assert(false); } |
195 | 0 | void sdt_early_init() { assert(false); } |
196 | 0 | void task_init() { assert(false); } |
197 | 0 | void vm_page_init_local_q() { assert(false); } |
198 | 0 | void bootprofile_init() { assert(false); } |
199 | | |
200 | | struct machine_info machine_info; |
201 | | uint64_t max_mem_actual = 4000000; |
202 | | |
203 | 0 | void thread_bind() { assert(false); } |
204 | 0 | void spinlock_timeout_panic() { assert(false); } |
205 | 0 | void sched_dualq_dispatch() { assert(false); } |
206 | 0 | void processor_state_update_explicit() { assert(false); } |
207 | 0 | void mapping_free_prime() { assert(false); } |
208 | 0 | void PE_parse_boot_arg_str() { assert(false); } |
209 | 0 | void timer_start() { assert(false); } |
210 | 0 | void atm_init() { assert(false); } |
211 | 0 | void version_major() { assert(false); } |
212 | 0 | void waitq_bootstrap() { assert(false); } |
213 | 0 | void sched_init() { assert(false); } |
214 | 0 | void kperf_init() { assert(false); } |
215 | 0 | void kernel_thread_create() { assert(false); } |
216 | 0 | void machine_set_current_thread() { assert(false); } |
217 | 0 | void idle_thread() { assert(false); } |
218 | 0 | void kasan_late_init() { assert(false); } |
219 | 0 | void thread_call_initialize() { assert(false); } |
220 | 0 | void clock_service_create() { assert(false); } |
221 | 0 | void ipc_thread_call_init() { assert(false); } |
222 | 0 | void corpses_init() { assert(false); } |
223 | 0 | void OSKextRemoveKextBootstrap() { assert(false); } |
224 | 0 | void bank_init() { assert(false); } |
225 | 0 | void kdebug_init() { assert(false); } |
226 | 0 | void vm_free_delayed_pages() { assert(false); } |
227 | 0 | void initialize_screen() { assert(false); } |
228 | 0 | void serverperfmode() { assert(false); } |
229 | 0 | void host_statistics_init() { assert(false); } |
230 | | |
231 | | boolean_t doprnt_hide_pointers = true; |