Skip to content

syscall: Exec is broken on solaris #20832

Closed
@binarycrusader

Description

@binarycrusader

The test added for issue #18146 exposed a long-existing bug in the Solaris port; notably, that syscall.Exec uses RawSyscall -- which is not actually functional for the Solaris port (intentionally) and only exists as a placebo to satisfy build requirements.

From syscall_solaris.go:

// This is syscall.RawSyscall, it exists to satisfy some build dependency,
// but it doesn't work correctly.
//
// DO NOT USE!
//
// TODO(aram): make this panic once we stop calling fcntl(2) in net using it.
func syscall_rawsyscall(trap, a1, a2, a3 uintptr) (r1, r2, err uintptr) {

From syscall/exec_solaris.go:

// We call hand-crafted syscalls, implemented in
// ../runtime/syscall_solaris.go, rather than generated libc wrappers
// because we need to avoid lazy-loading the functions (might malloc,
// split the stack, or acquire mutexes). We can't call RawSyscall
// because it's not safe even for BSD-subsystem calls.

Currently, the misc/cgo/test/issue18146.go test fails on Solaris as follows:

$ ./test.test -test.v -test.run Test18146
=== RUN   Test18146
--- FAIL: Test18146 (5.99s)
        issue18146.go:121: syscall.Exec failed: exit status 1
                === RUN   Test18146
                --- FAIL: Test18146 (0.00s)
                        issue18146.go:77: invalid argument
                FAIL
        issue18146.go:121: syscall.Exec failed: exit status 1
...

The fix is simple and I will submit a change request soon.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions