| Alexey Samsonov | 2c5fc3b | 2012-06-04 14:27:50 +0000 | [diff] [blame] | 1 | //===-- sanitizer_mac.cc --------------------------------------------------===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
| 10 | // This file is shared between AddressSanitizer and ThreadSanitizer |
| 11 | // run-time libraries and implements mac-specific functions from |
| 12 | // sanitizer_libc.h. |
| 13 | //===----------------------------------------------------------------------===// |
| 14 | |
| Evgeniy Stepanov | 0af6723 | 2013-03-19 14:33:38 +0000 | [diff] [blame] | 15 | #include "sanitizer_platform.h" |
| 16 | #if SANITIZER_MAC |
| 17 | |
| Alexander Potapenko | d895ae9 | 2013-02-06 14:41:15 +0000 | [diff] [blame] | 18 | // Use 64-bit inodes in file operations. ASan does not support OS X 10.5, so |
| 19 | // the clients will most certainly use 64-bit ones as well. |
| 20 | #ifndef _DARWIN_USE_64_BIT_INODE |
| 21 | #define _DARWIN_USE_64_BIT_INODE 1 |
| 22 | #endif |
| 23 | #include <stdio.h> |
| Alexey Samsonov | 2c5fc3b | 2012-06-04 14:27:50 +0000 | [diff] [blame] | 24 | |
| Alexey Samsonov | 4b1f103 | 2012-06-07 07:13:46 +0000 | [diff] [blame] | 25 | #include "sanitizer_common.h" |
| Alexey Samsonov | 5bbf829 | 2012-06-05 14:25:27 +0000 | [diff] [blame] | 26 | #include "sanitizer_internal_defs.h" |
| Alexey Samsonov | 2c5fc3b | 2012-06-04 14:27:50 +0000 | [diff] [blame] | 27 | #include "sanitizer_libc.h" |
| Alexey Samsonov | 28a9895 | 2012-06-07 06:15:12 +0000 | [diff] [blame] | 28 | #include "sanitizer_procmaps.h" |
| Alexey Samsonov | 2c5fc3b | 2012-06-04 14:27:50 +0000 | [diff] [blame] | 29 | |
| Alexey Samsonov | 0c53a38 | 2012-06-14 14:07:21 +0000 | [diff] [blame] | 30 | #include <crt_externs.h> // for _NSGetEnviron |
| Alexey Samsonov | 4b1f103 | 2012-06-07 07:13:46 +0000 | [diff] [blame] | 31 | #include <fcntl.h> |
| Alexey Samsonov | 28a9895 | 2012-06-07 06:15:12 +0000 | [diff] [blame] | 32 | #include <mach-o/dyld.h> |
| 33 | #include <mach-o/loader.h> |
| Alexey Samsonov | 4b1f103 | 2012-06-07 07:13:46 +0000 | [diff] [blame] | 34 | #include <pthread.h> |
| Alexey Samsonov | 58a3c58 | 2012-06-18 08:44:30 +0000 | [diff] [blame] | 35 | #include <sched.h> |
| Alexey Samsonov | 2c5fc3b | 2012-06-04 14:27:50 +0000 | [diff] [blame] | 36 | #include <sys/mman.h> |
| Alexey Samsonov | 4b1f103 | 2012-06-07 07:13:46 +0000 | [diff] [blame] | 37 | #include <sys/resource.h> |
| Alexey Samsonov | dde1f11 | 2012-06-05 07:05:10 +0000 | [diff] [blame] | 38 | #include <sys/stat.h> |
| 39 | #include <sys/types.h> |
| Alexey Samsonov | 03c8b84 | 2012-06-05 08:32:53 +0000 | [diff] [blame] | 40 | #include <unistd.h> |
| Dmitry Vyukov | af4b0b0 | 2013-01-14 08:01:58 +0000 | [diff] [blame] | 41 | #include <libkern/OSAtomic.h> |
| Alexey Samsonov | 2c5fc3b | 2012-06-04 14:27:50 +0000 | [diff] [blame] | 42 | |
| 43 | namespace __sanitizer { |
| 44 | |
| Alexey Samsonov | 4b1f103 | 2012-06-07 07:13:46 +0000 | [diff] [blame] | 45 | // ---------------------- sanitizer_libc.h |
| Alexey Samsonov | 2c5fc3b | 2012-06-04 14:27:50 +0000 | [diff] [blame] | 46 | void *internal_mmap(void *addr, size_t length, int prot, int flags, |
| 47 | int fd, u64 offset) { |
| 48 | return mmap(addr, length, prot, flags, fd, offset); |
| 49 | } |
| 50 | |
| Alexey Samsonov | 7ac77d6 | 2012-06-05 09:49:25 +0000 | [diff] [blame] | 51 | int internal_munmap(void *addr, uptr length) { |
| 52 | return munmap(addr, length); |
| 53 | } |
| 54 | |
| Alexey Samsonov | 03c8b84 | 2012-06-05 08:32:53 +0000 | [diff] [blame] | 55 | int internal_close(fd_t fd) { |
| 56 | return close(fd); |
| 57 | } |
| 58 | |
| Alexey Samsonov | 39313b7 | 2013-02-01 15:58:46 +0000 | [diff] [blame] | 59 | fd_t internal_open(const char *filename, int flags) { |
| 60 | return open(filename, flags); |
| 61 | } |
| 62 | |
| Alexey Samsonov | 4985b87 | 2013-02-01 16:32:18 +0000 | [diff] [blame] | 63 | fd_t internal_open(const char *filename, int flags, u32 mode) { |
| Alexey Samsonov | 39313b7 | 2013-02-01 15:58:46 +0000 | [diff] [blame] | 64 | return open(filename, flags, mode); |
| 65 | } |
| 66 | |
| 67 | fd_t OpenFile(const char *filename, bool write) { |
| 68 | return internal_open(filename, |
| 69 | write ? O_WRONLY | O_CREAT : O_RDONLY, 0660); |
| Alexey Samsonov | dde1f11 | 2012-06-05 07:05:10 +0000 | [diff] [blame] | 70 | } |
| 71 | |
| Alexey Samsonov | 03c8b84 | 2012-06-05 08:32:53 +0000 | [diff] [blame] | 72 | uptr internal_read(fd_t fd, void *buf, uptr count) { |
| 73 | return read(fd, buf, count); |
| 74 | } |
| 75 | |
| 76 | uptr internal_write(fd_t fd, const void *buf, uptr count) { |
| 77 | return write(fd, buf, count); |
| 78 | } |
| 79 | |
| Alexey Samsonov | 2c5cbd2 | 2013-02-04 10:16:50 +0000 | [diff] [blame] | 80 | int internal_stat(const char *path, void *buf) { |
| Alexey Samsonov | 576e270 | 2013-02-04 10:31:39 +0000 | [diff] [blame] | 81 | return stat(path, (struct stat *)buf); |
| Alexey Samsonov | 2c5cbd2 | 2013-02-04 10:16:50 +0000 | [diff] [blame] | 82 | } |
| 83 | |
| 84 | int internal_lstat(const char *path, void *buf) { |
| Alexey Samsonov | 576e270 | 2013-02-04 10:31:39 +0000 | [diff] [blame] | 85 | return lstat(path, (struct stat *)buf); |
| Alexey Samsonov | 2c5cbd2 | 2013-02-04 10:16:50 +0000 | [diff] [blame] | 86 | } |
| 87 | |
| 88 | int internal_fstat(fd_t fd, void *buf) { |
| Alexey Samsonov | 576e270 | 2013-02-04 10:31:39 +0000 | [diff] [blame] | 89 | return fstat(fd, (struct stat *)buf); |
| Alexey Samsonov | 2c5cbd2 | 2013-02-04 10:16:50 +0000 | [diff] [blame] | 90 | } |
| 91 | |
| Alexey Samsonov | ca2b5d7 | 2012-06-06 07:30:33 +0000 | [diff] [blame] | 92 | uptr internal_filesize(fd_t fd) { |
| Alexey Samsonov | ce8d497 | 2012-08-02 10:09:31 +0000 | [diff] [blame] | 93 | struct stat st; |
| Alexey Samsonov | 2c5cbd2 | 2013-02-04 10:16:50 +0000 | [diff] [blame] | 94 | if (internal_fstat(fd, &st)) |
| Alexey Samsonov | ca2b5d7 | 2012-06-06 07:30:33 +0000 | [diff] [blame] | 95 | return -1; |
| 96 | return (uptr)st.st_size; |
| 97 | } |
| 98 | |
| 99 | int internal_dup2(int oldfd, int newfd) { |
| 100 | return dup2(oldfd, newfd); |
| 101 | } |
| 102 | |
| Alexey Samsonov | f6d2125 | 2012-09-05 14:48:24 +0000 | [diff] [blame] | 103 | uptr internal_readlink(const char *path, char *buf, uptr bufsize) { |
| 104 | return readlink(path, buf, bufsize); |
| 105 | } |
| 106 | |
| Alexey Samsonov | 58a3c58 | 2012-06-18 08:44:30 +0000 | [diff] [blame] | 107 | int internal_sched_yield() { |
| 108 | return sched_yield(); |
| 109 | } |
| 110 | |
| Alexey Samsonov | aadd1f2 | 2013-02-20 13:54:32 +0000 | [diff] [blame] | 111 | void internal__exit(int exitcode) { |
| 112 | _exit(exitcode); |
| 113 | } |
| 114 | |
| Alexey Samsonov | 4b1f103 | 2012-06-07 07:13:46 +0000 | [diff] [blame] | 115 | // ----------------- sanitizer_common.h |
| Alexey Samsonov | ae9b18b | 2012-11-09 14:45:30 +0000 | [diff] [blame] | 116 | bool FileExists(const char *filename) { |
| 117 | struct stat st; |
| 118 | if (stat(filename, &st)) |
| 119 | return false; |
| 120 | // Sanity check: filename is a regular file. |
| 121 | return S_ISREG(st.st_mode); |
| 122 | } |
| 123 | |
| Dmitry Vyukov | 56faa55 | 2012-10-02 12:58:14 +0000 | [diff] [blame] | 124 | uptr GetTid() { |
| 125 | return reinterpret_cast<uptr>(pthread_self()); |
| 126 | } |
| 127 | |
| Alexey Samsonov | cf4d3a0 | 2012-06-07 07:32:00 +0000 | [diff] [blame] | 128 | void GetThreadStackTopAndBottom(bool at_initialization, uptr *stack_top, |
| Alexey Samsonov | 4b1f103 | 2012-06-07 07:13:46 +0000 | [diff] [blame] | 129 | uptr *stack_bottom) { |
| 130 | CHECK(stack_top); |
| 131 | CHECK(stack_bottom); |
| 132 | uptr stacksize = pthread_get_stacksize_np(pthread_self()); |
| 133 | void *stackaddr = pthread_get_stackaddr_np(pthread_self()); |
| 134 | *stack_top = (uptr)stackaddr; |
| Alexey Samsonov | cf4d3a0 | 2012-06-07 07:32:00 +0000 | [diff] [blame] | 135 | *stack_bottom = *stack_top - stacksize; |
| Alexey Samsonov | 4b1f103 | 2012-06-07 07:13:46 +0000 | [diff] [blame] | 136 | } |
| 137 | |
| Alexey Samsonov | 0c53a38 | 2012-06-14 14:07:21 +0000 | [diff] [blame] | 138 | const char *GetEnv(const char *name) { |
| 139 | char ***env_ptr = _NSGetEnviron(); |
| 140 | CHECK(env_ptr); |
| 141 | char **environ = *env_ptr; |
| 142 | CHECK(environ); |
| 143 | uptr name_len = internal_strlen(name); |
| 144 | while (*environ != 0) { |
| 145 | uptr len = internal_strlen(*environ); |
| 146 | if (len > name_len) { |
| 147 | const char *p = *environ; |
| 148 | if (!internal_memcmp(p, name, name_len) && |
| 149 | p[name_len] == '=') { // Match. |
| 150 | return *environ + name_len + 1; // String starting after =. |
| 151 | } |
| 152 | } |
| 153 | environ++; |
| 154 | } |
| 155 | return 0; |
| 156 | } |
| Alexey Samsonov | 4b1f103 | 2012-06-07 07:13:46 +0000 | [diff] [blame] | 157 | |
| Alexey Samsonov | 97ca306 | 2012-09-17 09:12:39 +0000 | [diff] [blame] | 158 | void ReExec() { |
| 159 | UNIMPLEMENTED(); |
| 160 | } |
| 161 | |
| Alexander Potapenko | 1746f55 | 2012-12-10 13:10:40 +0000 | [diff] [blame] | 162 | void PrepareForSandboxing() { |
| 163 | // Nothing here for now. |
| 164 | } |
| 165 | |
| Alexey Samsonov | 4b1f103 | 2012-06-07 07:13:46 +0000 | [diff] [blame] | 166 | // ----------------- sanitizer_procmaps.h |
| Alexey Samsonov | 28a9895 | 2012-06-07 06:15:12 +0000 | [diff] [blame] | 167 | |
| Alexander Potapenko | f8109dd | 2013-03-26 10:34:37 +0000 | [diff] [blame] | 168 | MemoryMappingLayout::MemoryMappingLayout(bool cache_enabled) { |
| Alexey Samsonov | 28a9895 | 2012-06-07 06:15:12 +0000 | [diff] [blame] | 169 | Reset(); |
| 170 | } |
| 171 | |
| Alexey Samsonov | cc62211 | 2012-08-27 13:48:48 +0000 | [diff] [blame] | 172 | MemoryMappingLayout::~MemoryMappingLayout() { |
| Alexey Samsonov | 28a9895 | 2012-06-07 06:15:12 +0000 | [diff] [blame] | 173 | } |
| 174 | |
| 175 | // More information about Mach-O headers can be found in mach-o/loader.h |
| 176 | // Each Mach-O image has a header (mach_header or mach_header_64) starting with |
| 177 | // a magic number, and a list of linker load commands directly following the |
| 178 | // header. |
| 179 | // A load command is at least two 32-bit words: the command type and the |
| 180 | // command size in bytes. We're interested only in segment load commands |
| 181 | // (LC_SEGMENT and LC_SEGMENT_64), which tell that a part of the file is mapped |
| 182 | // into the task's address space. |
| 183 | // The |vmaddr|, |vmsize| and |fileoff| fields of segment_command or |
| 184 | // segment_command_64 correspond to the memory address, memory size and the |
| 185 | // file offset of the current memory segment. |
| 186 | // Because these fields are taken from the images as is, one needs to add |
| 187 | // _dyld_get_image_vmaddr_slide() to get the actual addresses at runtime. |
| 188 | |
| Alexey Samsonov | cc62211 | 2012-08-27 13:48:48 +0000 | [diff] [blame] | 189 | void MemoryMappingLayout::Reset() { |
| Alexey Samsonov | 28a9895 | 2012-06-07 06:15:12 +0000 | [diff] [blame] | 190 | // Count down from the top. |
| 191 | // TODO(glider): as per man 3 dyld, iterating over the headers with |
| 192 | // _dyld_image_count is thread-unsafe. We need to register callbacks for |
| Alexey Samsonov | cc62211 | 2012-08-27 13:48:48 +0000 | [diff] [blame] | 193 | // adding and removing images which will invalidate the MemoryMappingLayout |
| 194 | // state. |
| Alexey Samsonov | 28a9895 | 2012-06-07 06:15:12 +0000 | [diff] [blame] | 195 | current_image_ = _dyld_image_count(); |
| 196 | current_load_cmd_count_ = -1; |
| 197 | current_load_cmd_addr_ = 0; |
| 198 | current_magic_ = 0; |
| Alexander Potapenko | 77c0ac2 | 2012-10-02 15:42:24 +0000 | [diff] [blame] | 199 | current_filetype_ = 0; |
| Alexey Samsonov | 28a9895 | 2012-06-07 06:15:12 +0000 | [diff] [blame] | 200 | } |
| 201 | |
| Alexander Potapenko | 7811425 | 2012-12-01 02:39:45 +0000 | [diff] [blame] | 202 | // static |
| 203 | void MemoryMappingLayout::CacheMemoryMappings() { |
| 204 | // No-op on Mac for now. |
| 205 | } |
| 206 | |
| 207 | void MemoryMappingLayout::LoadFromCache() { |
| 208 | // No-op on Mac for now. |
| 209 | } |
| 210 | |
| Alexey Samsonov | 28a9895 | 2012-06-07 06:15:12 +0000 | [diff] [blame] | 211 | // Next and NextSegmentLoad were inspired by base/sysinfo.cc in |
| 212 | // Google Perftools, http://code.google.com/p/google-perftools. |
| 213 | |
| 214 | // NextSegmentLoad scans the current image for the next segment load command |
| 215 | // and returns the start and end addresses and file offset of the corresponding |
| 216 | // segment. |
| 217 | // Note that the segment addresses are not necessarily sorted. |
| 218 | template<u32 kLCSegment, typename SegmentCommand> |
| Alexey Samsonov | cc62211 | 2012-08-27 13:48:48 +0000 | [diff] [blame] | 219 | bool MemoryMappingLayout::NextSegmentLoad( |
| Alexey Samsonov | 28a9895 | 2012-06-07 06:15:12 +0000 | [diff] [blame] | 220 | uptr *start, uptr *end, uptr *offset, |
| Alexey Samsonov | 06d3aa4 | 2013-03-13 06:51:02 +0000 | [diff] [blame] | 221 | char filename[], uptr filename_size, uptr *protection) { |
| 222 | if (protection) |
| 223 | UNIMPLEMENTED(); |
| Alexey Samsonov | 28a9895 | 2012-06-07 06:15:12 +0000 | [diff] [blame] | 224 | const char* lc = current_load_cmd_addr_; |
| 225 | current_load_cmd_addr_ += ((const load_command *)lc)->cmdsize; |
| 226 | if (((const load_command *)lc)->cmd == kLCSegment) { |
| 227 | const sptr dlloff = _dyld_get_image_vmaddr_slide(current_image_); |
| 228 | const SegmentCommand* sc = (const SegmentCommand *)lc; |
| 229 | if (start) *start = sc->vmaddr + dlloff; |
| 230 | if (end) *end = sc->vmaddr + sc->vmsize + dlloff; |
| Alexander Potapenko | 77c0ac2 | 2012-10-02 15:42:24 +0000 | [diff] [blame] | 231 | if (offset) { |
| 232 | if (current_filetype_ == /*MH_EXECUTE*/ 0x2) { |
| 233 | *offset = sc->vmaddr; |
| 234 | } else { |
| 235 | *offset = sc->fileoff; |
| 236 | } |
| 237 | } |
| Alexey Samsonov | 28a9895 | 2012-06-07 06:15:12 +0000 | [diff] [blame] | 238 | if (filename) { |
| 239 | internal_strncpy(filename, _dyld_get_image_name(current_image_), |
| 240 | filename_size); |
| 241 | } |
| 242 | return true; |
| 243 | } |
| 244 | return false; |
| 245 | } |
| 246 | |
| Alexey Samsonov | cc62211 | 2012-08-27 13:48:48 +0000 | [diff] [blame] | 247 | bool MemoryMappingLayout::Next(uptr *start, uptr *end, uptr *offset, |
| Alexey Samsonov | 91f833a | 2013-03-13 07:39:25 +0000 | [diff] [blame] | 248 | char filename[], uptr filename_size, |
| 249 | uptr *protection) { |
| Alexey Samsonov | 28a9895 | 2012-06-07 06:15:12 +0000 | [diff] [blame] | 250 | for (; current_image_ >= 0; current_image_--) { |
| 251 | const mach_header* hdr = _dyld_get_image_header(current_image_); |
| 252 | if (!hdr) continue; |
| 253 | if (current_load_cmd_count_ < 0) { |
| 254 | // Set up for this image; |
| 255 | current_load_cmd_count_ = hdr->ncmds; |
| 256 | current_magic_ = hdr->magic; |
| Alexander Potapenko | 77c0ac2 | 2012-10-02 15:42:24 +0000 | [diff] [blame] | 257 | current_filetype_ = hdr->filetype; |
| Alexey Samsonov | 28a9895 | 2012-06-07 06:15:12 +0000 | [diff] [blame] | 258 | switch (current_magic_) { |
| 259 | #ifdef MH_MAGIC_64 |
| 260 | case MH_MAGIC_64: { |
| 261 | current_load_cmd_addr_ = (char*)hdr + sizeof(mach_header_64); |
| 262 | break; |
| 263 | } |
| 264 | #endif |
| 265 | case MH_MAGIC: { |
| 266 | current_load_cmd_addr_ = (char*)hdr + sizeof(mach_header); |
| 267 | break; |
| 268 | } |
| 269 | default: { |
| 270 | continue; |
| 271 | } |
| 272 | } |
| 273 | } |
| 274 | |
| 275 | for (; current_load_cmd_count_ >= 0; current_load_cmd_count_--) { |
| 276 | switch (current_magic_) { |
| 277 | // current_magic_ may be only one of MH_MAGIC, MH_MAGIC_64. |
| 278 | #ifdef MH_MAGIC_64 |
| 279 | case MH_MAGIC_64: { |
| 280 | if (NextSegmentLoad<LC_SEGMENT_64, struct segment_command_64>( |
| Alexey Samsonov | 91f833a | 2013-03-13 07:39:25 +0000 | [diff] [blame] | 281 | start, end, offset, filename, filename_size, protection)) |
| Alexey Samsonov | 28a9895 | 2012-06-07 06:15:12 +0000 | [diff] [blame] | 282 | return true; |
| 283 | break; |
| 284 | } |
| 285 | #endif |
| 286 | case MH_MAGIC: { |
| 287 | if (NextSegmentLoad<LC_SEGMENT, struct segment_command>( |
| Alexey Samsonov | 91f833a | 2013-03-13 07:39:25 +0000 | [diff] [blame] | 288 | start, end, offset, filename, filename_size, protection)) |
| Alexey Samsonov | 28a9895 | 2012-06-07 06:15:12 +0000 | [diff] [blame] | 289 | return true; |
| 290 | break; |
| 291 | } |
| 292 | } |
| 293 | } |
| 294 | // If we get here, no more load_cmd's in this image talk about |
| 295 | // segments. Go on to the next image. |
| 296 | } |
| 297 | return false; |
| 298 | } |
| 299 | |
| Alexey Samsonov | cc62211 | 2012-08-27 13:48:48 +0000 | [diff] [blame] | 300 | bool MemoryMappingLayout::GetObjectNameAndOffset(uptr addr, uptr *offset, |
| 301 | char filename[], |
| Alexey Samsonov | 91f833a | 2013-03-13 07:39:25 +0000 | [diff] [blame] | 302 | uptr filename_size, |
| Alexey Samsonov | 06d3aa4 | 2013-03-13 06:51:02 +0000 | [diff] [blame] | 303 | uptr *protection) { |
| 304 | return IterateForObjectNameAndOffset(addr, offset, filename, filename_size, |
| 305 | protection); |
| Alexey Samsonov | 28a9895 | 2012-06-07 06:15:12 +0000 | [diff] [blame] | 306 | } |
| 307 | |
| Dmitry Vyukov | f22982b | 2013-01-14 07:51:39 +0000 | [diff] [blame] | 308 | BlockingMutex::BlockingMutex(LinkerInitialized) { |
| 309 | // We assume that OS_SPINLOCK_INIT is zero |
| 310 | } |
| 311 | |
| Alexey Samsonov | a097f7b | 2013-03-14 13:30:56 +0000 | [diff] [blame] | 312 | BlockingMutex::BlockingMutex() { |
| 313 | internal_memset(this, 0, sizeof(*this)); |
| 314 | } |
| 315 | |
| Dmitry Vyukov | f22982b | 2013-01-14 07:51:39 +0000 | [diff] [blame] | 316 | void BlockingMutex::Lock() { |
| 317 | CHECK(sizeof(OSSpinLock) <= sizeof(opaque_storage_)); |
| Kostya Serebryany | 459df6f | 2013-02-26 12:59:06 +0000 | [diff] [blame] | 318 | CHECK_EQ(OS_SPINLOCK_INIT, 0); |
| 319 | CHECK_NE(owner_, (uptr)pthread_self()); |
| Dmitry Vyukov | f22982b | 2013-01-14 07:51:39 +0000 | [diff] [blame] | 320 | OSSpinLockLock((OSSpinLock*)&opaque_storage_); |
| 321 | CHECK(!owner_); |
| 322 | owner_ = (uptr)pthread_self(); |
| 323 | } |
| 324 | |
| 325 | void BlockingMutex::Unlock() { |
| 326 | CHECK(owner_ == (uptr)pthread_self()); |
| 327 | owner_ = 0; |
| 328 | OSSpinLockUnlock((OSSpinLock*)&opaque_storage_); |
| 329 | } |
| 330 | |
| Alexey Samsonov | db7d965 | 2013-03-11 15:45:20 +0000 | [diff] [blame] | 331 | void BlockingMutex::CheckLocked() { |
| 332 | CHECK_EQ((uptr)pthread_self(), owner_); |
| 333 | } |
| 334 | |
| Evgeniy Stepanov | 5697b58 | 2013-03-13 08:19:53 +0000 | [diff] [blame] | 335 | uptr GetTlsSize() { |
| 336 | return 0; |
| 337 | } |
| 338 | |
| 339 | void InitTlsSize() { |
| 340 | } |
| 341 | |
| Alexey Samsonov | 2c5fc3b | 2012-06-04 14:27:50 +0000 | [diff] [blame] | 342 | } // namespace __sanitizer |
| 343 | |
| Alexey Samsonov | a0e28a7 | 2013-04-03 07:24:35 +0000 | [diff] [blame^] | 344 | #endif // SANITIZER_MAC |