golang / go

The Go programming language
https://go.dev
BSD 3-Clause "New" or "Revised" License
122.95k stars 17.53k forks source link

syscall: Test failed in wsl1 #63329

Open qiulaidongfeng opened 11 months ago

qiulaidongfeng commented 11 months ago

What version of Go are you using (go version)?

$ go version
tip

Does this issue reproduce with the latest release?

yes.

What operating system and processor architecture are you using (go env)?

go env Output
$ go env

What did you do?

In wsl1 Ubuntu 22.04.3 LTS

go test syscall

What did you expect to see?

Test passed.

What did you see instead?

--- FAIL: TestSCMCredentials (0.00s)
    creds_test.go:110: ReadMsgUnix flags = 0x0, want 0x40000000 (MSG_CMSG_CLOEXEC)
--- FAIL: TestPidFD (0.00s)
    exec_linux_test.go:576: can't start a process: fork/exec /tmp/go-build2291011540/b001/syscall.test: invalid argument
--- FAIL: TestSetuidEtc (0.01s)
    syscall_linux_test.go:583: [6] "Setgroups([]int{0,1,2,3})" comparison: "/proc/24624/status" got:"Groups:" want:"Groups:\t0 1 2 3" (bad) [pid=24624 file:'Name:  syscall.test
        State:  S (sleeping)
        Tgid:   24624
        Pid:    24624
        PPid:   24541
        TracerPid:      0
        Uid:    0       0       0       0
        Gid:    0       0       0       0
        FDSize: 18
        Groups:
        VmPeak: 0 kB
        VmSize: 1838804 kB
        VmLck:  0 kB
        VmHWM:  0 kB
        VmRSS:  5432 kB
        VmData: 0 kB
        VmStk:  0 kB
        VmExe:  1292 kB
        VmLib:  0 kB
        VmPTE:  0 kB
        Threads:        9
        SigQ:   0/0
        SigPnd: 0000000000000000
        ShdPnd: 0000000000000000
        SigBlk: 0000000000000000
        SigIgn: 0000000000000000
        SigCgt: 0000000000000000
        CapInh: 0000000000000000
        CapPrm: 0000001fffffffff
        CapEff: 0000001fffffffff
        CapBnd: 0000001fffffffff
        Cpus_allowed:   f
        Cpus_allowed_list:      0-3
        Mems_allowed:   1
        Mems_allowed_list:      0
        voluntary_ctxt_switches:        150
        nonvoluntary_ctxt_switches:     545
        ' Pid:  24624]
    syscall_linux_test.go:583: [8] "Setgroups([]int{0})" comparison: "/proc/24624/status" got:"Groups:" want:"Groups:\t0" (bad) [pid=24624 file:'Name:      syscall.test
        State:  S (sleeping)
        Tgid:   24624
        Pid:    24624
        PPid:   24541
        TracerPid:      0
        Uid:    0       0       0       0
        Gid:    0       0       0       0
        FDSize: 18
        Groups:
        VmPeak: 0 kB
        VmSize: 1838804 kB
        VmLck:  0 kB
        VmHWM:  0 kB
        VmRSS:  5528 kB
        VmData: 0 kB
        VmStk:  0 kB
        VmExe:  1292 kB
        VmLib:  0 kB
        VmPTE:  0 kB
        Threads:        9
        SigQ:   0/0
        SigPnd: 0000000000000000
        ShdPnd: 0000000000000000
        SigBlk: 0000000000000000
        SigIgn: 0000000000000000
        SigCgt: 0000000000000000
        CapInh: 0000000000000000
        CapPrm: 0000001fffffffff
        CapEff: 0000001fffffffff
        CapBnd: 0000001fffffffff
        Cpus_allowed:   f
        Cpus_allowed_list:      0-3
        Mems_allowed:   1
        Mems_allowed_list:      0
        voluntary_ctxt_switches:        150
        nonvoluntary_ctxt_switches:     545
        ' Pid:  24624]
--- FAIL: TestFcntlFlock (0.03s)
    syscall_unix_test.go:107: child process: "--- FAIL: TestFcntlFlock (0.00s)\n    syscall_unix_test.go:124: FcntlFlock got {1 0 [0 0 0 0] 0 4294967296 0 [0 0 0 0]}, want {1 0 [0 0 0 0] 31415 271828 24624 [0 0 0 0]}\nFAIL\n", exit status 1
FAIL
FAIL    syscall 5.177s
prattmic commented 11 months ago

WSL1 uses system call emulation, so I suspect that these are cases where WSL1 is simply not faithly emulating the system calls (e.g., it looks like their /proc/PID/status simply doesn't implement the "Groups" field).

We have a WSL builder, but I believe it is WSL2, so we don't see WSL1 failures.

cc @golang/windows

mknyszek commented 11 months ago

We discussed this issue in triage, but we're not really sure what the right path forward is since we don't have a defined policy for WSL1 vs. WSL2. I filed #63503 to try and figure that out.