New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The test for the package “./pkg/terminal” fails when using -asan or -msan. #2919
Comments
The cause is when using I print out the value of I am not familiar with the logical of these codes. can someone help with a look?Thank you. |
Why is the error reported for pkg/proc/native/ptrace_linux_64bit.go:19 which is:
and not for line 17 which contains the unsafe.Pointer conversion of addr:
Anyway, this is reading memory from the target process, the value of remote_iov.Base is always wrong for delve's process, except accidentally. Would using a struct like this:
for remote_iov be better? |
@aarzilli Sorry, I added some logs to the source code that made the line numbers inconsistent. Below is the correct stack trace. And the analysis I mentioned above is correct. Thank you. fatal error: checkptr: pointer arithmetic computed bad pointer value goroutine 626 [running]: |
Ok. Should we change our use of sys.Iovec to the remoteSysIovec that uses uintptr for the Base field? |
@aarzilli I'm not a developer of the delve project. But based on the stack trace, I'm more curious why |
Probably because the go runtime hasn't fully finished initializing yet. |
Replaces sys.Iovec with a similar struct that uses uintptr instead of *byte for the base field when referring to addresses of the target process, so that we do not generate invalid pointers. Fixes go-delve#2919
Replaces sys.Iovec with a similar struct that uses uintptr instead of *byte for the base field when referring to addresses of the target process, so that we do not generate invalid pointers. Fixes go-delve#2919
Please answer the following before submitting your issue:
Note: Please include any substantial examples (debug session output,
stacktraces, etc) as linked gists.
What version of Delve are you using (
dlv version
)?git clone https://github.com/go-delve/delve.git
What version of Go are you using? (
go version
)?go version devel go1.19-d9d55724bd Mon Mar 7 23:46:55 2022 +0000 linux/arm64
What operating system and processor architecture are you using?
linux/arm64
What did you do?
<1>. download the delve souce code.
<2>. cd ./pkg/terminal
<3>. go test -asan -c
<4>. ./terminal.test
What did you expect to see?
pass
What did you see instead?
It reports the error as below.
fatal error: checkptr: pointer arithmetic computed bad pointer value.
goroutine 560 [running]:
runtime.throw({0xd3190a?, 0x204000c98900?})
/home/fanzha02/work/go_project/gotest/src/runtime/panic.go:992 +0x50 fp=0x204000364e90 sp=0x204000364e60 pc=0x438590
runtime.checkptrArithmetic(0xe53b68?, {0x0?, 0x204000364f48?, 0x2?})
/home/fanzha02/work/go_project/gotest/src/runtime/checkptr.go:52 +0xc0 fp=0x204000364ec0 sp=0x204000364e90 pc=0x409c80
github.com/go-delve/delve/pkg/proc/native.processVmRead(0x204001042018?, 0x10, {0x204001042018?, 0x8, 0x204000364fc8?})
/home/fanzha02/sharefolder/asanprojecttest/delve/pkg/proc/native/ptrace_linux_64bit.go:19 +0xc8 fp=0x204000364f70 sp=0x204000364ec0 pc=0x8f6ae8
github.com/go-delve/delve/pkg/proc/native.(*nativeThread).ReadMemory(0x2040006ca790, {0x204001042018, 0x8, 0x8}, 0x10)
/home/fanzha02/sharefolder/asanprojecttest/delve/pkg/proc/native/threads_linux.go:112 +0xc4 fp=0x204000365020 sp=0x204000364f70 pc=0x8fa514
github.com/go-delve/delve/pkg/proc.readUintRaw({0xe55340, 0x2040006ca790}, 0x204000365128?, 0x8)
/home/fanzha02/sharefolder/asanprojecttest/delve/pkg/proc/variables.go:1694 +0x68 fp=0x204000365080 sp=0x204000365020 pc=0x878898
github.com/go-delve/delve/pkg/proc.getGVariable({0xe5bb80, 0x2040006ca790})
/home/fanzha02/sharefolder/asanprojecttest/delve/pkg/proc/variables.go:445 +0x23c fp=0x204000365170 sp=0x204000365080 pc=0x86c53c
The text was updated successfully, but these errors were encountered: