Commit 924c161d authored by Russ Cox's avatar Russ Cox

runtime: fix vet complaints for all freebsd, netbsd, openbsd

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 GOOSes,
while keeping "GO_BUILDER_NAME=misc-vetall go tool dist test" happy too.

For #31916.

Change-Id: I63c4805bdd44b301072da66c77086940e2a2765e
Reviewed-on: https://go-review.googlesource.com/c/go/+/176105
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: default avatarAustin Clements <austin@google.com>
Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
parent b4a472b1
// freebsd/386-specific vet whitelist. See readme.txt for details.
runtime/sys_freebsd_386.s: [386] thr_start: unknown variable mm
runtime/sys_freebsd_386.s: [386] sigtramp: unknown variable signo
runtime/sys_freebsd_386.s: [386] sigtramp: unknown variable info
runtime/sys_freebsd_386.s: [386] sigtramp: unknown variable context
runtime/sys_freebsd_386.s: [386] sigtramp: unknown variable context
runtime/sys_freebsd_386.s: [386] i386_set_ldt: function i386_set_ldt missing Go declaration
// netbsd/386-specific vet whitelist. See readme.txt for details.
runtime/sys_netbsd_386.s: [386] sigreturn_tramp: use of 140(SP) points beyond argument frame
runtime/sys_netbsd_386.s: [386] sigreturn_tramp: use of 4(SP) points beyond argument frame
runtime/sys_netbsd_386.s: [386] sigreturn_tramp: use of 4(SP) points beyond argument frame
runtime/sys_netbsd_386.s: [386] sigtramp: unknown variable signo
runtime/sys_netbsd_386.s: [386] sigtramp: unknown variable info
runtime/sys_netbsd_386.s: [386] sigtramp: unknown variable context
runtime/sys_netbsd_ARCHSUFF.s: [GOARCH] sigreturn_tramp: function sigreturn_tramp missing Go declaration
// openbsd/386-specific vet whitelist. See readme.txt for details.
runtime/sys_openbsd_386.s: [386] sigtramp: unknown variable signo
runtime/sys_openbsd_386.s: [386] sigtramp: unknown variable info
runtime/sys_openbsd_386.s: [386] sigtramp: unknown variable context
...@@ -22,8 +22,10 @@ TEXT runtime·thr_new(SB),NOSPLIT,$-4 ...@@ -22,8 +22,10 @@ TEXT runtime·thr_new(SB),NOSPLIT,$-4
MOVL AX, ret+8(FP) MOVL AX, ret+8(FP)
RET RET
// Called by OS using C ABI.
TEXT runtime·thr_start(SB),NOSPLIT,$0 TEXT runtime·thr_start(SB),NOSPLIT,$0
MOVL mm+0(FP), AX NOP SP // tell vet SP changed - stop checking offsets
MOVL 4(SP), AX // m
MOVL m_g0(AX), BX MOVL m_g0(AX), BX
LEAL m_tls(AX), BP LEAL m_tls(AX), BP
MOVL m_id(AX), DI MOVL m_id(AX), DI
...@@ -234,17 +236,19 @@ TEXT runtime·sigfwd(SB),NOSPLIT,$12-16 ...@@ -234,17 +236,19 @@ TEXT runtime·sigfwd(SB),NOSPLIT,$12-16
MOVL AX, SP MOVL AX, SP
RET RET
// Called by OS using C ABI.
TEXT runtime·sigtramp(SB),NOSPLIT,$12 TEXT runtime·sigtramp(SB),NOSPLIT,$12
MOVL signo+0(FP), BX NOP SP // tell vet SP changed - stop checking offsets
MOVL 16(SP), BX // signo
MOVL BX, 0(SP) MOVL BX, 0(SP)
MOVL info+4(FP), BX MOVL 20(SP), BX // info
MOVL BX, 4(SP) MOVL BX, 4(SP)
MOVL context+8(FP), BX MOVL 24(SP), BX // context
MOVL BX, 8(SP) MOVL BX, 8(SP)
CALL runtime·sigtrampgo(SB) CALL runtime·sigtrampgo(SB)
// call sigreturn // call sigreturn
MOVL context+8(FP), AX MOVL 24(SP), AX // context
MOVL $0, 0(SP) // syscall gap MOVL $0, 0(SP) // syscall gap
MOVL AX, 4(SP) MOVL AX, 4(SP)
MOVL $417, AX // sigreturn(ucontext) MOVL $417, AX // sigreturn(ucontext)
...@@ -319,7 +323,7 @@ TEXT runtime·setldt(SB),NOSPLIT,$32 ...@@ -319,7 +323,7 @@ TEXT runtime·setldt(SB),NOSPLIT,$32
MOVL $0xffffffff, 0(SP) // auto-allocate entry and return in AX MOVL $0xffffffff, 0(SP) // auto-allocate entry and return in AX
MOVL AX, 4(SP) MOVL AX, 4(SP)
MOVL $1, 8(SP) MOVL $1, 8(SP)
CALL runtime·i386_set_ldt(SB) CALL i386_set_ldt<>(SB)
// compute segment selector - (entry*8+7) // compute segment selector - (entry*8+7)
SHLL $3, AX SHLL $3, AX
...@@ -327,7 +331,7 @@ TEXT runtime·setldt(SB),NOSPLIT,$32 ...@@ -327,7 +331,7 @@ TEXT runtime·setldt(SB),NOSPLIT,$32
MOVW AX, GS MOVW AX, GS
RET RET
TEXT runtime·i386_set_ldt(SB),NOSPLIT,$16 TEXT i386_set_ldt<>(SB),NOSPLIT,$16
LEAL args+0(FP), AX // 0(FP) == 4(SP) before SP got moved LEAL args+0(FP), AX // 0(FP) == 4(SP) before SP got moved
MOVL $0, 0(SP) // syscall gap MOVL $0, 0(SP) // syscall gap
MOVL $1, 4(SP) MOVL $1, 4(SP)
......
...@@ -236,7 +236,7 @@ TEXT runtime·sigprocmask(SB),NOSPLIT,$-4 ...@@ -236,7 +236,7 @@ TEXT runtime·sigprocmask(SB),NOSPLIT,$-4
MOVL $0xf1, 0xf1 // crash MOVL $0xf1, 0xf1 // crash
RET RET
TEXT runtime·sigreturn_tramp(SB),NOSPLIT,$0 TEXT sigreturn_tramp<>(SB),NOSPLIT,$0
LEAL 140(SP), AX // Load address of ucontext LEAL 140(SP), AX // Load address of ucontext
MOVL AX, 4(SP) MOVL AX, 4(SP)
MOVL $SYS_setcontext, AX MOVL $SYS_setcontext, AX
...@@ -252,7 +252,7 @@ TEXT runtime·sigaction(SB),NOSPLIT,$24 ...@@ -252,7 +252,7 @@ TEXT runtime·sigaction(SB),NOSPLIT,$24
MOVSL // arg 1 - sig MOVSL // arg 1 - sig
MOVSL // arg 2 - act MOVSL // arg 2 - act
MOVSL // arg 3 - oact MOVSL // arg 3 - oact
LEAL runtime·sigreturn_tramp(SB), AX LEAL sigreturn_tramp<>(SB), AX
STOSL // arg 4 - tramp STOSL // arg 4 - tramp
MOVL $2, AX MOVL $2, AX
STOSL // arg 5 - vers STOSL // arg 5 - vers
...@@ -279,7 +279,9 @@ TEXT runtime·sigfwd(SB),NOSPLIT,$12-16 ...@@ -279,7 +279,9 @@ TEXT runtime·sigfwd(SB),NOSPLIT,$12-16
MOVL AX, SP MOVL AX, SP
RET RET
// Called by OS using C ABI.
TEXT runtime·sigtramp(SB),NOSPLIT,$28 TEXT runtime·sigtramp(SB),NOSPLIT,$28
NOP SP // tell vet SP changed - stop checking offsets
// Save callee-saved C registers, since the caller may be a C signal handler. // Save callee-saved C registers, since the caller may be a C signal handler.
MOVL BX, bx-4(SP) MOVL BX, bx-4(SP)
MOVL BP, bp-8(SP) MOVL BP, bp-8(SP)
...@@ -288,11 +290,11 @@ TEXT runtime·sigtramp(SB),NOSPLIT,$28 ...@@ -288,11 +290,11 @@ TEXT runtime·sigtramp(SB),NOSPLIT,$28
// We don't save mxcsr or the x87 control word because sigtrampgo doesn't // We don't save mxcsr or the x87 control word because sigtrampgo doesn't
// modify them. // modify them.
MOVL signo+0(FP), BX MOVL 32(SP), BX // signo
MOVL BX, 0(SP) MOVL BX, 0(SP)
MOVL info+4(FP), BX MOVL 36(SP), BX // info
MOVL BX, 4(SP) MOVL BX, 4(SP)
MOVL context+8(FP), BX MOVL 40(SP), BX // context
MOVL BX, 8(SP) MOVL BX, 8(SP)
CALL runtime·sigtrampgo(SB) CALL runtime·sigtrampgo(SB)
......
...@@ -258,7 +258,7 @@ TEXT runtime·sigprocmask(SB),NOSPLIT,$0 ...@@ -258,7 +258,7 @@ TEXT runtime·sigprocmask(SB),NOSPLIT,$0
MOVL $0xf1, 0xf1 // crash MOVL $0xf1, 0xf1 // crash
RET RET
TEXT runtime·sigreturn_tramp(SB),NOSPLIT,$-8 TEXT sigreturn_tramp<>(SB),NOSPLIT,$-8
MOVQ R15, DI // Load address of ucontext MOVQ R15, DI // Load address of ucontext
MOVQ $SYS_setcontext, AX MOVQ $SYS_setcontext, AX
SYSCALL SYSCALL
...@@ -271,7 +271,7 @@ TEXT runtime·sigaction(SB),NOSPLIT,$-8 ...@@ -271,7 +271,7 @@ TEXT runtime·sigaction(SB),NOSPLIT,$-8
MOVQ new+8(FP), SI // arg 2 - nsa MOVQ new+8(FP), SI // arg 2 - nsa
MOVQ old+16(FP), DX // arg 3 - osa MOVQ old+16(FP), DX // arg 3 - osa
// arg 4 - tramp // arg 4 - tramp
LEAQ runtime·sigreturn_tramp(SB), R10 LEAQ sigreturn_tramp<>(SB), R10
MOVQ $2, R8 // arg 5 - vers MOVQ $2, R8 // arg 5 - vers
MOVL $SYS___sigaction_sigtramp, AX MOVL $SYS___sigaction_sigtramp, AX
SYSCALL SYSCALL
......
...@@ -240,7 +240,7 @@ TEXT runtime·sigprocmask(SB),NOSPLIT,$0 ...@@ -240,7 +240,7 @@ TEXT runtime·sigprocmask(SB),NOSPLIT,$0
MOVW.CS R8, (R8) MOVW.CS R8, (R8)
RET RET
TEXT runtime·sigreturn_tramp(SB),NOSPLIT|NOFRAME,$0 TEXT sigreturn_tramp<>(SB),NOSPLIT|NOFRAME,$0
// on entry, SP points to siginfo, we add sizeof(ucontext) // on entry, SP points to siginfo, we add sizeof(ucontext)
// to SP to get a pointer to ucontext. // to SP to get a pointer to ucontext.
ADD $0x80, R13, R0 // 0x80 == sizeof(UcontextT) ADD $0x80, R13, R0 // 0x80 == sizeof(UcontextT)
...@@ -254,7 +254,7 @@ TEXT runtime·sigaction(SB),NOSPLIT,$4 ...@@ -254,7 +254,7 @@ TEXT runtime·sigaction(SB),NOSPLIT,$4
MOVW sig+0(FP), R0 // arg 1 - signum MOVW sig+0(FP), R0 // arg 1 - signum
MOVW new+4(FP), R1 // arg 2 - nsa MOVW new+4(FP), R1 // arg 2 - nsa
MOVW old+8(FP), R2 // arg 3 - osa MOVW old+8(FP), R2 // arg 3 - osa
MOVW $runtime·sigreturn_tramp(SB), R3 // arg 4 - tramp MOVW $sigreturn_tramp<>(SB), R3 // arg 4 - tramp
MOVW $2, R4 // arg 5 - vers MOVW $2, R4 // arg 5 - vers
MOVW R4, 4(R13) MOVW R4, 4(R13)
ADD $4, R13 // pass arg 5 on stack ADD $4, R13 // pass arg 5 on stack
......
...@@ -249,7 +249,7 @@ fail: ...@@ -249,7 +249,7 @@ fail:
MOVD $0, R0 MOVD $0, R0
MOVD R0, (R0) // crash MOVD R0, (R0) // crash
TEXT runtime·sigreturn_tramp(SB),NOSPLIT,$-8 TEXT sigreturn_tramp<>(SB),NOSPLIT,$-8
MOVD g, R0 MOVD g, R0
SVC $SYS_setcontext SVC $SYS_setcontext
MOVD $0x4242, R0 // Something failed, return magic number MOVD $0x4242, R0 // Something failed, return magic number
...@@ -260,7 +260,7 @@ TEXT runtime·sigaction(SB),NOSPLIT,$-8 ...@@ -260,7 +260,7 @@ TEXT runtime·sigaction(SB),NOSPLIT,$-8
MOVD new+8(FP), R1 // arg 2 - nsa MOVD new+8(FP), R1 // arg 2 - nsa
MOVD old+16(FP), R2 // arg 3 - osa MOVD old+16(FP), R2 // arg 3 - osa
// arg 4 - tramp // arg 4 - tramp
MOVD $runtime·sigreturn_tramp(SB), R3 MOVD $sigreturn_tramp<>(SB), R3
MOVW $2, R4 // arg 5 - vers MOVW $2, R4 // arg 5 - vers
SVC $SYS___sigaction_sigtramp SVC $SYS___sigaction_sigtramp
BCS fail BCS fail
......
...@@ -218,7 +218,9 @@ TEXT runtime·sigfwd(SB),NOSPLIT,$12-16 ...@@ -218,7 +218,9 @@ TEXT runtime·sigfwd(SB),NOSPLIT,$12-16
MOVL AX, SP MOVL AX, SP
RET RET
// Called by OS using C ABI.
TEXT runtime·sigtramp(SB),NOSPLIT,$28 TEXT runtime·sigtramp(SB),NOSPLIT,$28
NOP SP // tell vet SP changed - stop checking offsets
// Save callee-saved C registers, since the caller may be a C signal handler. // Save callee-saved C registers, since the caller may be a C signal handler.
MOVL BX, bx-4(SP) MOVL BX, bx-4(SP)
MOVL BP, bp-8(SP) MOVL BP, bp-8(SP)
...@@ -227,11 +229,11 @@ TEXT runtime·sigtramp(SB),NOSPLIT,$28 ...@@ -227,11 +229,11 @@ TEXT runtime·sigtramp(SB),NOSPLIT,$28
// We don't save mxcsr or the x87 control word because sigtrampgo doesn't // We don't save mxcsr or the x87 control word because sigtrampgo doesn't
// modify them. // modify them.
MOVL signo+0(FP), BX MOVL 32(SP), BX // signo
MOVL BX, 0(SP) MOVL BX, 0(SP)
MOVL info+4(FP), BX MOVL 36(SP), BX // info
MOVL BX, 4(SP) MOVL BX, 4(SP)
MOVL context+8(FP), BX MOVL 40(SP), BX // context
MOVL BX, 8(SP) MOVL BX, 8(SP)
CALL runtime·sigtrampgo(SB) CALL runtime·sigtrampgo(SB)
......
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