u-root / cpu

cpu command in Go, inspired by the Plan 9 cpu command
BSD 3-Clause "New" or "Revised" License
240 stars 29 forks source link

crash on IO copy #128

Closed orangecms closed 1 year ago

orangecms commented 2 years ago

What?

In a QEMU RISC-V, cpud may get a runtime error when processing commands:

runtime: lfstack.push invalid packing: node=0xffffff92442960 cnt=0x1 packed=0xffff9244296000
fatal error: lfstack.push

which is defined in https://go.dev/src/runtime/lfstack.go

The part in the cpu server triggering it appears to be the go func doing io.Copy(f, s).

How?

I cannot exactly tell. This appears to happen on file transfer. However, it is okay with small files (say some lines of a shell script). When I attempt a kexec, or even just copy over a file cpu qemu /bbin/cp ./10-meg-file /tmp/, the crash occurs.

see also https://go-review.googlesource.com/c/go/+/409055 (thanks @dramforever for finding this)

Stacktrace

runtime: lfstack.push invalid packing: node=0xffffff92442960 cnt=0x1 packed=0xffff9244296000
fatal error: lfstack.push

runtime stack:
runtime.throw({0x6f1d79?, 0x683b0?})
        runtime/panic.go:1047 +0x44 fp=0xffffffcecf1cf0 sp=0xffffffcecf1cc8 pc=0x46f6c
runtime.(*lfstack).push(0xcf3e60, 0xffffff92442960)
        runtime/lfstack.go:30 +0x120 fp=0xffffffcecf1d20 sp=0xffffffcecf1cf0 pc=0x19dd8
runtime.(*spanSetBlockAlloc).free(0x746bc?, 0x5c99d2c58?)
        runtime/mspanset.go:292 +0x44 fp=0xffffffcecf1d38 sp=0xffffffcecf1d20 pc=0x41604
runtime.(*spanSet).reset(0xced438)
        runtime/mspanset.go:265 +0xa4 fp=0xffffffcecf1d68 sp=0xffffffcecf1d38 pc=0x414ac
runtime.finishsweep_m()
        runtime/mgcsweep.go:260 +0xa4 fp=0xffffffcecf1d98 sp=0xffffffcecf1d68 pc=0x34924
runtime.gcStart.func1()
        runtime/mgc.go:668 +0x20 fp=0xffffffcecf1da0 sp=0xffffffcecf1d98 pc=0x29960
runtime.systemstack()
        runtime/asm_riscv64.s:133 +0x54 fp=0xffffffcecf1da8 sp=0xffffffcecf1da0 pc=0x746bc

goroutine 26 [running]:
runtime.systemstack_switch()
        runtime/asm_riscv64.s:96 +0x8 fp=0xc00007bd90 sp=0xc00007bd88 pc=0x74650
runtime.gcStart({0xffffffb98b3108?, 0x105b?, 0x1020?})
        runtime/mgc.go:667 +0x250 fp=0xc00007be18 sp=0xc00007bd90 pc=0x29bd0
runtime.mallocgc(0x1009, 0x0, 0x0)
        runtime/malloc.go:1138 +0x680 fp=0xc00007be90 sp=0xc00007be18 pc=0x1bdb0
golang.org/x/crypto/ssh.(*connectionState).readPacket(0xc000120a20, 0x0?)
        golang.org/x/crypto@v0.0.0-20211215153901-e495a2d5b3d3/ssh/transport.go:162 +0x1d4 fp=4
golang.org/x/crypto/ssh.(*transport).readPacket(0xc000120a20)
        golang.org/x/crypto@v0.0.0-20211215153901-e495a2d5b3d3/ssh/transport.go:114 +0x38 fp=08
golang.org/x/crypto/ssh.(*handshakeTransport).readOnePacket(0xc0000f82c0, 0x0)
        golang.org/x/crypto@v0.0.0-20211215153901-e495a2d5b3d3/ssh/handshake.go:374 +0x50 fp=08
golang.org/x/crypto/ssh.(*handshakeTransport).readLoop(0xc0000f82c0)
        golang.org/x/crypto@v0.0.0-20211215153901-e495a2d5b3d3/ssh/handshake.go:197 +0x4c fp=0c
golang.org/x/crypto/ssh.newServerTransport.func1()
        golang.org/x/crypto@v0.0.0-20211215153901-e495a2d5b3d3/ssh/handshake.go:142 +0x2c fp=0c
runtime.goexit()
        runtime/asm_riscv64.s:509 +0x4 fp=0xc00007bfd8 sp=0xc00007bfd8 pc=0x7688c
created by golang.org/x/crypto/ssh.newServerTransport
        golang.org/x/crypto@v0.0.0-20211215153901-e495a2d5b3d3/ssh/handshake.go:142 +0x12c

goroutine 1 [IO wait]:
runtime.gopark(0x7e4148, 0xffffff92432700, 0x2, 0x1b, 0x5)
        runtime/proc.go:363 +0x108 fp=0xc00044fa18 sp=0xc00044f9f0 pc=0x49878
runtime.netpollblock(0xffffff924326e8, 0x72, 0x0)
        runtime/netpoll.go:526 +0xe4 fp=0xc00044fa48 sp=0xc00044fa18 pc=0x425ac
internal/poll.runtime_pollWait(0x0?, 0x72)
        runtime/netpoll.go:305 +0x58 fp=0xc00044fa68 sp=0xc00044fa48 pc=0x71c98
internal/poll.(*pollDesc).wait(0xd6b94?, 0xc00008e880?, 0xe0?)
        internal/poll/fd_poll_runtime.go:84 +0x60 fp=0xc00044fa88 sp=0xc00044fa68 pc=0xd2c30
