[go] syscall: use direct socket syscalls on linux/386 and linux/s390x

2 views
Skip to first unread message

Chencheng Jiang (Gerrit)

unread,
Jun 6, 2026, 1:02:26 PM (13 hours ago) Jun 6
to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

Chencheng Jiang has uploaded the change for review

Commit message

syscall: use direct socket syscalls on linux/386 and linux/s390x

Linux 4.3 added direct socket syscalls for these ports. Prefer
those syscalls so seccomp can filter socket operations by syscall
number and normal syscall arguments.

If a direct socket syscall returns ENOSYS, fall back to the existing
socketcall path to keep supporting kernels older than Linux 4.3.

Fixes #79200
Change-Id: Ied6d6866f84c1a730889f23a5318afec52f1c60c

Change diff

diff --git a/src/syscall/syscall_linux_386.go b/src/syscall/syscall_linux_386.go
index 00c82df..43e79c6 100644
--- a/src/syscall/syscall_linux_386.go
+++ b/src/syscall/syscall_linux_386.go
@@ -7,10 +7,25 @@
import "unsafe"

const (
- _SYS_setgroups = SYS_SETGROUPS32
- _SYS_clone3 = 435
- _SYS_faccessat2 = 439
- _SYS_fchmodat2 = 452
+ _SYS_setgroups = SYS_SETGROUPS32
+ _SYS_socket = 359
+ _SYS_socketpair = 360
+ _SYS_bind = 361
+ _SYS_connect = 362
+ _SYS_listen = 363
+ _SYS_accept4 = 364
+ _SYS_getsockopt = 365
+ _SYS_setsockopt = 366
+ _SYS_getsockname = 367
+ _SYS_getpeername = 368
+ _SYS_sendto = 369
+ _SYS_sendmsg = 370
+ _SYS_recvfrom = 371
+ _SYS_recvmsg = 372
+ _SYS_shutdown = 373
+ _SYS_clone3 = 435
+ _SYS_faccessat2 = 439
+ _SYS_fchmodat2 = 452
)

func setTimespec(sec, nsec int64) Timespec {
@@ -94,12 +109,11 @@
//sys Utime(path string, buf *Utimbuf) (err error)
//sys utimes(path string, times *[2]Timeval) (err error)

-// On x86 Linux, all the socket calls go through an extra indirection,
-// I think because the 5-register system call interface can't handle
-// the 6-argument calls like sendto and recvfrom. Instead the
-// arguments to the underlying system call are the number below
-// and a pointer to an array of uintptr. We hide the pointer in the
-// socketcall assembly to avoid allocation on every system call.
+// On x86 Linux before Linux 4.3, all the socket calls go through an
+// extra indirection. The arguments to the underlying system call are
+// the number below and a pointer to an array of uintptr. We hide the
+// pointer in the socketcall assembly to avoid allocation on every
+// fallback system call.

const (
// see linux/net.h
@@ -134,7 +148,15 @@
func rawsocketcall(call int, a0, a1, a2, a3, a4, a5 uintptr) (n int, err Errno)

func accept4(s int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (fd int, err error) {
- fd, e := socketcall(_ACCEPT4, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), uintptr(flags), 0, 0)
+ r0, _, e := Syscall6(_SYS_accept4, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), uintptr(flags), 0, 0)
+ if e != ENOSYS {
+ fd = int(r0)
+ if e != 0 {
+ err = e
+ }
+ return
+ }
+ fd, e = socketcall(_ACCEPT4, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), uintptr(flags), 0, 0)
if e != 0 {
err = e
}
@@ -142,7 +164,14 @@
}

func getsockname(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) {
- _, e := rawsocketcall(_GETSOCKNAME, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), 0, 0, 0)
+ _, _, e := RawSyscall(_SYS_getsockname, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)))
+ if e != ENOSYS {
+ if e != 0 {
+ err = e
+ }
+ return
+ }
+ _, e = rawsocketcall(_GETSOCKNAME, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), 0, 0, 0)
if e != 0 {
err = e
}
@@ -150,7 +179,14 @@
}

func getpeername(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) {
- _, e := rawsocketcall(_GETPEERNAME, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), 0, 0, 0)
+ _, _, e := RawSyscall(_SYS_getpeername, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)))
+ if e != ENOSYS {
+ if e != 0 {
+ err = e
+ }
+ return
+ }
+ _, e = rawsocketcall(_GETPEERNAME, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), 0, 0, 0)
if e != 0 {
err = e
}
@@ -158,7 +194,14 @@
}

func socketpair(domain int, typ int, flags int, fd *[2]int32) (err error) {
- _, e := rawsocketcall(_SOCKETPAIR, uintptr(domain), uintptr(typ), uintptr(flags), uintptr(unsafe.Pointer(fd)), 0, 0)
+ _, _, e := RawSyscall6(_SYS_socketpair, uintptr(domain), uintptr(typ), uintptr(flags), uintptr(unsafe.Pointer(fd)), 0, 0)
+ if e != ENOSYS {
+ if e != 0 {
+ err = e
+ }
+ return
+ }
+ _, e = rawsocketcall(_SOCKETPAIR, uintptr(domain), uintptr(typ), uintptr(flags), uintptr(unsafe.Pointer(fd)), 0, 0)
if e != 0 {
err = e
}
@@ -166,7 +209,14 @@
}

func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) {
- _, e := socketcall(_BIND, uintptr(s), uintptr(addr), uintptr(addrlen), 0, 0, 0)
+ _, _, e := Syscall(_SYS_bind, uintptr(s), uintptr(addr), uintptr(addrlen))
+ if e != ENOSYS {
+ if e != 0 {
+ err = e
+ }
+ return
+ }
+ _, e = socketcall(_BIND, uintptr(s), uintptr(addr), uintptr(addrlen), 0, 0, 0)
if e != 0 {
err = e
}
@@ -174,7 +224,14 @@
}

func connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) {
- _, e := socketcall(_CONNECT, uintptr(s), uintptr(addr), uintptr(addrlen), 0, 0, 0)
+ _, _, e := Syscall(_SYS_connect, uintptr(s), uintptr(addr), uintptr(addrlen))
+ if e != ENOSYS {
+ if e != 0 {
+ err = e
+ }
+ return
+ }
+ _, e = socketcall(_CONNECT, uintptr(s), uintptr(addr), uintptr(addrlen), 0, 0, 0)
if e != 0 {
err = e
}
@@ -182,7 +239,15 @@
}

func socket(domain int, typ int, proto int) (fd int, err error) {
- fd, e := rawsocketcall(_SOCKET, uintptr(domain), uintptr(typ), uintptr(proto), 0, 0, 0)
+ r0, _, e := RawSyscall(_SYS_socket, uintptr(domain), uintptr(typ), uintptr(proto))
+ if e != ENOSYS {
+ fd = int(r0)
+ if e != 0 {
+ err = e
+ }
+ return
+ }
+ fd, e = rawsocketcall(_SOCKET, uintptr(domain), uintptr(typ), uintptr(proto), 0, 0, 0)
if e != 0 {
err = e
}
@@ -190,7 +255,14 @@
}

func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) {
- _, e := socketcall(_GETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0)
+ _, _, e := Syscall6(_SYS_getsockopt, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0)
+ if e != ENOSYS {
+ if e != 0 {
+ err = e
+ }
+ return
+ }
+ _, e = socketcall(_GETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0)
if e != 0 {
err = e
}
@@ -198,7 +270,14 @@
}

