Repository navigation
Description
Description
StartSubcontainer on a sandbox in state restoringUnstarted calls cm.RestoreSubcontainer(args, nil). RestoreSubcontainer then assigns reply.KernelStarted with no nil check, so the sentry panics after the subcontainer has restored and the whole sandbox dies.
The CLI route (Sandbox.RestoreSubcontainer) passes &reply, so runsc restore <sub> on the same checkpoint works. With containerd, the shim's normal create + start for a subcontainer of a restoring sandbox hits the nil path.
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xb99e44]
gvisor.dev/gvisor/runsc/boot.(*containerManager).RestoreSubcontainer(0x..., 0x..., 0x0)
runsc/boot/controller.go:699 +0x8c4
gvisor.dev/gvisor/runsc/boot.(*containerManager).StartSubcontainer(0x..., 0x..., 0x0?)
runsc/boot/controller.go:221 +0x208
Fix: return cm.RestoreSubcontainer(args, &sentryapi.RestoreReply{}).
Steps to reproduce
[🤖 Claude assisted]
As root on Linux, with runsc and jq on PATH and any rootfs that has /bin/sleep at /repro/rootfs (for example docker export $(docker create busybox) | tar -xC /repro/rootfs):
mkdir -p /repro/root /repro/sub /repro/run
cp -a /repro/rootfs /repro/rootfs-root
cp -a /repro/rootfs /repro/rootfs-sub
runsc spec --bundle /repro/root -- /bin/sleep 1d
runsc spec --bundle /repro/sub -- /bin/sleep 1d
jq '.root.path="/repro/rootfs-root" | .annotations={"io.kubernetes.cri.container-type":"sandbox"}' /repro/root/config.json > /tmp/c && mv /tmp/c /repro/root/config.json
jq '.root.path="/repro/rootfs-sub" | .annotations={"io.kubernetes.cri.container-type":"container","io.kubernetes.cri.sandbox-id":"root"}' /repro/sub/config.json > /tmp/c && mv /tmp/c /repro/sub/config.json
R="runsc --platform=systrap --network=none --ignore-cgroups --root=/repro/run"
$R create --bundle /repro/root root && $R start root
$R create --bundle /repro/sub sub && $R start sub
$R checkpoint --image-path /repro/img --compression=none root
$R delete --force sub
$R delete --force root
$R restore --bundle /repro/root --image-path /repro/img --detach root # sandbox now restoringUnstarted, 1 of 2
$R create --bundle /repro/sub sub # exit 0
$R start sub # EOF, sandbox gone$R restore --bundle /repro/sub --image-path /repro/img --detach sub in place of the last two lines works.
runsc version
runsc version release-20261102.0
spec: 1.2.1docker version (if using docker)
uname
No response
kubectl (if using Kubernetes)
repo state (if built from source)
No response
runsc debug logs (if available)
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xb99e44]
goroutine 100 gp=0x644db534960 m=6 mp=0x644db530008 [running]:
panic({0x209e7b0?, 0x2221120?})
GOROOT/src/runtime/panic.go:878 +0x150 fp=0x644db548fa0 sp=0x644db548ef0 pc=0x99cb0
runtime.panicmem(...)
GOROOT/src/runtime/panic.go:336
runtime.sigpanic()
GOROOT/src/runtime/signal_unix.go:931 +0x2dc fp=0x644db549000 sp=0x644db548fa0 pc=0x9c8dc
gvisor.dev/gvisor/runsc/boot.(*containerManager).RestoreSubcontainer(0x644db49d3e0, 0x644db5211f0, 0x0)
runsc/boot/controller.go:699 +0x8c4 fp=0x644db549210 sp=0x644db549010 pc=0xb99e44
gvisor.dev/gvisor/runsc/boot.(*containerManager).StartSubcontainer(0x644db49d3e0, 0x644db5211f0, 0x0?)
runsc/boot/controller.go:221 +0x208 fp=0x644db549590 sp=0x644db549210 pc=0xb963b8
runtime.call32(0x644db3481b0, 0x644db282a48, 0x0, 0x0, 0x0, 0x18, 0x644db5497f8)
src/runtime/asm_arm64.s:650 +0x70 fp=0x644db5495c0 sp=0x644db549590 pc=0xa0630
runtime.reflectcall(0x1f4ff80?, 0x227f220?, 0x4?, 0xc14edd?, 0x0?, 0x12?, 0x1f4ff80?)
<autogenerated>:1 +0x24 fp=0x644db549600 sp=0x644db5495c0 pc=0xa3b64
reflect.Value.call({0x644db2b5a40?, 0x644db282a48?, 0x644db625c18?}, {0xc00d50, 0x4}, {0x644db625ed8, 0x3, 0x3d8a70?})
GOROOT/src/reflect/value.go:586 +0xa88 fp=0x644db549bd0 sp=0x644db549600 pc=0xe5878
reflect.Value.Call({0x644db2b5a40?, 0x644db282a48?, 0xc384b3?}, {0x644db625ed8?, 0x644db5211f0?, 0x644db6f1f20?})
GOROOT/src/reflect/value.go:369 +0x94 fp=0x644db549c50 sp=0x644db549bd0 pc=0xe4c24
gvisor.dev/gvisor/pkg/urpc.(*Server).handleOne(0x644db4e8870, 0x644db4531c0)
pkg/urpc/urpc.go:360 +0x498 fp=0x644db549f70 sp=0x644db549c50 pc=0x3d87d8
gvisor.dev/gvisor/pkg/urpc.(*Server).handleRegistered(...)
pkg/urpc/urpc.go:481
gvisor.dev/gvisor/pkg/urpc.(*Server).StartHandling.func1()
pkg/urpc/urpc.go:505 +0x60 fp=0x644db549fd0 sp=0x644db549f70 pc=0x3daad0
runtime.goexit({})
src/runtime/asm_arm64.s:1039 +0x4 fp=0x644db549fd0 sp=0x644db549fd0 pc=0xa1fa4
created by gvisor.dev/gvisor/pkg/urpc.(*Server).StartHandling in goroutine 46
pkg/urpc/urpc.go:503 +0x74
Activity