internal/poll.(*pollDesc).waitRead(0xc00008e880?, 0xa?)
        internal/poll/fd_poll_runtime.go:89 +0x38 fp=0xc00044faa8 sp=0xc00044fa88 pc=0xd2c80
internal/poll.(*FD).Accept(0xc00008e880)
        internal/poll/fd_unix.go:614 +0x1b8 fp=0xc00044fb40 sp=0xc00044faa8 pc=0xd6cf8
net.(*netFD).accept(0xc00008e880)
        net/fd_unix.go:172 +0x30 fp=0xc00044fbb0 sp=0xc00044fb40 pc=0x12b068
net.(*TCPListener).accept(0xc00000a7e0)
        net/tcpsock_posix.go:142 +0x34 fp=0xc00044fbd8 sp=0xc00044fbb0 pc=0x13fa84
net.(*TCPListener).Accept(0xc00000a7e0)
        net/tcpsock.go:288 +0x3c fp=0xc00044fc08 sp=0xc00044fbd8 pc=0x13ecac
github.com/gliderlabs/ssh.(*Server).Serve(0xc000121320, {0x81f898?, 0xc00000a7e0})
        github.com/gliderlabs/ssh@v0.3.3/server.go:237 +0x178 fp=0xc00044fcd0 sp=0xc00044fc08 8
github.com/u-root/cpu/cmds/cpud.serve()
        github.com/u-root/cpu@v0.0.0/cmds/cpud/serve.go:80 +0x8ac fp=0xc00044fe28 sp=0xc00044fc
github.com/u-root/cpu/cmds/cpud.registeredMain()
        github.com/u-root/cpu@v0.0.0/cmds/cpud/main.go:48 +0x38c fp=0xc00044feb8 sp=0xc00044fe4
bb.u-root.com/bb/pkg/bbmain.Run({0xc0000336b6?, 0x8?})
        bb.u-root.com/bb/pkg/bbmain/register.go:134 +0x9c fp=0xc00044fef8 sp=0xc00044feb8 pc=04
main.run()
        bb.u-root.com/bb/main.go:177 +0x4c fp=0xc00044ff68 sp=0xc00044fef8 pc=0x56d394
main.main()
        bb.u-root.com/bb/main.go:185 +0x7c fp=0xc00044ff80 sp=0xc00044ff68 pc=0x56d4ac
runtime.main()
        runtime/proc.go:250 +0x1e4 fp=0xc00044ffd8 sp=0xc00044ff80 pc=0x49454
runtime.goexit()
        runtime/asm_riscv64.s:509 +0x4 fp=0xc00044ffd8 sp=0xc00044ffd8 pc=0x7688c

goroutine 2 [force gc (idle)]:
runtime.gopark(0x7e4170, 0xcc44a0, 0x11, 0x14, 0x1)
        runtime/proc.go:363 +0x108 fp=0xc000048f90 sp=0xc000048f68 pc=0x49878
runtime.goparkunlock(0x0?, 0x0?, 0x0?, 0x0?)
        runtime/proc.go:369 +0x58 fp=0xc000048fb8 sp=0xc000048f90 pc=0x498f0
runtime.forcegchelper()
        runtime/proc.go:302 +0xb0 fp=0xc000048fd8 sp=0xc000048fb8 pc=0x496e0
runtime.goexit()
        runtime/asm_riscv64.s:509 +0x4 fp=0xc000048fd8 sp=0xc000048fd8 pc=0x7688c
created by runtime.init.5
        runtime/proc.go:290 +0x28

goroutine 3 [GC sweep wait]:
runtime.gopark(0x7e4170, 0xcc4c40, 0xc, 0x14, 0x1)
        runtime/proc.go:363 +0x108 fp=0xc000049778 sp=0xc000049750 pc=0x49878
runtime.goparkunlock(0x1?, 0x0?, 0x0?, 0x0?)
        runtime/proc.go:369 +0x58 fp=0xc0000497a0 sp=0xc000049778 pc=0x498f0
runtime.bgsweep(0x0?)
        runtime/mgcsweep.go:297 +0xe4 fp=0xc0000497c8 sp=0xc0000497a0 pc=0x34a6c
runtime.gcenable.func1()
        runtime/mgc.go:178 +0x2c fp=0xc0000497d8 sp=0xc0000497c8 pc=0x2942c
runtime.goexit()
        runtime/asm_riscv64.s:509 +0x4 fp=0xc0000497d8 sp=0xc0000497d8 pc=0x7688c
created by runtime.gcenable
        runtime/mgc.go:178 +0x70

goroutine 4 [GC scavenge wait]:
runtime.gopark(0x7e4170, 0xcc5900, 0xd, 0x14, 0x2)
        runtime/proc.go:363 +0x108 fp=0xc000049f60 sp=0xc000049f38 pc=0x49878
runtime.goparkunlock(0x0?, 0x0?, 0x0?, 0x412e848000000000?)
        runtime/proc.go:369 +0x58 fp=0xc000049f88 sp=0xc000049f60 pc=0x498f0
runtime.(*scavengerState).park(0xcc5900)
        runtime/mgcscavenge.go:389 +0x58 fp=0xc000049fa8 sp=0xc000049f88 pc=0x32848
runtime.bgscavenge(0x0?)
        runtime/mgcscavenge.go:622 +0x6c fp=0xc000049fc8 sp=0xc000049fa8 pc=0x32d8c
runtime.gcenable.func2()
        runtime/mgc.go:179 +0x2c fp=0xc000049fd8 sp=0xc000049fc8 pc=0x293cc
runtime.goexit()
        runtime/asm_riscv64.s:509 +0x4 fp=0xc000049fd8 sp=0xc000049fd8 pc=0x7688c
created by runtime.gcenable
        runtime/mgc.go:179 +0xb0

