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  void __msan_read_go(void *addr, uintptr_t sz) {
    17  	__msan_check_mem_is_initialized(addr, sz);
    18  }
    19  
    20  void __msan_write_go(void *addr, uintptr_t sz) {
    21  	__msan_unpoison(addr, sz);
    22  }
    23  
    24  void __msan_malloc_go(void *addr, uintptr_t sz) {
    25  	__msan_unpoison(addr, sz);
    26  }
    27  
    28  void __msan_free_go(void *addr, uintptr_t sz) {
    29  	__msan_poison(addr, sz);
    30  }
    31  */
    32  import "C"
    33  

View as plain text