func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) {
- _, e := socketcall(_SETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), vallen, 0)
+ _, _, e := Syscall6(_SYS_setsockopt, uintptr(s), uintptr(level), uintptr(name), uintptr(val), vallen, 0)
+ if e != ENOSYS {
+ if e != 0 {
+ err = e
+ }
+ return
+ }
+ _, e = socketcall(_SETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), vallen, 0)
if e != 0 {
err = e
}
@@ -210,7 +289,15 @@
if len(p) > 0 {
base = uintptr(unsafe.Pointer(&p[0]))
}
- n, e := socketcall(_RECVFROM, uintptr(s), base, uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen)))
+ r0, _, e := Syscall6(_SYS_recvfrom, uintptr(s), base, uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen)))
+ if e != ENOSYS {
+ n = int(r0)
+ if e != 0 {
+ err = e
+ }
+ return
+ }
+ n, e = socketcall(_RECVFROM, uintptr(s), base, uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen)))
if e != 0 {
err = e
}
@@ -222,7 +309,14 @@
if len(p) > 0 {
base = uintptr(unsafe.Pointer(&p[0]))
}
- _, e := socketcall(_SENDTO, uintptr(s), base, uintptr(len(p)), uintptr(flags), uintptr(to), uintptr(addrlen))
+ _, _, e := Syscall6(_SYS_sendto, uintptr(s), base, uintptr(len(p)), uintptr(flags), uintptr(to), uintptr(addrlen))
+ if e != ENOSYS {
+ if e != 0 {
+ err = e
+ }
+ return
+ }
+ _, e = socketcall(_SENDTO, uintptr(s), base, uintptr(len(p)), uintptr(flags), uintptr(to), uintptr(addrlen))
if e != 0 {
err = e
}
@@ -230,7 +324,15 @@
}

func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) {
- n, e := socketcall(_RECVMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags), 0, 0, 0)
+ r0, _, e := Syscall(_SYS_recvmsg, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags))
+ if e != ENOSYS {
+ n = int(r0)
+ if e != 0 {
+ err = e
+ }
+ return
+ }
+ n, e = socketcall(_RECVMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags), 0, 0, 0)
if e != 0 {
err = e
}
@@ -238,7 +340,15 @@
}

func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) {
- n, e := socketcall(_SENDMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags), 0, 0, 0)
+ r0, _, e := Syscall(_SYS_sendmsg, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags))
+ if e != ENOSYS {
+ n = int(r0)
+ if e != 0 {
+ err = e
+ }
+ return
+ }
+ n, e = socketcall(_SENDMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags), 0, 0, 0)
if e != 0 {
err = e
}
@@ -246,7 +356,14 @@
}

func Listen(s int, n int) (err error) {
- _, e := socketcall(_LISTEN, uintptr(s), uintptr(n), 0, 0, 0, 0)
+ _, _, e := Syscall(_SYS_listen, uintptr(s), uintptr(n), 0)
+ if e != ENOSYS {
+ if e != 0 {
+ err = e
+ }
+ return
+ }
+ _, e = socketcall(_LISTEN, uintptr(s), uintptr(n), 0, 0, 0, 0)
if e != 0 {
err = e
}
@@ -254,7 +371,14 @@
}

func Shutdown(s, how int) (err error) {
- _, e := socketcall(_SHUTDOWN, uintptr(s), uintptr(how), 0, 0, 0, 0)
+ _, _, e := Syscall(_SYS_shutdown, uintptr(s), uintptr(how), 0)
+ if e != ENOSYS {
+ if e != 0 {
+ err = e
+ }
+ return
+ }
+ _, e = socketcall(_SHUTDOWN, uintptr(s), uintptr(how), 0, 0, 0, 0)
if e != 0 {
err = e
}
diff --git a/src/syscall/syscall_linux_s390x.go b/src/syscall/syscall_linux_s390x.go
index abff53c..e0888f6 100644
--- a/src/syscall/syscall_linux_s390x.go
+++ b/src/syscall/syscall_linux_s390x.go
@@ -7,10 +7,25 @@
import "unsafe"

const (
- _SYS_setgroups = SYS_SETGROUPS
- _SYS_clone3 = 435
- _SYS_faccessat2 = 439
- _SYS_fchmodat2 = 452
+ _SYS_setgroups = SYS_SETGROUPS
+ _SYS_socket = 359
+ _SYS_socketpair = 360
+ _SYS_bind = 361
+ _SYS_connect = 362
+ _SYS_listen = 363
+ _SYS_accept4 = 364
+ _SYS_getsockopt = 365
+ _SYS_setsockopt = 366
+ _SYS_getsockname = 367
+ _SYS_getpeername = 368
+ _SYS_sendto = 369
+ _SYS_sendmsg = 370
+ _SYS_recvfrom = 371
+ _SYS_recvmsg = 372
+ _SYS_shutdown = 373
+ _SYS_clone3 = 435
+ _SYS_faccessat2 = 439
+ _SYS_fchmodat2 = 452
)

//sys Dup2(oldfd int, newfd int) (err error)
@@ -82,10 +97,11 @@
return
}