goroutine 5 [finalizer wait]:
runtime.gopark(0x7e4170, 0xcf3d98, 0x10, 0x14, 0x1)
        runtime/proc.go:363 +0x108 fp=0xc000048580 sp=0xc000048558 pc=0x49878
runtime.goparkunlock(0x0?, 0x48?, 0x3d?, 0xc0000ae120?)
        runtime/proc.go:369 +0x58 fp=0xc0000485a8 sp=0xc000048580 pc=0x498f0
runtime.runfinq()
        runtime/mfinal.go:180 +0xec fp=0xc0000487d8 sp=0xc0000485a8 pc=0x285e4
runtime.goexit()
        runtime/asm_riscv64.s:509 +0x4 fp=0xc0000487d8 sp=0xc0000487d8 pc=0x7688c
created by runtime.createfing
        runtime/mfinal.go:157 +0x64

goroutine 6 [chan receive]:
runtime.gopark(0x7e3f98, 0xc0000766b8, 0xe, 0x17, 0x2)
        runtime/proc.go:363 +0x108 fp=0xc00004a6f8 sp=0xc00004a6d0 pc=0x49878
runtime.chanrecv(0xc000076660, 0xc00004a7c8, 0x0?)
        runtime/chan.go:583 +0x2e8 fp=0xc00004a788 sp=0xc00004a6f8 pc=0x159c8
runtime.chanrecv2(0x0?, 0x0?)
        runtime/chan.go:447 +0x14 fp=0xc00004a7a8 sp=0xc00004a788 pc=0x156cc
src.elv.sh/pkg/eval.getBlackholeChan.func1()
        src.elv.sh@v0.16.0-rc1.0.20220116211855-fda62502ad7f/pkg/eval/port.go:96 +0x44 fp=0xc04
runtime.goexit()
        runtime/asm_riscv64.s:509 +0x4 fp=0xc00004a7d8 sp=0xc00004a7d8 pc=0x7688c
created by src.elv.sh/pkg/eval.getBlackholeChan
        src.elv.sh@v0.16.0-rc1.0.20220116211855-fda62502ad7f/pkg/eval/port.go:95 +0x70

goroutine 7 [syscall]:
syscall.Syscall6(0xc00006c050?, 0xc00007cd88?, 0x25c018?, 0xc00006c050?, 0x27?, 0xc0000b0e10?,)
        syscall/syscall_linux.go:90 +0x2c fp=0xc00007cd88 sp=0xc00007cd08 pc=0xbd79c
syscall.wait4(0xc00015a150?, 0x7076ba?, 0x10?, 0x6e8cd4?)
        syscall/zsyscall_linux_riscv64.go:178 +0x6c fp=0xc00007cde0 sp=0xc00007cd88 pc=0xbb84c
syscall.Wait4(0x7076ba?, 0xc00007ce44, 0xc00015a150?, 0x1?)
        syscall/syscall_linux.go:463 +0x4c fp=0xc00007ce10 sp=0xc00007cde0 pc=0xb8744
github.com/u-root/cpu/cmds/cpud.cpuSetup.func1()
        github.com/u-root/cpu@v0.0.0/cmds/cpud/init.go:61 +0x50 fp=0xc00007cfd8 sp=0xc00007ce18
runtime.goexit()
        runtime/asm_riscv64.s:509 +0x4 fp=0xc00007cfd8 sp=0xc00007cfd8 pc=0x7688c
created by github.com/u-root/cpu/cmds/cpud.cpuSetup
        github.com/u-root/cpu@v0.0.0/cmds/cpud/init.go:54 +0x54

goroutine 8 [GC worker (idle)]:
runtime.gopark(0x7e4000, 0xc0000aea80, 0x18, 0x14, 0x0)
        runtime/proc.go:363 +0x108 fp=0xc00004af40 sp=0xc00004af18 pc=0x49878
runtime.gcBgMarkWorker()
        runtime/mgc.go:1235 +0xec fp=0xc00004afd8 sp=0xc00004af40 pc=0x2b10c
runtime.goexit()
        runtime/asm_riscv64.s:509 +0x4 fp=0xc00004afd8 sp=0xc00004afd8 pc=0x7688c
created by runtime.gcBgMarkStartWorkers
        runtime/mgc.go:1159 +0x2c

goroutine 25 [chan receive]:
runtime.gopark(0x7e3f98, 0xc000063498, 0xe, 0x17, 0x2)
        runtime/proc.go:363 +0x108 fp=0xc00045de30 sp=0xc00045de08 pc=0x49878
runtime.chanrecv(0xc000063440, 0xc00045df70, 0xf8?)
        runtime/chan.go:583 +0x2e8 fp=0xc00045dec0 sp=0xc00045de30 pc=0x159c8
runtime.chanrecv2(0x6078a0?, 0xc000109b60?)
        runtime/chan.go:447 +0x14 fp=0xc00045dee0 sp=0xc00045dec0 pc=0x156cc
github.com/gliderlabs/ssh.(*Server).HandleConn(0xc000121320, {0x8230b8, 0xc00000c170})
        github.com/gliderlabs/ssh@v0.3.3/server.go:296 +0x34c fp=0xc00045dfb8 sp=0xc00045dee0 4
github.com/gliderlabs/ssh.(*Server).Serve.func3()
        github.com/gliderlabs/ssh@v0.3.3/server.go:258 +0x34 fp=0xc00045dfd8 sp=0xc00045dfb8 pc
runtime.goexit()
        runtime/asm_riscv64.s:509 +0x4 fp=0xc00045dfd8 sp=0xc00045dfd8 pc=0x7688c
created by github.com/gliderlabs/ssh.(*Server).Serve
        github.com/gliderlabs/ssh@v0.3.3/server.go:258 +0x204

