xref: /xnu-12377.41.6/tests/unit/mocks/san_attached.c (revision bbb1b6f9e71b8cdde6e5cd6f4841f207dee3d828)
1 /*
2  * Copyright (c) 2000-2024 Apple Inc. All rights reserved.
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 "dt_proxy.h"
30 #include <mach/mach_types.h>
31 
32 #define NOT_MOCKED(name) PT_FAIL(#name ": this function should never be called since it is mocked by the mocks dylib")
33 
34 void
data_race_checker_atomic_begin(void)35 data_race_checker_atomic_begin(void)
36 {
37 }
38 
39 void
data_race_checker_atomic_end(void)40 data_race_checker_atomic_end(void)
41 {
42 }
43 
44 __mockable void
__sanitizer_cov_trace_pc_guard(uint32_t * guard)45 __sanitizer_cov_trace_pc_guard(uint32_t *guard)
46 {
47 	// do nothing
48 }
49 
50 // Called before a load of appropriate size. Addr is the address of the load.
51 __mockable void
__sanitizer_cov_load1(uint8_t * addr)52 __sanitizer_cov_load1(uint8_t *addr)
53 {
54 	NOT_MOCKED(__sanitizer_cov_load1);
55 }
56 __mockable void
__sanitizer_cov_load2(uint16_t * addr)57 __sanitizer_cov_load2(uint16_t *addr)
58 {
59 	NOT_MOCKED(__sanitizer_cov_load2);
60 }
61 __mockable void
__sanitizer_cov_load4(uint32_t * addr)62 __sanitizer_cov_load4(uint32_t *addr)
63 {
64 	NOT_MOCKED(__sanitizer_cov_load4);
65 }
66 __mockable void
__sanitizer_cov_load8(uint64_t * addr)67 __sanitizer_cov_load8(uint64_t *addr)
68 {
69 	NOT_MOCKED(__sanitizer_cov_load8);
70 }
71 __mockable void
__sanitizer_cov_load16(__int128 * addr)72 __sanitizer_cov_load16(__int128 *addr)
73 {
74 	NOT_MOCKED(__sanitizer_cov_load16);
75 }
76 // Called before a store of appropriate size. Addr is the address of the store.
77 void
__sanitizer_cov_store1(uint8_t * addr)78 __sanitizer_cov_store1(uint8_t *addr)
79 {
80 	NOT_MOCKED(__sanitizer_cov_store1);
81 }
82 void
__sanitizer_cov_store2(uint16_t * addr)83 __sanitizer_cov_store2(uint16_t *addr)
84 {
85 	NOT_MOCKED(__sanitizer_cov_store2);
86 }
87 void
__sanitizer_cov_store4(uint32_t * addr)88 __sanitizer_cov_store4(uint32_t *addr)
89 {
90 	NOT_MOCKED(__sanitizer_cov_store4);
91 }
92 void
__sanitizer_cov_store8(uint64_t * addr)93 __sanitizer_cov_store8(uint64_t *addr)
94 {
95 	NOT_MOCKED(__sanitizer_cov_store8);
96 }
97 void
__sanitizer_cov_store16(__int128 * addr)98 __sanitizer_cov_store16(__int128 *addr)
99 {
100 	NOT_MOCKED(__sanitizer_cov_store16);
101 }
102