Skip to content

Commit 20130cc

Browse files
committed
syscall: remove references to SYS_syscall on openbsd
OpenBSD 7.5 no longer has a syscall symbol in libc. This will typically result in external linking failures since the syscall package still has a reference to an undefined `syscall' symbol. Remove these references and return ENOSYS if syscall.Syscall* or syscall.RawSyscall* are used for a system call number that does not currently have an internal remapping. Fixes #63900 Change-Id: Ic757bf8872ad98a92dd5b34cf58312c32fbc9a96 Reviewed-on: https://go-review.googlesource.com/c/go/+/582257 Reviewed-by: Ian Lance Taylor <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: David Chase <[email protected]>
1 parent 8841f50 commit 20130cc

13 files changed

+5
-110
lines changed

src/syscall/syscall_openbsd_libc.go

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ func init() {
1616
execveOpenBSD = execve
1717
}
1818

19-
//sys directSyscall(trap uintptr, a1 uintptr, a2 uintptr, a3 uintptr, a4 uintptr, a5 uintptr) (ret uintptr, err error) = SYS_syscall
20-
2119
func syscallInternal(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno) {
2220
// OpenBSD 7.5+ no longer supports indirect syscalls. A number of Go
2321
// packages make use of syscall.Syscall with SYS_IOCTL since it is
@@ -27,7 +25,7 @@ func syscallInternal(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno) {
2725
if trap == SYS_IOCTL {
2826
return syscallX(abi.FuncPCABI0(libc_ioctl_trampoline), a1, a2, a3)
2927
}
30-
return syscall6X(abi.FuncPCABI0(libc_syscall_trampoline), trap, a1, a2, a3, 0, 0)
28+
return 0, 0, ENOSYS
3129
}
3230

3331
func syscall6Internal(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno) {
@@ -39,19 +37,19 @@ func syscall6Internal(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err
3937
if trap == SYS___SYSCTL {
4038
return syscall6X(abi.FuncPCABI0(libc_sysctl_trampoline), a1, a2, a3, a4, a5, a6)
4139
}
42-
return syscall10X(abi.FuncPCABI0(libc_syscall_trampoline), trap, a1, a2, a3, a4, a5, a6, 0, 0, 0)
40+
return 0, 0, ENOSYS
4341
}
4442

4543
func rawSyscallInternal(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno) {
46-
return rawSyscall6X(abi.FuncPCABI0(libc_syscall_trampoline), trap, a1, a2, a3, 0, 0)
44+
return 0, 0, ENOSYS
4745
}
4846

4947
func rawSyscall6Internal(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno) {
50-
return rawSyscall10X(abi.FuncPCABI0(libc_syscall_trampoline), trap, a1, a2, a3, a4, a5, a6, 0, 0, 0)
48+
return 0, 0, ENOSYS
5149
}
5250

5351
func syscall9Internal(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err Errno) {
54-
return rawSyscall10X(abi.FuncPCABI0(libc_syscall_trampoline), trap, a1, a2, a3, a4, a5, a6, a7, a8, a9)
52+
return 0, 0, ENOSYS
5553
}
5654

5755
// Implemented in the runtime package (runtime/sys_openbsd3.go)

src/syscall/zsyscall_openbsd_386.go

Lines changed: 0 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/syscall/zsyscall_openbsd_386.s

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,8 +213,6 @@ TEXT ·libc_getfsstat_trampoline(SB),NOSPLIT,$0-0
213213
JMP libc_getfsstat(SB)
214214
TEXT ·libc_utimensat_trampoline(SB),NOSPLIT,$0-0
215215
JMP libc_utimensat(SB)
216-
TEXT ·libc_syscall_trampoline(SB),NOSPLIT,$0-0
217-
JMP libc_syscall(SB)
218216
TEXT ·libc_lseek_trampoline(SB),NOSPLIT,$0-0
219217
JMP libc_lseek(SB)
220218
TEXT ·libc_getcwd_trampoline(SB),NOSPLIT,$0-0

src/syscall/zsyscall_openbsd_amd64.go

Lines changed: 0 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/syscall/zsyscall_openbsd_amd64.s

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,8 +213,6 @@ TEXT ·libc_getfsstat_trampoline(SB),NOSPLIT,$0-0
213213
JMP libc_getfsstat(SB)
214214
TEXT ·libc_utimensat_trampoline(SB),NOSPLIT,$0-0
215215
JMP libc_utimensat(SB)
216-
TEXT ·libc_syscall_trampoline(SB),NOSPLIT,$0-0
217-
JMP libc_syscall(SB)
218216
TEXT ·libc_lseek_trampoline(SB),NOSPLIT,$0-0
219217
JMP libc_lseek(SB)
220218
TEXT ·libc_getcwd_trampoline(SB),NOSPLIT,$0-0

src/syscall/zsyscall_openbsd_arm.go

Lines changed: 0 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/syscall/zsyscall_openbsd_arm.s

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,8 +213,6 @@ TEXT ·libc_getfsstat_trampoline(SB),NOSPLIT,$0-0
213213
JMP libc_getfsstat(SB)
214214
TEXT ·libc_utimensat_trampoline(SB),NOSPLIT,$0-0
215215
JMP libc_utimensat(SB)
216-
TEXT ·libc_syscall_trampoline(SB),NOSPLIT,$0-0
217-
JMP libc_syscall(SB)
218216
TEXT ·libc_lseek_trampoline(SB),NOSPLIT,$0-0
219217
JMP libc_lseek(SB)
220218
TEXT ·libc_getcwd_trampoline(SB),NOSPLIT,$0-0

src/syscall/zsyscall_openbsd_arm64.go

Lines changed: 0 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/syscall/zsyscall_openbsd_arm64.s

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,8 +213,6 @@ TEXT ·libc_getfsstat_trampoline(SB),NOSPLIT,$0-0
213213
JMP libc_getfsstat(SB)
214214
TEXT ·libc_utimensat_trampoline(SB),NOSPLIT,$0-0
215215
JMP libc_utimensat(SB)
216-
TEXT ·libc_syscall_trampoline(SB),NOSPLIT,$0-0
217-
JMP libc_syscall(SB)
218216
TEXT ·libc_lseek_trampoline(SB),NOSPLIT,$0-0
219217
JMP libc_lseek(SB)
220218
TEXT ·libc_getcwd_trampoline(SB),NOSPLIT,$0-0

src/syscall/zsyscall_openbsd_ppc64.go

Lines changed: 0 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/syscall/zsyscall_openbsd_ppc64.s

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -319,9 +319,6 @@ TEXT ·libc_getfsstat_trampoline(SB),NOSPLIT,$0-0
319319
TEXT ·libc_utimensat_trampoline(SB),NOSPLIT,$0-0
320320
CALL libc_utimensat(SB)
321321
RET
322-
TEXT ·libc_syscall_trampoline(SB),NOSPLIT,$0-0
323-
CALL libc_syscall(SB)
324-
RET
325322
TEXT ·libc_lseek_trampoline(SB),NOSPLIT,$0-0
326323
CALL libc_lseek(SB)
327324
RET

src/syscall/zsyscall_openbsd_riscv64.go

Lines changed: 0 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/syscall/zsyscall_openbsd_riscv64.s

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,8 +213,6 @@ TEXT ·libc_getfsstat_trampoline(SB),NOSPLIT,$0-0
213213
JMP libc_getfsstat(SB)
214214
TEXT ·libc_utimensat_trampoline(SB),NOSPLIT,$0-0
215215
JMP libc_utimensat(SB)
216-
TEXT ·libc_syscall_trampoline(SB),NOSPLIT,$0-0
217-
JMP libc_syscall(SB)
218216
TEXT ·libc_lseek_trampoline(SB),NOSPLIT,$0-0
219217
JMP libc_lseek(SB)
220218
TEXT ·libc_getcwd_trampoline(SB),NOSPLIT,$0-0

0 commit comments

Comments
 (0)