-// On s390x Linux, all the socket calls go through an extra indirection.
-// The arguments to the underlying system call are the number below
-// and a pointer to an array of uintptr. We hide the pointer in the
-// socketcall assembly to avoid allocation on every system call.
+// On s390x Linux before Linux 4.3, all the socket calls go through an
+// extra indirection. The arguments to the underlying system call are
+// the number below and a pointer to an array of uintptr. We hide the
+// pointer in the socketcall assembly to avoid allocation on every
+// fallback system call.

const (
// see linux/net.h
@@ -120,7 +136,15 @@
func rawsocketcall(call int, a0, a1, a2, a3, a4, a5 uintptr) (n int, err Errno)

func accept4(s int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (fd int, err error) {
- fd, e := socketcall(_ACCEPT4, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), uintptr(flags), 0, 0)
+ r0, _, e := Syscall6(_SYS_accept4, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), uintptr(flags), 0, 0)
+ if e != ENOSYS {
+ fd = int(r0)
+ if e != 0 {
+ err = e
+ }
+ return
+ }
+ fd, e = socketcall(_ACCEPT4, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), uintptr(flags), 0, 0)
if e != 0 {
err = e
}
@@ -128,7 +152,14 @@
}

func getsockname(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) {
- _, e := rawsocketcall(_GETSOCKNAME, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), 0, 0, 0)
+ _, _, e := RawSyscall(_SYS_getsockname, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)))
+ if e != ENOSYS {
+ if e != 0 {
+ err = e
+ }
+ return
+ }
+ _, e = rawsocketcall(_GETSOCKNAME, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), 0, 0, 0)
if e != 0 {
err = e
}
@@ -136,7 +167,14 @@
}

func getpeername(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) {
- _, e := rawsocketcall(_GETPEERNAME, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), 0, 0, 0)
+ _, _, e := RawSyscall(_SYS_getpeername, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)))
+ if e != ENOSYS {
+ if e != 0 {
+ err = e
+ }
+ return
+ }
+ _, e = rawsocketcall(_GETPEERNAME, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), 0, 0, 0)
if e != 0 {
err = e
}
@@ -144,7 +182,14 @@
}

func socketpair(domain int, typ int, flags int, fd *[2]int32) (err error) {
- _, e := rawsocketcall(_SOCKETPAIR, uintptr(domain), uintptr(typ), uintptr(flags), uintptr(unsafe.Pointer(fd)), 0, 0)
+ _, _, e := RawSyscall6(_SYS_socketpair, uintptr(domain), uintptr(typ), uintptr(flags), uintptr(unsafe.Pointer(fd)), 0, 0)
+ if e != ENOSYS {
+ if e != 0 {
+ err = e
+ }
+ return
+ }
+ _, e = rawsocketcall(_SOCKETPAIR, uintptr(domain), uintptr(typ), uintptr(flags), uintptr(unsafe.Pointer(fd)), 0, 0)
if e != 0 {
err = e
}
@@ -152,7 +197,14 @@
}

func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) {
- _, e := socketcall(_BIND, uintptr(s), uintptr(addr), uintptr(addrlen), 0, 0, 0)
+ _, _, e := Syscall(_SYS_bind, uintptr(s), uintptr(addr), uintptr(addrlen))
+ if e != ENOSYS {
+ if e != 0 {
+ err = e
+ }
+ return
+ }
+ _, e = socketcall(_BIND, uintptr(s), uintptr(addr), uintptr(addrlen), 0, 0, 0)
if e != 0 {
err = e
}
@@ -160,7 +212,14 @@
}

func connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) {
- _, e := socketcall(_CONNECT, uintptr(s), uintptr(addr), uintptr(addrlen), 0, 0, 0)
+ _, _, e := Syscall(_SYS_connect, uintptr(s), uintptr(addr), uintptr(addrlen))
+ if e != ENOSYS {
+ if e != 0 {
+ err = e
+ }
+ return
+ }
+ _, e = socketcall(_CONNECT, uintptr(s), uintptr(addr), uintptr(addrlen), 0, 0, 0)
if e != 0 {
err = e
}
@@ -168,7 +227,15 @@
}

func socket(domain int, typ int, proto int) (fd int, err error) {
- fd, e := rawsocketcall(_SOCKET, uintptr(domain), uintptr(typ), uintptr(proto), 0, 0, 0)
+ r0, _, e := RawSyscall(_SYS_socket, uintptr(domain), uintptr(typ), uintptr(proto))
+ if e != ENOSYS {
+ fd = int(r0)
+ if e != 0 {
+ err = e
+ }
+ return
+ }
+ fd, e = rawsocketcall(_SOCKET, uintptr(domain), uintptr(typ), uintptr(proto), 0, 0, 0)
if e != 0 {
err = e
}
@@ -176,7 +243,14 @@
}

func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) {
- _, e := socketcall(_GETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0)
+ _, _, e := Syscall6(_SYS_getsockopt, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0)
+ if e != ENOSYS {
+ if e != 0 {
+ err = e
+ }
+ return
+ }
+ _, e = socketcall(_GETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0)
if e != 0 {
err = e
}
@@ -184,7 +258,14 @@
}

func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) {
- _, e := socketcall(_SETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), vallen, 0)
+ _, _, e := Syscall6(_SYS_setsockopt, uintptr(s), uintptr(level), uintptr(name), uintptr(val), vallen, 0)
+ if e != ENOSYS {
+ if e != 0 {
+ err = e
+ }
+ return
+ }
+ _, e = socketcall(_SETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), vallen, 0)
if e != 0 {
err = e
}
@@ -196,7 +277,15 @@
if len(p) > 0 {
base = uintptr(unsafe.Pointer(&p[0]))
}
- n, e := socketcall(_RECVFROM, uintptr(s), base, uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen)))
+ r0, _, e := Syscall6(_SYS_recvfrom, uintptr(s), base, uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen)))
+ if e != ENOSYS {
+ n = int(r0)
+ if e != 0 {
+ err = e
+ }
+ return
+ }
+ n, e = socketcall(_RECVFROM, uintptr(s), base, uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen)))
if e != 0 {
err = e
}
@@ -208,7 +297,14 @@
if len(p) > 0 {
base = uintptr(unsafe.Pointer(&p[0]))
}
- _, e := socketcall(_SENDTO, uintptr(s), base, uintptr(len(p)), uintptr(flags), uintptr(to), uintptr(addrlen))
+ _, _, e := Syscall6(_SYS_sendto, uintptr(s), base, uintptr(len(p)), uintptr(flags), uintptr(to), uintptr(addrlen))
+ if e != ENOSYS {
+ if e != 0 {
+ err = e
+ }
+ return
+ }
+ _, e = socketcall(_SENDTO, uintptr(s), base, uintptr(len(p)), uintptr(flags), uintptr(to), uintptr(addrlen))
if e != 0 {
err = e
}
@@ -216,7 +312,15 @@
}

func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) {
- n, e := socketcall(_RECVMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags), 0, 0, 0)
+ r0, _, e := Syscall(_SYS_recvmsg, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags))
+ if e != ENOSYS {
+ n = int(r0)
+ if e != 0 {
+ err = e
+ }
+ return
+ }
+ n, e = socketcall(_RECVMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags), 0, 0, 0)
if e != 0 {
err = e
}
@@ -224,7 +328,15 @@
}

