Skip to content

runc gets stuck #4640

@tomaszduda23

Description

@tomaszduda23

Description

runc stoped working after update from 1.1.15 to 1.2.4. It seems to be some kind of race condition since there are two errors types.
termux/termux-packages#23181 (comment)
I've not checked in details though. It happens in termux but probably the same thing can happen in other platforms.

runc get stuck with following log:

DEBU[0000]libcontainer/cgroups/file.go:119 libcontainer/cgroups.prepareOpenat2.func1() openat2 not available, falling back to securejoin 
DEBU[0000]libcontainer/dmz/cloned_binary_linux.go:202 libcontainer/dmz.IsCloned() F_GET_SEALS on /proc/self/exe failed: invalid argument 
DEBU[0000]libcontainer/dmz/cloned_binary_linux.go:230 libcontainer/dmz.CloneSelfExe() could not use overlayfs for /proc/self/exe sealing -- falling back to making a temporary copy  error="fsopen overlay: function not implemented"
DEBU[0000]libcontainer/dmz/cloned_binary_linux.go:177 libcontainer/dmz.CloneBinary() cloning /proc/self/exe binary (9591120 bytes) 
DEBU[0000]libcontainer/container_linux.go:506 libcontainer.(*Container).newParentProcess() runc-dmz: using /proc/self/exe clone         
DEBU[0000] nsexec[23221]: => nsexec container setup     
DEBU[0000] nsexec-0[23221]: ~> nsexec stage-0           
DEBU[0000] nsexec-0[23221]: spawn stage-1               
DEBU[0000] nsexec-0[23221]: -> stage-1 synchronisation loop 
DEBU[0000] nsexec-1[23222]: ~> nsexec stage-1           
DEBU[0000] nsexec-1[23222]: unshare remaining namespaces 
DEBU[0000] nsexec-1[23222]: spawn stage-2               
DEBU[0000] nsexec-1[23222]: request stage-0 to forward stage-2 pid (23223) 
DEBU[0000] nsexec-2[1]: ~> nsexec stage-2

strace.txt

Second error:

DEBU[0000]libcontainer/cgroups/file.go:119 libcontainer/cgroups.prepareOpenat2.func1() openat2 not available, falling back to securejoin 
DEBU[0000]libcontainer/dmz/cloned_binary_linux.go:202 libcontainer/dmz.IsCloned() F_GET_SEALS on /proc/self/exe failed: invalid argument 
DEBU[0000]libcontainer/dmz/cloned_binary_linux.go:230 libcontainer/dmz.CloneSelfExe() could not use overlayfs for /proc/self/exe sealing -- falling back to making a temporary copy  error="fsopen overlay: function not implemented"
DEBU[0000]libcontainer/dmz/cloned_binary_linux.go:177 libcontainer/dmz.CloneBinary() cloning /proc/self/exe binary (9591120 bytes) 
DEBU[0000]libcontainer/container_linux.go:506 libcontainer.(*Container).newParentProcess() runc-dmz: using /proc/self/exe clone         
DEBU[0000]libcontainer/logs/logs.go:55 libcontainer/logs.processEntry() nsexec[23142]: => nsexec container setup     
DEBU[0000]libcontainer/logs/logs.go:55 libcontainer/logs.processEntry() nsexec-0[23142]: ~> nsexec stage-0           
DEBU[0000]libcontainer/logs/logs.go:55 libcontainer/logs.processEntry() nsexec-0[23142]: spawn stage-1               
DEBU[0000]libcontainer/logs/logs.go:55 libcontainer/logs.processEntry() nsexec-0[23142]: -> stage-1 synchronisation loop 
DEBU[0000]libcontainer/logs/logs.go:55 libcontainer/logs.processEntry() nsexec-1[23143]: ~> nsexec stage-1           
DEBU[0000]libcontainer/logs/logs.go:55 libcontainer/logs.processEntry() nsexec-1[23143]: unshare remaining namespaces 
DEBU[0000]libcontainer/logs/logs.go:55 libcontainer/logs.processEntry() nsexec-1[23143]: spawn stage-2               
DEBU[0000]libcontainer/logs/logs.go:55 libcontainer/logs.processEntry() nsexec-1[23143]: request stage-0 to forward stage-2 pid (23144) 
DEBU[0000]libcontainer/logs/logs.go:55 libcontainer/logs.processEntry() nsexec-1[23142]: stage-1 requested pid to be forwarded 
FATA[0000]libcontainer/logs/logs.go:55 libcontainer/logs.processEntry() nsexec-1[23142]: failed to sync with stage-1: read(stage2_pid): Bad file descriptor 
DEBU[0000]libcontainer/logs/logs.go:55 libcontainer/logs.processEntry() nsexec-2[1]: ~> nsexec stage-2               
FATA[0000]libcontainer/logs/logs.go:55 libcontainer/logs.processEntry() nsexec-2[1]: failed to sync with parent: read(SYNC_GRANDCHILD): No such file or directory 
ERRO[0000]utils.go:62 main.fatalWithCode() runc run failed: unable to start container process: can't get final child's PID from pipe: EOF

Steps to reproduce the issue

  1. mkdir -p test-container/rootfs
  2. cd test-container
  3. runc spec
  4. docker export $(docker create busybox) | tar -C rootfs -xvf -
  5. runc --debug run test-container

Describe the results you received and expected

runc get stucked. Shell should be started instead

What version of runc are you using?

runc version 1.2.4
spec: 1.2.0
go: go1.23.5
libseccomp: 2.5.5

Host OS information

Android 14

Host kernel information

Linux localhost 4.19.318-perf-g47d6e64cde05-dirty #10 SMP PREEMPT Sun Feb 2 15:34:00 UTC 2025 aarch64 Android

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions