]>
git.saurik.com Git - apple/xnu.git/blob - san/memintrinsics.h
2 * Copyright (c) 2016 Apple Inc. All rights reserved.
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
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.
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
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.
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
28 #ifndef _SAN_MEMINTRINSICS_H_
29 #define _SAN_MEMINTRINSICS_H_
32 * Non-sanitized versions of memory intrinsics
35 __nosan_memcpy(void *dst
, const void *src
, size_t sz
)
37 return memcpy(dst
, src
, sz
);
40 __nosan_memset(void *src
, int c
, size_t sz
)
42 return memset(src
, c
, sz
);
45 __nosan_memmove(void *src
, const void *dst
, size_t sz
)
47 return memmove(src
, dst
, sz
);
50 __nosan_bcmp(const void *a
, const void *b
, size_t sz
)
52 return bcmp(a
, b
, sz
);
55 __nosan_bcopy(const void *src
, void *dst
, size_t sz
)
60 __nosan_memcmp(const void *a
, const void *b
, size_t sz
)
62 return memcmp(a
, b
, sz
);
65 __nosan_bzero(void *dst
, size_t sz
)
71 __nosan_strlcpy(char *dst
, const char *src
, size_t sz
)
73 return strlcpy(dst
, src
, sz
);
76 __nosan_strncpy(char *dst
, const char *src
, size_t sz
)
78 return strncpy(dst
, src
, sz
);
81 __nosan_strlcat(char *dst
, const char *src
, size_t sz
)
83 return strlcat(dst
, src
, sz
);
86 __nosan_strncat(char *dst
, const char *src
, size_t sz
)
88 return strncat(dst
, src
, sz
);
91 __nosan_strnlen(const char *src
, size_t sz
)
93 return strnlen(src
, sz
);
96 __nosan_strlen(const char *src
)
102 void *__asan_memcpy(void *src
, const void *dst
, size_t sz
);
103 void *__asan_memset(void *src
, int c
, size_t sz
);
104 void *__asan_memmove(void *src
, const void *dst
, size_t sz
);
105 void __asan_bcopy(const void *src
, void *dst
, size_t sz
);
106 void __asan_bzero(void *dst
, size_t sz
);
107 int __asan_bcmp(const void *a
, const void *b
, size_t sz
);
108 int __asan_memcmp(const void *a
, const void *b
, size_t sz
);
110 size_t __asan_strlcpy(char *dst
, const char *src
, size_t sz
);
111 char *__asan_strncpy(char *dst
, const char *src
, size_t sz
);
112 size_t __asan_strlcat(char *dst
, const char *src
, size_t sz
);
113 char *__asan_strncat(char *dst
, const char *src
, size_t sz
);
114 size_t __asan_strnlen(const char *src
, size_t sz
);
115 size_t __asan_strlen(const char *src
);
117 #define memcpy __asan_memcpy
118 #define memmove __asan_memmove
119 #define memset __asan_memset
120 #define bcopy __asan_bcopy
121 #define bzero __asan_bzero
122 #define bcmp __asan_bcmp
123 #define memcmp __asan_memcmp
125 #define strlcpy __asan_strlcpy
126 #define strncpy __asan_strncpy
127 #define strlcat __asan_strlcat
128 #define strncat __asan_strncat
129 // #define strnlen __asan_strnlen
130 // #define strlen __asan_strlen
134 #endif /* _SAN_MEMINTRINSICS_H_ */