From 27301e8247580e456e712a07d68890dc1e857000 Mon Sep 17 00:00:00 2001 From: "Bryan C. Mills" Date: Fri, 9 Dec 2022 12:25:22 -0500 Subject: syscall: fix shadowing bugs in forkAndExecInChild Fixes #57208. Updates #23152. Change-Id: Icc9a74aeb26f1b6f151162c5d6bf1b4d7cd54d0a Reviewed-on: https://go-review.googlesource.com/c/go/+/456515 Run-TryBot: Bryan Mills Reviewed-by: Russ Cox TryBot-Result: Gopher Robot --- src/syscall/exec_freebsd.go | 2 +- src/syscall/exec_linux.go | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src/syscall') diff --git a/src/syscall/exec_freebsd.go b/src/syscall/exec_freebsd.go index b85bcd93a8..af5a4158f0 100644 --- a/src/syscall/exec_freebsd.go +++ b/src/syscall/exec_freebsd.go @@ -205,7 +205,7 @@ func forkAndExecInChild(argv0 *byte, argv, envv []*byte, chroot, dir *byte, attr r1, _, _ = RawSyscall(SYS_GETPPID, 0, 0, 0) if r1 != ppid { pid, _, _ := RawSyscall(SYS_GETPID, 0, 0, 0) - _, _, err1 := RawSyscall(SYS_KILL, pid, uintptr(sys.Pdeathsig), 0) + _, _, err1 = RawSyscall(SYS_KILL, pid, uintptr(sys.Pdeathsig), 0) if err1 != 0 { goto childerror } diff --git a/src/syscall/exec_linux.go b/src/syscall/exec_linux.go index b61b51dff1..7e0c3d250b 100644 --- a/src/syscall/exec_linux.go +++ b/src/syscall/exec_linux.go @@ -470,7 +470,7 @@ func forkAndExecInChild1(argv0 *byte, argv, envv []*byte, chroot, dir *byte, att // so it is safe to always use _LINUX_CAPABILITY_VERSION_3. caps.hdr.version = _LINUX_CAPABILITY_VERSION_3 - if _, _, err1 := RawSyscall(SYS_CAPGET, uintptr(unsafe.Pointer(&caps.hdr)), uintptr(unsafe.Pointer(&caps.data[0])), 0); err1 != 0 { + if _, _, err1 = RawSyscall(SYS_CAPGET, uintptr(unsafe.Pointer(&caps.hdr)), uintptr(unsafe.Pointer(&caps.data[0])), 0); err1 != 0 { goto childerror } @@ -481,7 +481,7 @@ func forkAndExecInChild1(argv0 *byte, argv, envv []*byte, chroot, dir *byte, att caps.data[capToIndex(c)].inheritable |= capToMask(c) } - if _, _, err1 := RawSyscall(SYS_CAPSET, uintptr(unsafe.Pointer(&caps.hdr)), uintptr(unsafe.Pointer(&caps.data[0])), 0); err1 != 0 { + if _, _, err1 = RawSyscall(SYS_CAPSET, uintptr(unsafe.Pointer(&caps.hdr)), uintptr(unsafe.Pointer(&caps.data[0])), 0); err1 != 0 { goto childerror } @@ -514,7 +514,7 @@ func forkAndExecInChild1(argv0 *byte, argv, envv []*byte, chroot, dir *byte, att r1, _ = rawSyscallNoError(SYS_GETPPID, 0, 0, 0) if r1 != ppid { pid, _ := rawSyscallNoError(SYS_GETPID, 0, 0, 0) - _, _, err1 := RawSyscall(SYS_KILL, pid, uintptr(sys.Pdeathsig), 0) + _, _, err1 = RawSyscall(SYS_KILL, pid, uintptr(sys.Pdeathsig), 0) if err1 != 0 { goto childerror } -- cgit v1.2.1