goroutine 28 [runnable]:
runtime.gopark(0x7e3f98, 0xc0000631f8, 0xe, 0x17, 0x2)
        runtime/proc.go:363 +0x108 fp=0xc00007ae60 sp=0xc00007ae38 pc=0x49878
runtime.chanrecv(0xc0000631a0, 0xc00007af28, 0x4?)
        runtime/chan.go:583 +0x2e8 fp=0xc00007aef0 sp=0xc00007ae60 pc=0x159c8
runtime.chanrecv2(0x97c0e?, 0xc000133800?)
        runtime/chan.go:447 +0x14 fp=0xc00007af10 sp=0xc00007aef0 pc=0x156cc
golang.org/x/crypto/ssh.(*handshakeTransport).readPacket(0xc0000f82c0)
        golang.org/x/crypto@v0.0.0-20211215153901-e495a2d5b3d3/ssh/handshake.go:187 +0x44 fp=0c
golang.org/x/crypto/ssh.(*mux).onePacket(0xc000124930)
        golang.org/x/crypto@v0.0.0-20211215153901-e495a2d5b3d3/ssh/mux.go:215 +0x3c fp=0xc00004
golang.org/x/crypto/ssh.(*mux).loop(0xc000124930)
        golang.org/x/crypto@v0.0.0-20211215153901-e495a2d5b3d3/ssh/mux.go:190 +0x38 fp=0xc00008
golang.org/x/crypto/ssh.newMux.func1()
        golang.org/x/crypto@v0.0.0-20211215153901-e495a2d5b3d3/ssh/mux.go:128 +0x2c fp=0xc0000c
runtime.goexit()
        runtime/asm_riscv64.s:509 +0x4 fp=0xc00007afd8 sp=0xc00007afd8 pc=0x7688c
created by golang.org/x/crypto/ssh.newMux
        golang.org/x/crypto@v0.0.0-20211215153901-e495a2d5b3d3/ssh/mux.go:128 +0x148

goroutine 33 [syscall]:
syscall.Syscall(0x42334?, 0x26708?, 0x71be0?, 0x0?)
        syscall/syscall_linux.go:68 +0x20 fp=0xc000015c88 sp=0xc000015c20 pc=0xbd728
syscall.read(0xd285c?, {0xc000180000?, 0xd2b78?, 0x0?})
        syscall/zsyscall_linux_riscv64.go:696 +0x68 fp=0xc000015cc0 sp=0xc000015c88 pc=0xbc0f0
syscall.Read(0x100000000000002?, {0xc000180000?, 0xd3aa0?, 0xc000063740?})
        syscall/syscall_unix.go:183 +0x44 fp=0xc000015ce8 sp=0xc000015cc0 pc=0xb9ffc
internal/poll.ignoringEINTRIO(0x7e4c70, 0xcf4a20?, {0xc000180000, 0x8000, 0x8000})
        internal/poll/fd_unix.go:794 +0x8c fp=0xc000015d18 sp=0xc000015ce8 pc=0xd8014
internal/poll.(*FD).Read(0xc000063740, {0xc000180000, 0x8000, 0x8000})
        internal/poll/fd_unix.go:163 +0x194 fp=0xc000015da8 sp=0xc000015d18 pc=0xd3bcc
os.(*File).read(0xc00000c1e8, {0xc000180000?, 0xb19d0?, 0x8000?})
        os/file_posix.go:31 +0x58 fp=0xc000015dd0 sp=0xc000015da8 pc=0xdef00
os.(*File).Read(0x0?, {0xc000180000, 0x8000, 0x8000})
        os/file.go:118 +0x8c fp=0xc000015e10 sp=0xc000015dd0 pc=0xdd7ac
io.copyBuffer({0xffffff923c5658, 0xc0000fd2b0}, {0x818d20, 0xc00000c1e8}, {0x0, 0x0, 0x0})
        io/io.go:427 +0x19c fp=0xc000015e90 sp=0xc000015e10 pc=0xb1a5c
io.Copy({0xffffff923c5658?, 0xc0000fd2b0?}, {0x818d20?, 0xc00000c1e8?})
        io/io.go:386 +0x5c fp=0xc000015ed0 sp=0xc000015e90 pc=0xb18a4
github.com/u-root/cpu/server.handler({0x824040, 0xc0000fd2b0})
        github.com/u-root/cpu@v0.0.0/server/server.go:75 +0x498 fp=0xc000015fb8 sp=0xc000015ed0
github.com/gliderlabs/ssh.(*session).handleRequests.func1()
        github.com/gliderlabs/ssh@v0.3.3/session.go:262 +0x38 fp=0xc000015fd8 sp=0xc000015fb8 0
runtime.goexit()
        runtime/asm_riscv64.s:509 +0x4 fp=0xc000015fd8 sp=0xc000015fd8 pc=0x7688c
created by github.com/gliderlabs/ssh.(*session).handleRequests
        github.com/gliderlabs/ssh@v0.3.3/session.go:261 +0x4b8

goroutine 30 [chan receive]:
runtime.gopark(0x7e3f98, 0xc000076b38, 0xe, 0x17, 0x2)
        runtime/proc.go:363 +0x108 fp=0xc0000456c8 sp=0xc0000456a0 pc=0x49878
runtime.chanrecv(0xc000076ae0, 0x0, 0x48?)
        runtime/chan.go:583 +0x2e8 fp=0xc000045758 sp=0xc0000456c8 pc=0x159c8
runtime.chanrecv1(0xc00013c470?, 0xd?)
        runtime/chan.go:442 +0x14 fp=0xc000045778 sp=0xc000045758 pc=0x1569c
github.com/gliderlabs/ssh.(*ForwardedTCPHandler).HandleSSHRequest.func1()
        github.com/gliderlabs/ssh@v0.3.3/tcpip.go:126 +0x4c fp=0xc0000457d8 sp=0xc000045778 pc4
