Source file src/runtime/msan/msan.go
1 // Copyright 2015 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 //go:build msan && ((linux && (amd64 || arm64 || loong64)) || (freebsd && amd64)) 6 7 package msan 8 9 /* 10 #cgo CFLAGS: -fsanitize=memory 11 #cgo LDFLAGS: -fsanitize=memory 12 13 #include <stdint.h> 14 #include <sanitizer/msan_interface.h> 15 16 extern void __msan_memmove(void*, const void*, uintptr_t); 17 18 void __msan_read_go(void *addr, uintptr_t sz) { 19 __msan_check_mem_is_initialized(addr, sz); 20 } 21 22 void __msan_write_go(void *addr, uintptr_t sz) { 23 __msan_unpoison(addr, sz); 24 } 25 26 void __msan_malloc_go(void *addr, uintptr_t sz) { 27 __msan_unpoison(addr, sz); 28 } 29 30 void __msan_free_go(void *addr, uintptr_t sz) { 31 __msan_poison(addr, sz); 32 } 33 34 void __msan_memmove_go(void *to, const void *from, uintptr_t sz) { 35 __msan_memmove(to, from, sz); 36 } 37 */ 38 import "C" 39