func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) {
- n, e := socketcall(_SENDMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags), 0, 0, 0)
+ r0, _, e := Syscall(_SYS_sendmsg, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags))
+ if e != ENOSYS {
+ n = int(r0)
+ if e != 0 {
+ err = e
+ }
+ return
+ }
+ n, e = socketcall(_SENDMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags), 0, 0, 0)
if e != 0 {
err = e
}
@@ -232,7 +344,14 @@
}

func Listen(s int, n int) (err error) {
- _, e := socketcall(_LISTEN, uintptr(s), uintptr(n), 0, 0, 0, 0)
+ _, _, e := Syscall(_SYS_listen, uintptr(s), uintptr(n), 0)
+ if e != ENOSYS {
+ if e != 0 {
+ err = e
+ }
+ return
+ }
+ _, e = socketcall(_LISTEN, uintptr(s), uintptr(n), 0, 0, 0, 0)
if e != 0 {
err = e
}
@@ -240,7 +359,14 @@
}

func Shutdown(s, how int) (err error) {
- _, e := socketcall(_SHUTDOWN, uintptr(s), uintptr(how), 0, 0, 0, 0)
+ _, _, e := Syscall(_SYS_shutdown, uintptr(s), uintptr(how), 0)
+ if e != ENOSYS {
+ if e != 0 {
+ err = e
+ }
+ return
+ }
+ _, e = socketcall(_SHUTDOWN, uintptr(s), uintptr(how), 0, 0, 0, 0)
if e != 0 {
err = e
}

Change information

Files:
  • M src/syscall/syscall_linux_386.go
  • M src/syscall/syscall_linux_s390x.go
Change size: L
Delta: 2 files changed, 298 insertions(+), 48 deletions(-)
Open in Gerrit

Related details

Attention set is empty
Submit Requirements:
  • requirement is not satisfiedCode-Review
  • requirement satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement is not satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: newchange
Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: Ied6d6866f84c1a730889f23a5318afec52f1c60c
Gerrit-Change-Number: 787840
Gerrit-PatchSet: 1
Gerrit-Owner: Chencheng Jiang <dorb...@gmail.com>
unsatisfied_requirement
satisfied_requirement
open
diffy

Ian Lance Taylor (Gerrit)

unread,
Jun 6, 2026, 6:39:06 PM (7 hours ago) Jun 6
to Chencheng Jiang, goph...@pubsubhelper.golang.org, Ian Lance Taylor, Brad Fitzpatrick, Tobias Klauser, Gopher Robot, golang-co...@googlegroups.com
Attention needed from Brad Fitzpatrick, Chencheng Jiang and Tobias Klauser

Ian Lance Taylor added 1 comment

File src/syscall/syscall_linux_s390x.go
Line 11, Patchset 1 (Latest): _SYS_socket = 359
Ian Lance Taylor . unresolved

Unlike for 386, these system call numbers are already defined in zsysnum_linux_s390x. We can just use SYS_SOCKET, etc., in this file.

Open in Gerrit

Related details

Attention is currently required from:
  • Brad Fitzpatrick
  • Chencheng Jiang
  • Tobias Klauser
Submit Requirements:
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    • requirement is not satisfiedTryBots-Pass
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: Ied6d6866f84c1a730889f23a5318afec52f1c60c
    Gerrit-Change-Number: 787840
    Gerrit-PatchSet: 1
    Gerrit-Owner: Chencheng Jiang <dorb...@gmail.com>
    Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Reviewer: Tobias Klauser <tobias....@gmail.com>
    Gerrit-CC: Gopher Robot <go...@golang.org>
    Gerrit-Attention: Tobias Klauser <tobias....@gmail.com>
    Gerrit-Attention: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Attention: Chencheng Jiang <dorb...@gmail.com>
    Gerrit-Comment-Date: Sat, 06 Jun 2026 22:38:59 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    unsatisfied_requirement
    open
    diffy

    Ian Lance Taylor (Gerrit)

    unread,
    Jun 6, 2026, 6:39:38 PM (7 hours ago) Jun 6
    to Chencheng Jiang, goph...@pubsubhelper.golang.org, Ian Lance Taylor, Brad Fitzpatrick, Tobias Klauser, Gopher Robot, golang-co...@googlegroups.com
    Attention needed from Brad Fitzpatrick, Chencheng Jiang and Tobias Klauser

    Ian Lance Taylor voted Commit-Queue+1

    Commit-Queue+1
    Gerrit-Comment-Date: Sat, 06 Jun 2026 22:39:34 +0000
    Gerrit-HasComments: No
    Gerrit-Has-Labels: Yes
    unsatisfied_requirement
    open
    diffy

    Chencheng Jiang (Gerrit)

    unread,
    Jun 6, 2026, 6:48:35 PM (7 hours ago) Jun 6
    to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
    Attention needed from Brad Fitzpatrick, Chencheng Jiang, Ian Lance Taylor and Tobias Klauser

    Chencheng Jiang uploaded new patchset

    Chencheng Jiang uploaded patch set #2 to this change.
    Open in Gerrit

    Related details

    Attention is currently required from:
    • Brad Fitzpatrick
    • Chencheng Jiang
    • Ian Lance Taylor
    • Tobias Klauser
    Submit Requirements:
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    • requirement is not satisfiedTryBots-Pass
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: newpatchset
    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: Ied6d6866f84c1a730889f23a5318afec52f1c60c
    Gerrit-Change-Number: 787840
    Gerrit-PatchSet: 2
    Gerrit-Owner: Chencheng Jiang <dorb...@gmail.com>
    Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Reviewer: Tobias Klauser <tobias....@gmail.com>
    Gerrit-CC: Gopher Robot <go...@golang.org>
    unsatisfied_requirement
    open
    diffy

    Chencheng Jiang (Gerrit)

    unread,
    Jun 6, 2026, 6:48:46 PM (7 hours ago) Jun 6
    to goph...@pubsubhelper.golang.org, golang...@luci-project-accounts.iam.gserviceaccount.com, Ian Lance Taylor, Brad Fitzpatrick, Tobias Klauser, Gopher Robot, golang-co...@googlegroups.com
    Attention needed from Brad Fitzpatrick, Ian Lance Taylor and Tobias Klauser

    Chencheng Jiang added 1 comment

    File src/syscall/syscall_linux_s390x.go
    Line 11, Patchset 1: _SYS_socket = 359
    Ian Lance Taylor . resolved

    Unlike for 386, these system call numbers are already defined in zsysnum_linux_s390x. We can just use SYS_SOCKET, etc., in this file.

    Chencheng Jiang

    Done

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Brad Fitzpatrick
    • Ian Lance Taylor
    • Tobias Klauser
      Submit Requirements:
        • requirement is not satisfiedCode-Review
        • requirement satisfiedNo-Unresolved-Comments
        • requirement is not satisfiedReview-Enforcement
        • requirement is not satisfiedTryBots-Pass
        Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
        Gerrit-MessageType: comment
        Gerrit-Project: go
        Gerrit-Branch: master
        Gerrit-Change-Id: Ied6d6866f84c1a730889f23a5318afec52f1c60c
        Gerrit-Change-Number: 787840
        Gerrit-PatchSet: 2
        Gerrit-Owner: Chencheng Jiang <dorb...@gmail.com>
        Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
        Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
        Gerrit-Reviewer: Tobias Klauser <tobias....@gmail.com>
        Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
        Gerrit-Attention: Tobias Klauser <tobias....@gmail.com>
        Gerrit-Attention: Brad Fitzpatrick <brad...@golang.org>
        Gerrit-Comment-Date: Sat, 06 Jun 2026 22:48:41 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: No
        Comment-In-Reply-To: Ian Lance Taylor <ia...@golang.org>
        unsatisfied_requirement
        satisfied_requirement
        open
        diffy

        Ian Lance Taylor (Gerrit)

        unread,
        Jun 6, 2026, 7:47:20 PM (6 hours ago) Jun 6
        to Chencheng Jiang, goph...@pubsubhelper.golang.org, Ian Lance Taylor, golang...@luci-project-accounts.iam.gserviceaccount.com, Brad Fitzpatrick, Tobias Klauser, Gopher Robot, golang-co...@googlegroups.com
        Attention needed from Brad Fitzpatrick, Chencheng Jiang and Tobias Klauser

        Ian Lance Taylor voted Commit-Queue+1

        Commit-Queue+1
        Open in Gerrit

        Related details

        Attention is currently required from:
        • Brad Fitzpatrick
        • Chencheng Jiang
        • Tobias Klauser
        Submit Requirements:
        • requirement is not satisfiedCode-Review
        • requirement satisfiedNo-Unresolved-Comments
        • requirement is not satisfiedReview-Enforcement
        • requirement is not satisfiedTryBots-Pass
        Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
        Gerrit-MessageType: comment
        Gerrit-Project: go
        Gerrit-Branch: master
        Gerrit-Change-Id: Ied6d6866f84c1a730889f23a5318afec52f1c60c
        Gerrit-Change-Number: 787840
        Gerrit-PatchSet: 2
        Gerrit-Owner: Chencheng Jiang <dorb...@gmail.com>
        Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
        Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
        Gerrit-Reviewer: Tobias Klauser <tobias....@gmail.com>
        Gerrit-CC: Gopher Robot <go...@golang.org>
        Gerrit-Attention: Tobias Klauser <tobias....@gmail.com>
        Gerrit-Attention: Brad Fitzpatrick <brad...@golang.org>
        Gerrit-Attention: Chencheng Jiang <dorb...@gmail.com>
        Gerrit-Comment-Date: Sat, 06 Jun 2026 23:47:15 +0000
        Gerrit-HasComments: No
        Gerrit-Has-Labels: Yes
        unsatisfied_requirement
        satisfied_requirement
        open
        diffy

        Ian Lance Taylor (Gerrit)

        unread,
        Jun 6, 2026, 11:25:51 PM (2 hours ago) Jun 6
        to Chencheng Jiang, goph...@pubsubhelper.golang.org, golang...@luci-project-accounts.iam.gserviceaccount.com, Ian Lance Taylor, Brad Fitzpatrick, Tobias Klauser, Gopher Robot, golang-co...@googlegroups.com
        Attention needed from Brad Fitzpatrick, Chencheng Jiang and Tobias Klauser

        Ian Lance Taylor voted Commit-Queue+1

        Commit-Queue+1
        Open in Gerrit

        Related details

        Attention is currently required from:
        • Brad Fitzpatrick
        • Chencheng Jiang
        • Tobias Klauser
        Submit Requirements:
          • requirement is not satisfiedCode-Review
          • requirement satisfiedNo-Unresolved-Comments
          • requirement is not satisfiedReview-Enforcement
          • requirement satisfiedTryBots-Pass
          Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
          Gerrit-MessageType: comment
          Gerrit-Project: go
          Gerrit-Branch: master
          Gerrit-Change-Id: Ied6d6866f84c1a730889f23a5318afec52f1c60c
          Gerrit-Change-Number: 787840
          Gerrit-PatchSet: 2
          Gerrit-Owner: Chencheng Jiang <dorb...@gmail.com>
          Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
          Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
          Gerrit-Reviewer: Tobias Klauser <tobias....@gmail.com>
          Gerrit-CC: Gopher Robot <go...@golang.org>
          Gerrit-Attention: Tobias Klauser <tobias....@gmail.com>
          Gerrit-Attention: Brad Fitzpatrick <brad...@golang.org>
          Gerrit-Attention: Chencheng Jiang <dorb...@gmail.com>
          Gerrit-Comment-Date: Sun, 07 Jun 2026 03:25:47 +0000
          Gerrit-HasComments: No
          Gerrit-Has-Labels: Yes
          unsatisfied_requirement
          satisfied_requirement
          open
          diffy
          Reply all
          Reply to author
          Forward
          0 new messages