runtime.goexit()
        runtime/asm_riscv64.s:509 +0x4 fp=0xc0000457d8 sp=0xc0000457d8 pc=0x7688c
created by github.com/gliderlabs/ssh.(*ForwardedTCPHandler).HandleSSHRequest
        github.com/gliderlabs/ssh@v0.3.3/tcpip.go:125 +0x434

goroutine 29 [chan receive]:
runtime.gopark(0x7e3f98, 0xc000063558, 0xe, 0x17, 0x2)
        runtime/proc.go:363 +0x108 fp=0xc00007deb8 sp=0xc00007de90 pc=0x49878
runtime.chanrecv(0xc000063500, 0xc00007dfa8, 0xc0?)
        runtime/chan.go:583 +0x2e8 fp=0xc00007df48 sp=0xc00007deb8 pc=0x159c8
runtime.chanrecv2(0x823d48?, 0xc00000ae28?)
        runtime/chan.go:447 +0x14 fp=0xc00007df68 sp=0xc00007df48 pc=0x156cc
github.com/gliderlabs/ssh.(*Server).handleRequests(0xc000121320, {0x823d48, 0xc00000ae28}, 0xc)
        github.com/gliderlabs/ssh@v0.3.3/server.go:310 +0x64 fp=0xc00007dfb0 sp=0xc00007df68 pc
github.com/gliderlabs/ssh.(*Server).HandleConn.func3()
        github.com/gliderlabs/ssh@v0.3.3/server.go:295 +0x38 fp=0xc00007dfd8 sp=0xc00007dfb0 p8
runtime.goexit()
        runtime/asm_riscv64.s:509 +0x4 fp=0xc00007dfd8 sp=0xc00007dfd8 pc=0x7688c
created by github.com/gliderlabs/ssh.(*Server).HandleConn
        github.com/gliderlabs/ssh@v0.3.3/server.go:295 +0x2d4

goroutine 31 [IO wait]:
runtime.gopark(0x7e4148, 0xffffff92432610, 0x2, 0x1b, 0x5)
        runtime/proc.go:363 +0x108 fp=0xc000013d38 sp=0xc000013d10 pc=0x49878
runtime.netpollblock(0xffffff924325f8, 0x72, 0x0)
        runtime/netpoll.go:526 +0xe4 fp=0xc000013d68 sp=0xc000013d38 pc=0x425ac
internal/poll.runtime_pollWait(0x0?, 0x72)
        runtime/netpoll.go:305 +0x58 fp=0xc000013d88 sp=0xc000013d68 pc=0x71c98
internal/poll.(*pollDesc).wait(0xd6b94?, 0xc00008f580?, 0x9?)
        internal/poll/fd_poll_runtime.go:84 +0x60 fp=0xc000013da8 sp=0xc000013d88 pc=0xd2c30
internal/poll.(*pollDesc).waitRead(0xc00008f580?, 0x46?)
        internal/poll/fd_poll_runtime.go:89 +0x38 fp=0xc000013dc8 sp=0xc000013da8 pc=0xd2c80
internal/poll.(*FD).Accept(0xc00008f580)
        internal/poll/fd_unix.go:614 +0x1b8 fp=0xc000013e60 sp=0xc000013dc8 pc=0xd6cf8
net.(*netFD).accept(0xc00008f580)
        net/fd_unix.go:172 +0x30 fp=0xc000013ed0 sp=0xc000013e60 pc=0x12b068
net.(*TCPListener).accept(0xc00000b068)
        net/tcpsock_posix.go:142 +0x34 fp=0xc000013ef8 sp=0xc000013ed0 pc=0x13fa84
net.(*TCPListener).Accept(0xc00000b068)
        net/tcpsock.go:288 +0x3c fp=0xc000013f28 sp=0xc000013ef8 pc=0x13ecac
github.com/gliderlabs/ssh.(*ForwardedTCPHandler).HandleSSHRequest.func2()
        github.com/gliderlabs/ssh@v0.3.3/tcpip.go:136 +0x78 fp=0xc000013fd8 sp=0xc000013f28 pc0
runtime.goexit()
        runtime/asm_riscv64.s:509 +0x4 fp=0xc000013fd8 sp=0xc000013fd8 pc=0x7688c
created by github.com/gliderlabs/ssh.(*ForwardedTCPHandler).HandleSSHRequest
        github.com/gliderlabs/ssh@v0.3.3/tcpip.go:134 +0x4fc

goroutine 32 [chan receive]:
runtime.gopark(0x7e3f98, 0xc0000635b8, 0xe, 0x17, 0x2)
        runtime/proc.go:363 +0x108 fp=0xc000079db0 sp=0xc000079d88 pc=0x49878
runtime.chanrecv(0xc000063560, 0xc000079f00, 0x50?)
        runtime/chan.go:583 +0x2e8 fp=0xc000079e40 sp=0xc000079db0 pc=0x159c8
runtime.chanrecv2(0xc000097c0e?, 0x32?)
        runtime/chan.go:447 +0x14 fp=0xc000079e60 sp=0xc000079e40 pc=0x156cc
github.com/gliderlabs/ssh.(*session).handleRequests(0xc0000fd2b0, 0xc000062598?)
        github.com/gliderlabs/ssh@v0.3.3/session.go:238 +0x50 fp=0xc000079f60 sp=0xc000079e60 8
github.com/gliderlabs/ssh.DefaultSessionHandler(0xc000121320, 0xc00000b020, {0x820d90?, 0xc000)
        github.com/gliderlabs/ssh@v0.3.3/session.go:107 +0x188 fp=0xc000079fa0 sp=0xc000079f608
github.com/gliderlabs/ssh.(*Server).HandleConn.func4()
        github.com/gliderlabs/ssh@v0.3.3/server.go:305 +0x48 fp=0xc000079fd8 sp=0xc000079fa0 p8
runtime.goexit()
        runtime/asm_riscv64.s:509 +0x4 fp=0xc000079fd8 sp=0xc000079fd8 pc=0x7688c
created by github.com/gliderlabs/ssh.(*Server).HandleConn
        github.com/gliderlabs/ssh@v0.3.3/server.go:305 +0x4b0

goroutine 37 [chan receive]:
runtime.gopark(0x7e3f98, 0xc000063858, 0xe, 0x17, 0x2)
        runtime/proc.go:363 +0x108 fp=0xc0000466d8 sp=0xc0000466b0 pc=0x49878
runtime.chanrecv(0xc000063800, 0xc0000467c0, 0x70?)
        runtime/chan.go:583 +0x2e8 fp=0xc000046768 sp=0xc0000466d8 pc=0x159c8
runtime.chanrecv2(0xc000046788?, 0x7688c?)
        runtime/chan.go:447 +0x14 fp=0xc000046788 sp=0xc000046768 pc=0x156cc
golang.org/x/crypto/ssh.DiscardRequests(0xc00000c138?)
        golang.org/x/crypto@v0.0.0-20211215153901-e495a2d5b3d3/ssh/connection.go:80 +0x3c fp=0c
github.com/gliderlabs/ssh.(*ForwardedTCPHandler).HandleSSHRequest.func2.1.3()
        github.com/gliderlabs/ssh@v0.3.3/tcpip.go:157 +0x2c fp=0xc0000467d8 sp=0xc0000467c8 pc4
runtime.goexit()
        runtime/asm_riscv64.s:509 +0x4 fp=0xc0000467d8 sp=0xc0000467d8 pc=0x7688c
created by github.com/gliderlabs/ssh.(*ForwardedTCPHandler).HandleSSHRequest.func2.1
        github.com/gliderlabs/ssh@v0.3.3/tcpip.go:157 +0xec

goroutine 38 [IO wait]:
runtime.gopark(0x7e4148, 0xffffff92432250, 0x2, 0x1b, 0x5)
        runtime/proc.go:363 +0x108 fp=0xc000011cf8 sp=0xc000011cd0 pc=0x49878
runtime.netpollblock(0xffffff92432238, 0x72, 0x0)
        runtime/netpoll.go:526 +0xe4 fp=0xc000011d28 sp=0xc000011cf8 pc=0x425ac
internal/poll.runtime_pollWait(0x0?, 0x72)
        runtime/netpoll.go:305 +0x58 fp=0xc000011d48 sp=0xc000011d28 pc=0x71c98
internal/poll.(*pollDesc).wait(0xd3aa0?, 0xc00008f780?, 0xd?)
        internal/poll/fd_poll_runtime.go:84 +0x60 fp=0xc000011d68 sp=0xc000011d48 pc=0xd2c30
internal/poll.(*pollDesc).waitRead(0x7e4c70?, 0x0?)
        internal/poll/fd_poll_runtime.go:89 +0x38 fp=0xc000011d88 sp=0xc000011d68 pc=0xd2c80
internal/poll.(*FD).Read(0xc00008f780, {0xc000198000, 0x8000, 0x8000})
        internal/poll/fd_unix.go:167 +0x21c fp=0xc000011e18 sp=0xc000011d88 pc=0xd3c54
net.(*netFD).Read(0xc00008f780, {0xc000198000?, 0xc000133800?, 0xc000198000?})
        net/fd_posix.go:55 +0x4c fp=0xc000011e48 sp=0xc000011e18 pc=0x129c4c
net.(*conn).Read(0xc00000c1f8, {0xc000198000, 0x8000, 0x8000})
        net/net.go:183 +0x70 fp=0xc000011e88 sp=0xc000011e48 pc=0x1375a8
io.copyBuffer({0xffffff923c6f78, 0xc000133800}, {0x818a80, 0xc00000c1f8}, {0x0, 0x0, 0x0})
        io/io.go:427 +0x19c fp=0xc000011f08 sp=0xc000011e88 pc=0xb1a5c
io.Copy({0xffffff923c6f78?, 0xc000133800?}, {0x818a80?, 0xc00000c1f8?})
        io/io.go:386 +0x5c fp=0xc000011f48 sp=0xc000011f08 pc=0xb18a4
github.com/gliderlabs/ssh.(*ForwardedTCPHandler).HandleSSHRequest.func2.1.1()
        github.com/gliderlabs/ssh@v0.3.3/tcpip.go:161 +0xe4 fp=0xc000011fd8 sp=0xc000011f48 pc4
runtime.goexit()
        runtime/asm_riscv64.s:509 +0x4 fp=0xc000011fd8 sp=0xc000011fd8 pc=0x7688c
created by github.com/gliderlabs/ssh.(*ForwardedTCPHandler).HandleSSHRequest.func2.1
        github.com/gliderlabs/ssh@v0.3.3/tcpip.go:158 +0x174

goroutine 34 [chan receive]:
runtime.gopark(0x7e3f98, 0xc00005e368, 0xe, 0x17, 0x2)
        runtime/proc.go:363 +0x108 fp=0xc000046ee8 sp=0xc000046ec0 pc=0x49878
runtime.chanrecv(0xc00005e310, 0xc000046fb8, 0x88?)
        runtime/chan.go:583 +0x2e8 fp=0xc000046f78 sp=0xc000046ee8 pc=0x159c8
runtime.chanrecv2(0xc00016e190?, 0xc000121320?)
        runtime/chan.go:447 +0x14 fp=0xc000046f98 sp=0xc000046f78 pc=0x156cc
github.com/u-root/cpu/server.handler.func1()
        github.com/u-root/cpu@v0.0.0/server/server.go:68 +0x54 fp=0xc000046fd8 sp=0xc000046f98c
runtime.goexit()
        runtime/asm_riscv64.s:509 +0x4 fp=0xc000046fd8 sp=0xc000046fd8 pc=0x7688c
created by github.com/u-root/cpu/server.handler
        github.com/u-root/cpu@v0.0.0/server/server.go:67 +0x404

goroutine 39 [sync.Cond.Wait]:
runtime.gopark(0x7e4170, 0xc00016af18, 0x14, 0x1a, 0x3)
        runtime/proc.go:363 +0x108 fp=0xc000014ba0 sp=0xc000014b78 pc=0x49878
runtime.goparkunlock(0x0?, 0x80?, 0x53?, 0x8ddb8?)
        runtime/proc.go:369 +0x58 fp=0xc000014bc8 sp=0xc000014ba0 pc=0x498f0
sync.runtime_notifyListWait(0xc00016af10, 0x1dd)
        runtime/sema.go:517 +0x174 fp=0xc000014c00 sp=0xc000014bc8 pc=0x733fc
sync.(*Cond).Wait(0xc00016af00)
        sync/cond.go:70 +0x70 fp=0xc000014c28 sp=0xc000014c00 pc=0x8ddf0
golang.org/x/crypto/ssh.(*buffer).Read(0xc000060760, {0xc000190000, 0x8000, 0x8000})
        golang.org/x/crypto@v0.0.0-20211215153901-e495a2d5b3d3/ssh/buffer.go:94 +0x20c fp=0xc0c
golang.org/x/crypto/ssh.(*channel).ReadExtended(0xc000133800, {0xc000190000?, 0xc000190000?, 0)
        golang.org/x/crypto@v0.0.0-20211215153901-e495a2d5b3d3/ssh/channel.go:351 +0xd0 fp=0xc8
golang.org/x/crypto/ssh.(*channel).Read(0x1baa8?, {0xc000190000?, 0xc00016e220?, 0xc00016e220?)
        golang.org/x/crypto@v0.0.0-20211215153901-e495a2d5b3d3/ssh/channel.go:528 +0x50 fp=0xc8
io.copyBuffer({0x81a420, 0xc00016e220}, {0xffffff923c6ef8, 0xc000133800}, {0x0, 0x0, 0x0})
        io/io.go:427 +0x19c fp=0xc000014db0 sp=0xc000014d30 pc=0xb1a5c
io.Copy({0x81a420?, 0xc00016e220?}, {0xffffff923c6ef8?, 0xc000133800?})
        io/io.go:386 +0x5c fp=0xc000014df0 sp=0xc000014db0 pc=0xb18a4
net.genericReadFrom({0x818aa0?, 0xc00000c1f8?}, {0xffffff923c6ef8, 0xc000133800})
        net/net.go:675 +0x84 fp=0xc000014e28 sp=0xc000014df0 pc=0x138d1c
net.(*TCPConn).readFrom(0xc00000c1f8, {0xffffff923c6ef8, 0xc000133800})
        net/tcpsock_posix.go:54 +0x94 fp=0xc000014e50 sp=0xc000014e28 pc=0x13f5bc
net.(*TCPConn).ReadFrom(0xc00000c1f8, {0xffffff923c6ef8, 0xc000133800})
        net/tcpsock.go:130 +0x60 fp=0xc000014e88 sp=0xc000014e50 pc=0x13da90
io.copyBuffer({0x818aa0, 0xc00000c1f8}, {0xffffff923c6ef8, 0xc000133800}, {0x0, 0x0, 0x0})
        io/io.go:413 +0x140 fp=0xc000014f08 sp=0xc000014e88 pc=0xb1a00
io.Copy({0x818aa0?, 0xc00000c1f8?}, {0xffffff923c6ef8?, 0xc000133800?})
        io/io.go:386 +0x5c fp=0xc000014f48 sp=0xc000014f08 pc=0xb18a4
github.com/gliderlabs/ssh.(*ForwardedTCPHandler).HandleSSHRequest.func2.1.2()
        github.com/gliderlabs/ssh@v0.3.3/tcpip.go:166 +0xe4 fp=0xc000014fd8 sp=0xc000014f48 pcc
runtime.goexit()
        runtime/asm_riscv64.s:509 +0x4 fp=0xc000014fd8 sp=0xc000014fd8 pc=0x7688c
created by github.com/gliderlabs/ssh.(*ForwardedTCPHandler).HandleSSHRequest.func2.1
        github.com/gliderlabs/ssh@v0.3.3/tcpip.go:163 +0x1e8

goroutine 35 [sync.Cond.Wait]:
runtime.gopark(0x7e4170, 0xc00047b098, 0x14, 0x1a, 0x3)
        runtime/proc.go:363 +0x108 fp=0xc000012bf0 sp=0xc000012bc8 pc=0x49878
runtime.goparkunlock(0x4?, 0x1?, 0x0?, 0x8ddb8?)
        runtime/proc.go:369 +0x58 fp=0xc000012c18 sp=0xc000012bf0 pc=0x498f0
sync.runtime_notifyListWait(0xc00047b090, 0x0)
        runtime/sema.go:517 +0x174 fp=0xc000012c50 sp=0xc000012c18 pc=0x733fc
sync.(*Cond).Wait(0xc00047b080)
        sync/cond.go:70 +0x70 fp=0xc000012c78 sp=0xc000012c50 pc=0x8ddf0
golang.org/x/crypto/ssh.(*buffer).Read(0xc00011fac0, {0xc000188000, 0x8000, 0x8000})
        golang.org/x/crypto@v0.0.0-20211215153901-e495a2d5b3d3/ssh/buffer.go:94 +0x20c fp=0xc0c
golang.org/x/crypto/ssh.(*channel).ReadExtended(0xc000132d80, {0xc000188000?, 0xc000188000?, 0)
        golang.org/x/crypto@v0.0.0-20211215153901-e495a2d5b3d3/ssh/channel.go:351 +0xd0 fp=0xc8
golang.org/x/crypto/ssh.(*channel).Read(0x8000?, {0xc000188000?, 0x5d0701?, 0xc00016e1c0?})
        golang.org/x/crypto@v0.0.0-20211215153901-e495a2d5b3d3/ssh/channel.go:528 +0x50 fp=0xc8
github.com/gliderlabs/ssh.(*session).Read(0x1baa8?, {0xc000188000?, 0xc00016e1c0?, 0xc00016e1c)
        <autogenerated>:1 +0x58 fp=0xc000012da8 sp=0xc000012d80 pc=0x259af8
io.copyBuffer({0x81a780, 0xc00016e1c0}, {0xffffff923c5698, 0xc0000fd2b0}, {0x0, 0x0, 0x0})
        io/io.go:427 +0x19c fp=0xc000012e28 sp=0xc000012da8 pc=0xb1a5c
io.Copy({0x81a780?, 0xc00016e1c0?}, {0xffffff923c5698?, 0xc0000fd2b0?})
        io/io.go:386 +0x5c fp=0xc000012e68 sp=0xc000012e28 pc=0xb18a4
os.genericReadFrom(0x0?, {0xffffff923c5698, 0xc0000fd2b0})
        os/file.go:161 +0x7c fp=0xc000012ea0 sp=0xc000012e68 pc=0xddbbc
os.(*File).ReadFrom(0x6ec85b?, {0xffffff923c5698, 0xc0000fd2b0})
        os/file.go:155 +0xb4 fp=0xc000012ee0 sp=0xc000012ea0 pc=0xddafc
io.copyBuffer({0x818d60, 0xc00000c1e8}, {0xffffff923c5698, 0xc0000fd2b0}, {0x0, 0x0, 0x0})
        io/io.go:413 +0x140 fp=0xc000012f60 sp=0xc000012ee0 pc=0xb1a00
io.Copy({0x818d60?, 0xc00000c1e8?}, {0xffffff923c5698?, 0xc0000fd2b0?})
        io/io.go:386 +0x5c fp=0xc000012fa0 sp=0xc000012f60 pc=0xb18a4
github.com/u-root/cpu/server.handler.func2()
        github.com/u-root/cpu@v0.0.0/server/server.go:73 +0x54 fp=0xc000012fd8 sp=0xc000012fa0c
runtime.goexit()
        runtime/asm_riscv64.s:509 +0x4 fp=0xc000012fd8 sp=0xc000012fd8 pc=0x7688c
created by github.com/u-root/cpu/server.handler
        github.com/u-root/cpu@v0.0.0/server/server.go:72 +0x474

goroutine 27 [select]:
runtime.gopark(0x7e41d0, 0x0, 0x9, 0x18, 0x1)
        runtime/proc.go:363 +0x108 fp=0xc00045fda0 sp=0xc00045fd78 pc=0x49878
runtime.selectgo(0xc00045ffa8, 0xc00045ff50, 0x370?, 0x0, 0xc000132c00?, 0x1)
        runtime/select.go:328 +0x698 fp=0xc00045ff00 sp=0xc00045fda0 pc=0x59460
golang.org/x/crypto/ssh.(*handshakeTransport).kexLoop(0xc0000f82c0)
        golang.org/x/crypto@v0.0.0-20211215153901-e495a2d5b3d3/ssh/handshake.go:268 +0x224 fp=4
golang.org/x/crypto/ssh.newServerTransport.func2()
        golang.org/x/crypto@v0.0.0-20211215153901-e495a2d5b3d3/ssh/handshake.go:143 +0x2c fp=0c
runtime.goexit()
        runtime/asm_riscv64.s:509 +0x4 fp=0xc00045ffd8 sp=0xc00045ffd8 pc=0x7688c
created by golang.org/x/crypto/ssh.newServerTransport
        golang.org/x/crypto@v0.0.0-20211215153901-e495a2d5b3d3/ssh/handshake.go:143 +0x16c
[    1.351910] u-root init [optional]: warning creating mount -t "cgroup" -o perf_event "cgrout
[   25.183899] Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000200
[   25.184609] CPU: 0 PID: 65 Comm: init Not tainted 5.19.0 #4
[   25.184843] Hardware name: riscv-virtio,qemu (DT)
[   25.185052] Call Trace:
[   25.185255] [<ffffffff80003c5a>] dump_backtrace+0x1c/0x24
[   25.186117] [<ffffffff8041e4cc>] show_stack+0x2c/0x38
[   25.186256] [<ffffffff804259e4>] dump_stack_lvl+0x3c/0x54
[   25.186415] [<ffffffff80425a10>] dump_stack+0x14/0x1c
[   25.186566] [<ffffffff8041e828>] panic+0x102/0x2bc
[   25.186712] [<ffffffff800100b4>] do_exit+0x786/0x78c
[   25.186854] [<ffffffff800101da>] do_group_exit+0x24/0x7c
[   25.187007] [<ffffffff8001a514>] get_signal+0x64a/0x698
[   25.187148] [<ffffffff80002fb0>] do_notify_resume+0x6c/0x424
[   25.187304] [<ffffffff80001ebc>] ret_from_exception+0x0/0xc
[   25.187862] ---[ end Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000020---]
orangecms commented 1 year ago

Closing since I haven't observe this again in a long while. Fixed in Go upstream, so I expect it to be fine now.

We shall update the kernel image in the cpubinaries repo at some point.