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
hanchao886
changed the title
syscall: call functions syscall.Syscall recursively will return abnormal data
syscall: syscall.Syscall return abnormal data
Aug 8, 2022
By using this POC, this issue is inevitable. Suspicion is related to the number of calling layers. And the result by using POC is the same every time. And I use golang 1.17 and golang1.18 to reproduce this issue, and they all have the same problem.
This code is using unsafe.Pointer in an invalid way. You can't write uintptr(unsafe.Pointer(&termios)) and then pass that value to another function. See the docs at https://pkg.go.dev/unsafe#Pointer. It looks like you are trying to use rule 4, but that is only valid when calling a function written in assembly code, not when calling a function like ioctl in your example.
If you change your ioctl function to take unsafe.Pointer, and pass unsafe.Pointer(&termios) without converting to uintptr, then the program works.
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?
What did you expect to see?
The function
syscall.Syscall
returned is correct or return err.What did you see instead?
syscall.Syscall not return err, but the return data
termios
all is zero.This issue does not occur in golang1.16.
The text was updated successfully, but these errors were encountered: