aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/go/_std_1.22/src/runtime/msan/msan.go
blob: 7b3e8e608d840fe95f5a3fe388bc031d0b4fb1a2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// Copyright 2015 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

//go:build msan && ((linux && (amd64 || arm64 || loong64)) || (freebsd && amd64))

package msan

/*
#cgo CFLAGS: -fsanitize=memory
#cgo LDFLAGS: -fsanitize=memory

#include <stdint.h>
#include <sanitizer/msan_interface.h>

void __msan_read_go(void *addr, uintptr_t sz) {
	__msan_check_mem_is_initialized(addr, sz);
}

void __msan_write_go(void *addr, uintptr_t sz) {
	__msan_unpoison(addr, sz);
}

void __msan_malloc_go(void *addr, uintptr_t sz) {
	__msan_unpoison(addr, sz);
}

void __msan_free_go(void *addr, uintptr_t sz) {
	__msan_poison(addr, sz);
}
*/
import "C"