Commit 60f67631 authored by Russ Cox's avatar Russ Cox

runtime: fix vet complaints for solaris/amd64, illumos/amd64

Working toward making the tree vet-safe instead of having
so many exceptions in cmd/vet/all/whitelist.

This CL makes "go vet -unsafeptr=false runtime" happy for these GOOS/GOARCHes,
while keeping "GO_BUILDER_NAME=misc-vetall go tool dist test" happy too.

For #31916.

Change-Id: Ic64f7f4034695dd4c32c9b7f258960faf3742a83
Reviewed-on: https://go-review.googlesource.com/c/go/+/176103
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: default avatarAustin Clements <austin@google.com>
Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
parent 49f62af7
// illumos/amd64-specific vet whitelist. See readme.txt for details.
runtime/sys_solaris_amd64.s: [amd64] pipe1: function pipe1 missing Go declaration
runtime/sys_solaris_amd64.s: [amd64] asmsysvicall6: function asmsysvicall6 missing Go declaration
runtime/sys_solaris_amd64.s: [amd64] usleep2: function usleep2 missing Go declaration
// solaris/amd64-specific vet whitelist. See readme.txt for details.
runtime/sys_solaris_amd64.s: [amd64] pipe1: function pipe1 missing Go declaration
runtime/sys_solaris_amd64.s: [amd64] asmsysvicall6: function asmsysvicall6 missing Go declaration
runtime/sys_solaris_amd64.s: [amd64] usleep2: function usleep2 missing Go declaration
......@@ -294,7 +294,7 @@ func semacreate(mp *m) {
_g_.m.scratch = mscratch{}
_g_.m.scratch.v[0] = unsafe.Sizeof(*sem)
_g_.m.libcall.args = uintptr(unsafe.Pointer(&_g_.m.scratch))
asmcgocall(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&_g_.m.libcall))
asmcgocall(unsafe.Pointer(&asmsysvicall6x), unsafe.Pointer(&_g_.m.libcall))
sem = (*semt)(unsafe.Pointer(_g_.m.libcall.r1))
if sem_init(sem, 0, 0) != 0 {
throw("sem_init")
......@@ -315,7 +315,7 @@ func semasleep(ns int64) int32 {
_m_.scratch.v[0] = _m_.waitsema
_m_.scratch.v[1] = uintptr(unsafe.Pointer(&_m_.ts))
_m_.libcall.args = uintptr(unsafe.Pointer(&_m_.scratch))
asmcgocall(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&_m_.libcall))
asmcgocall(unsafe.Pointer(&asmsysvicall6x), unsafe.Pointer(&_m_.libcall))
if *_m_.perrno != 0 {
if *_m_.perrno == _ETIMEDOUT || *_m_.perrno == _EAGAIN || *_m_.perrno == _EINTR {
return -1
......@@ -330,7 +330,7 @@ func semasleep(ns int64) int32 {
_m_.scratch = mscratch{}
_m_.scratch.v[0] = _m_.waitsema
_m_.libcall.args = uintptr(unsafe.Pointer(&_m_.scratch))
asmcgocall(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&_m_.libcall))
asmcgocall(unsafe.Pointer(&asmsysvicall6x), unsafe.Pointer(&_m_.libcall))
if _m_.libcall.r1 == 0 {
break
}
......@@ -384,7 +384,7 @@ func doMmap(addr, n, prot, flags, fd, off uintptr) (uintptr, uintptr) {
libcall.fn = uintptr(unsafe.Pointer(&libc_mmap))
libcall.n = 6
libcall.args = uintptr(noescape(unsafe.Pointer(&addr)))
asmcgocall(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&libcall))
asmcgocall(unsafe.Pointer(&asmsysvicall6x), unsafe.Pointer(&libcall))
return libcall.r1, libcall.err
}
......
......@@ -27,7 +27,10 @@ type mOS struct {
type libcFunc uintptr
var asmsysvicall6 libcFunc
//go:linkname asmsysvicall6x runtime.asmsysvicall6
var asmsysvicall6x libcFunc // name to take addr of asmsysvicall6
func asmsysvicall6() // declared for vet; do NOT call
//go:nosplit
func sysvicall0(fn *libcFunc) uintptr {
......@@ -51,7 +54,7 @@ func sysvicall0(fn *libcFunc) uintptr {
libcall.fn = uintptr(unsafe.Pointer(fn))
libcall.n = 0
libcall.args = uintptr(unsafe.Pointer(fn)) // it's unused but must be non-nil, otherwise crashes
asmcgocall(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&libcall))
asmcgocall(unsafe.Pointer(&asmsysvicall6x), unsafe.Pointer(&libcall))
if mp != nil {
mp.libcallsp = 0
}
......@@ -81,7 +84,7 @@ func sysvicall1(fn *libcFunc, a1 uintptr) uintptr {
libcall.n = 1
// TODO(rsc): Why is noescape necessary here and below?
libcall.args = uintptr(noescape(unsafe.Pointer(&a1)))
asmcgocall(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&libcall))
asmcgocall(unsafe.Pointer(&asmsysvicall6x), unsafe.Pointer(&libcall))
if mp != nil {
mp.libcallsp = 0
}
......@@ -110,7 +113,7 @@ func sysvicall2(fn *libcFunc, a1, a2 uintptr) uintptr {
libcall.fn = uintptr(unsafe.Pointer(fn))
libcall.n = 2
libcall.args = uintptr(noescape(unsafe.Pointer(&a1)))
asmcgocall(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&libcall))
asmcgocall(unsafe.Pointer(&asmsysvicall6x), unsafe.Pointer(&libcall))
if mp != nil {
mp.libcallsp = 0
}
......@@ -139,7 +142,7 @@ func sysvicall3(fn *libcFunc, a1, a2, a3 uintptr) uintptr {
libcall.fn = uintptr(unsafe.Pointer(fn))
libcall.n = 3
libcall.args = uintptr(noescape(unsafe.Pointer(&a1)))
asmcgocall(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&libcall))
asmcgocall(unsafe.Pointer(&asmsysvicall6x), unsafe.Pointer(&libcall))
if mp != nil {
mp.libcallsp = 0
}
......@@ -168,7 +171,7 @@ func sysvicall4(fn *libcFunc, a1, a2, a3, a4 uintptr) uintptr {
libcall.fn = uintptr(unsafe.Pointer(fn))
libcall.n = 4
libcall.args = uintptr(noescape(unsafe.Pointer(&a1)))
asmcgocall(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&libcall))
asmcgocall(unsafe.Pointer(&asmsysvicall6x), unsafe.Pointer(&libcall))
if mp != nil {
mp.libcallsp = 0
}
......@@ -197,7 +200,7 @@ func sysvicall5(fn *libcFunc, a1, a2, a3, a4, a5 uintptr) uintptr {
libcall.fn = uintptr(unsafe.Pointer(fn))
libcall.n = 5
libcall.args = uintptr(noescape(unsafe.Pointer(&a1)))
asmcgocall(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&libcall))
asmcgocall(unsafe.Pointer(&asmsysvicall6x), unsafe.Pointer(&libcall))
if mp != nil {
mp.libcallsp = 0
}
......@@ -226,7 +229,7 @@ func sysvicall6(fn *libcFunc, a1, a2, a3, a4, a5, a6 uintptr) uintptr {
libcall.fn = uintptr(unsafe.Pointer(fn))
libcall.n = 6
libcall.args = uintptr(noescape(unsafe.Pointer(&a1)))
asmcgocall(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&libcall))
asmcgocall(unsafe.Pointer(&asmsysvicall6x), unsafe.Pointer(&libcall))
if mp != nil {
mp.libcallsp = 0
}
......
......@@ -291,7 +291,7 @@ TEXT runtime·sigfwd(SB),NOSPLIT,$0-32
// can also be called in cgo callback path without a g->m.
TEXT runtime·usleep1(SB),NOSPLIT,$0
MOVL usec+0(FP), DI
MOVQ $runtime·usleep2(SB), AX // to hide from 6l
MOVQ $usleep2<>(SB), AX // to hide from 6l
// Execute call on m->g0.
get_tls(R15)
......@@ -328,7 +328,7 @@ noswitch:
RET
// Runs on OS stack. duration (in µs units) is in DI.
TEXT runtime·usleep2(SB),NOSPLIT,$0
TEXT usleep2<>(SB),NOSPLIT,$0
LEAQ libc_usleep(SB), AX
CALL AX
RET
......
......@@ -23,10 +23,14 @@ var (
libc_setuid,
libc_setpgid,
libc_syscall,
libc_wait4,
pipe1 libcFunc
libc_wait4 libcFunc
)
//go:linkname pipe1x runtime.pipe1
var pipe1x libcFunc // name to take addr of pipe1
func pipe1() // declared for vet; do NOT call
//go:nosplit
func syscall_sysvicall6(fn, nargs, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, err uintptr) {
call := libcall{
......@@ -35,7 +39,7 @@ func syscall_sysvicall6(fn, nargs, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, err
args: uintptr(unsafe.Pointer(&a1)),
}
entersyscallblock()
asmcgocall(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&call))
asmcgocall(unsafe.Pointer(&asmsysvicall6x), unsafe.Pointer(&call))
exitsyscall()
return call.r1, call.r2, call.err
}
......@@ -47,7 +51,7 @@ func syscall_rawsysvicall6(fn, nargs, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, e
n: nargs,
args: uintptr(unsafe.Pointer(&a1)),
}
asmcgocall(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&call))
asmcgocall(unsafe.Pointer(&asmsysvicall6x), unsafe.Pointer(&call))
return call.r1, call.r2, call.err
}
......@@ -62,7 +66,7 @@ func syscall_chdir(path uintptr) (err uintptr) {
n: 1,
args: uintptr(unsafe.Pointer(&path)),
}
asmcgocall(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&call))
asmcgocall(unsafe.Pointer(&asmsysvicall6x), unsafe.Pointer(&call))
return call.err
}
......@@ -73,7 +77,7 @@ func syscall_chroot(path uintptr) (err uintptr) {
n: 1,
args: uintptr(unsafe.Pointer(&path)),
}
asmcgocall(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&call))
asmcgocall(unsafe.Pointer(&asmsysvicall6x), unsafe.Pointer(&call))
return call.err
}
......@@ -97,7 +101,7 @@ func syscall_execve(path, argv, envp uintptr) (err uintptr) {
n: 3,
args: uintptr(unsafe.Pointer(&path)),
}
asmcgocall(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&call))
asmcgocall(unsafe.Pointer(&asmsysvicall6x), unsafe.Pointer(&call))
return call.err
}
......@@ -114,7 +118,7 @@ func syscall_fcntl(fd, cmd, arg uintptr) (val, err uintptr) {
n: 3,
args: uintptr(unsafe.Pointer(&fd)),
}
asmcgocall(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&call))
asmcgocall(unsafe.Pointer(&asmsysvicall6x), unsafe.Pointer(&call))
return call.r1, call.err
}
......@@ -125,7 +129,7 @@ func syscall_forkx(flags uintptr) (pid uintptr, err uintptr) {
n: 1,
args: uintptr(unsafe.Pointer(&flags)),
}
asmcgocall(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&call))
asmcgocall(unsafe.Pointer(&asmsysvicall6x), unsafe.Pointer(&call))
return call.r1, call.err
}
......@@ -138,7 +142,7 @@ func syscall_gethostname() (name string, err uintptr) {
args: uintptr(unsafe.Pointer(&args[0])),
}
entersyscallblock()
asmcgocall(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&call))
asmcgocall(unsafe.Pointer(&asmsysvicall6x), unsafe.Pointer(&call))
exitsyscall()
if call.r1 != 0 {
return "", call.err
......@@ -154,7 +158,7 @@ func syscall_getpid() (pid, err uintptr) {
n: 0,
args: uintptr(unsafe.Pointer(&libc_getpid)), // it's unused but must be non-nil, otherwise crashes
}
asmcgocall(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&call))
asmcgocall(unsafe.Pointer(&asmsysvicall6x), unsafe.Pointer(&call))
return call.r1, call.err
}
......@@ -165,18 +169,18 @@ func syscall_ioctl(fd, req, arg uintptr) (err uintptr) {
n: 3,
args: uintptr(unsafe.Pointer(&fd)),
}
asmcgocall(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&call))
asmcgocall(unsafe.Pointer(&asmsysvicall6x), unsafe.Pointer(&call))
return call.err
}
func syscall_pipe() (r, w, err uintptr) {
call := libcall{
fn: uintptr(unsafe.Pointer(&pipe1)),
fn: uintptr(unsafe.Pointer(&pipe1x)),
n: 0,
args: uintptr(unsafe.Pointer(&pipe1)), // it's unused but must be non-nil, otherwise crashes
args: uintptr(unsafe.Pointer(&pipe1x)), // it's unused but must be non-nil, otherwise crashes
}
entersyscallblock()
asmcgocall(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&call))
asmcgocall(unsafe.Pointer(&asmsysvicall6x), unsafe.Pointer(&call))
exitsyscall()
return call.r1, call.r2, call.err
}
......@@ -200,7 +204,7 @@ func syscall_setgid(gid uintptr) (err uintptr) {
n: 1,
args: uintptr(unsafe.Pointer(&gid)),
}
asmcgocall(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&call))
asmcgocall(unsafe.Pointer(&asmsysvicall6x), unsafe.Pointer(&call))
return call.err
}
......@@ -211,7 +215,7 @@ func syscall_setgroups(ngid, gid uintptr) (err uintptr) {
n: 2,
args: uintptr(unsafe.Pointer(&ngid)),
}
asmcgocall(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&call))
asmcgocall(unsafe.Pointer(&asmsysvicall6x), unsafe.Pointer(&call))
return call.err
}
......@@ -222,7 +226,7 @@ func syscall_setsid() (pid, err uintptr) {
n: 0,
args: uintptr(unsafe.Pointer(&libc_setsid)), // it's unused but must be non-nil, otherwise crashes
}
asmcgocall(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&call))
asmcgocall(unsafe.Pointer(&asmsysvicall6x), unsafe.Pointer(&call))
return call.r1, call.err
}
......@@ -233,7 +237,7 @@ func syscall_setuid(uid uintptr) (err uintptr) {
n: 1,
args: uintptr(unsafe.Pointer(&uid)),
}
asmcgocall(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&call))
asmcgocall(unsafe.Pointer(&asmsysvicall6x), unsafe.Pointer(&call))
return call.err
}
......@@ -244,7 +248,7 @@ func syscall_setpgid(pid, pgid uintptr) (err uintptr) {
n: 2,
args: uintptr(unsafe.Pointer(&pid)),
}
asmcgocall(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&call))
asmcgocall(unsafe.Pointer(&asmsysvicall6x), unsafe.Pointer(&call))
return call.err
}
......@@ -255,7 +259,7 @@ func syscall_syscall(trap, a1, a2, a3 uintptr) (r1, r2, err uintptr) {
args: uintptr(unsafe.Pointer(&trap)),
}
entersyscallblock()
asmcgocall(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&call))
asmcgocall(unsafe.Pointer(&asmsysvicall6x), unsafe.Pointer(&call))
exitsyscall()
return call.r1, call.r2, call.err
}
......@@ -267,7 +271,7 @@ func syscall_wait4(pid uintptr, wstatus *uint32, options uintptr, rusage unsafe.
args: uintptr(unsafe.Pointer(&pid)),
}
entersyscallblock()
asmcgocall(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&call))
asmcgocall(unsafe.Pointer(&asmsysvicall6x), unsafe.Pointer(&call))
exitsyscall()
return int(call.r1), call.err
}
......@@ -279,6 +283,6 @@ func syscall_write(fd, buf, nbyte uintptr) (n, err uintptr) {
n: 3,
args: uintptr(unsafe.Pointer(&fd)),
}
asmcgocall(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&call))
asmcgocall(unsafe.Pointer(&asmsysvicall6x), unsafe.Pointer(&call))
return call.r1, call.err
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment