File tree 3 files changed +90
-0
lines changed
3 files changed +90
-0
lines changed Original file line number Diff line number Diff line change
1
+ // Copyright 2023 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
+ /*
6
+ Package msan contains helper functions for manually instrumenting code
7
+ for the memory sanitizer.
8
+
9
+ This package exports the private msan routines in runtime unconditionally
10
+ but without the "msan" build tag they are no-ops.
11
+ */
12
+ package msan
Original file line number Diff line number Diff line change
1
+ // Copyright 2023 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
6
+
7
+ package msan
8
+
9
+ import (
10
+ "unsafe"
11
+ )
12
+
13
+ const Enabled = true
14
+
15
+ func Read (addr unsafe.Pointer , sz uintptr ) {
16
+ read (addr , sz )
17
+ }
18
+
19
+ func Write (addr unsafe.Pointer , sz uintptr ) {
20
+ write (addr , sz )
21
+ }
22
+
23
+ func Malloc (addr unsafe.Pointer , sz uintptr ) {
24
+ malloc (addr , sz )
25
+ }
26
+
27
+ func Free (addr unsafe.Pointer , sz uintptr ) {
28
+ free (addr , sz )
29
+ }
30
+
31
+ func Move (dst , src unsafe.Pointer , sz uintptr ) {
32
+ move (dst , src , sz )
33
+ }
34
+
35
+ // Import private msan functions from runtime.
36
+ //
37
+ //go:linkname read runtime.msanread
38
+ func read (addr unsafe.Pointer , sz uintptr )
39
+
40
+ //go:linkname write runtime.msanwrite
41
+ func write (addr unsafe.Pointer , sz uintptr )
42
+
43
+ //go:linkname malloc runtime.msanmalloc
44
+ func malloc (addr unsafe.Pointer , sz uintptr )
45
+
46
+ //go:linkname free runtime.msanfree
47
+ func free (addr unsafe.Pointer , sz uintptr )
48
+
49
+ //go:linkname move runtime.msanmove
50
+ func move (dst , src unsafe.Pointer , sz uintptr )
Original file line number Diff line number Diff line change
1
+ // Copyright 2023 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
6
+
7
+ package msan
8
+
9
+ import (
10
+ "unsafe"
11
+ )
12
+
13
+ const Enabled = false
14
+
15
+ func Read (addr unsafe.Pointer , sz uintptr ) {
16
+ }
17
+
18
+ func Write (addr unsafe.Pointer , sz uintptr ) {
19
+ }
20
+
21
+ func Malloc (addr unsafe.Pointer , sz uintptr ) {
22
+ }
23
+
24
+ func Free (addr unsafe.Pointer , sz uintptr ) {
25
+ }
26
+
27
+ func Move (dst , src unsafe.Pointer , sz uintptr ) {
28
+ }
You can’t perform that action at this time.
0 commit comments