You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
package main
import (
"fmt"
"unsafe"
)
func main() {
p := new([1024*100]int)
p[1] = 10
r := bar(&p[102399]) // line0
fmt.Printf("r value is %d", r)
}
func bar(a *int) int {
p := (*int)(unsafe.Add(unsafe.Pointer(a), 2*unsafe.Sizeof(int(1))))
*p = 10 // BO0M // line1
return *p
}
What did you expect to see?
I expect the -asan can print where the error occurred, like
#0 0x454ad0 in main.bar test.go:line1 #1 0x454ad0 in main.main test.go:line0
What did you see instead?
The -asan option does not print where the error occurred.
==5406==ERROR: AddressSanitizer: use-after-poison on address 0x204000348008 at pc 0x0000004916a8 bp 0xffffd62ddc90 sp 0xffffd62ddcb0
WRITE of size 8 at 0x204000348008 thread T0
#0 0x4916a4 in __asan_write_go /home/fanzha02/work/go_project/govscode/gomain/src/runtime/asan/asan.go:46 #1 0x458d6c in asancall /home/fanzha02/work/go_project/govscode/gomain/src/runtime/asan_arm64.s:60
The reason is that the current implementation calls incorrect asan runtime functions to report error, they do not record pc and sp, and only report the memory access errors without printing the location of the error. The correct asan runtime function we should call is __asan_report_error, it will record pc and sp, and report where the error occurred.
The fixed patch will be submitted soon. Thank you.
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
// test.go
What did you expect to see?
I expect the -asan can print where the error occurred, like
#0 0x454ad0 in main.bar test.go:line1
#1 0x454ad0 in main.main test.go:line0
What did you see instead?
The -asan option does not print where the error occurred.
==5406==ERROR: AddressSanitizer: use-after-poison on address 0x204000348008 at pc 0x0000004916a8 bp 0xffffd62ddc90 sp 0xffffd62ddcb0
WRITE of size 8 at 0x204000348008 thread T0
#0 0x4916a4 in __asan_write_go /home/fanzha02/work/go_project/govscode/gomain/src/runtime/asan/asan.go:46
#1 0x458d6c in asancall /home/fanzha02/work/go_project/govscode/gomain/src/runtime/asan_arm64.s:60
Address 0x204000348008 is a wild pointer.
SUMMARY: AddressSanitizer: use-after-poison /home/fanzha02/work/go_project/govscode/gomain/src/runtime/asan/asan.go:46 in __asan_write_go
Shadow bytes around the buggy address:
0x041800068fb0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x041800068fc0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x041800068fd0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x041800068fe0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x041800068ff0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x041800069000: f7[f7]f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7
0x041800069010: f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7
0x041800069020: f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7
0x041800069030: f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7
0x041800069040: f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7
0x041800069050: f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7
The text was updated successfully, but these errors were encountered: