gcc/libgo/go/runtime/asan/asan.go
Ian Lance Taylor 8dc2499aa6 libgo: update to Go1.18beta2
gotools/
	* Makefile.am (go_cmd_cgo_files): Add ast_go118.go
	(check-go-tool): Copy golang.org/x/tools directories.
	* Makefile.in: Regenerate.

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/384695
2022-02-11 15:01:19 -08:00

38 lines
911 B
Go

// Copyright 2021 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 asan && linux && (arm64 || amd64)
package asan
/*
#cgo CFLAGS: -fsanitize=address
#cgo LDFLAGS: -fsanitize=address
#include <stdbool.h>
#include <stdint.h>
#include <sanitizer/asan_interface.h>
void __asan_read_go(void *addr, uintptr_t sz, void *sp, void *pc) {
if (__asan_region_is_poisoned(addr, sz)) {
__asan_report_error(pc, 0, sp, addr, false, sz);
}
}
void __asan_write_go(void *addr, uintptr_t sz, void *sp, void *pc) {
if (__asan_region_is_poisoned(addr, sz)) {
__asan_report_error(pc, 0, sp, addr, true, sz);
}
}
void __asan_unpoison_go(void *addr, uintptr_t sz) {
__asan_unpoison_memory_region(addr, sz);
}
void __asan_poison_go(void *addr, uintptr_t sz) {
__asan_poison_memory_region(addr, sz);
}
*/
import "C"