Conversation
kolyshkin
left a comment
There was a problem hiding this comment.
This change is obviously wrong, or perhaps I'm missing something here?
Looking into runc sources, I see that poststart is run right after we start init, but before we tell it to continue. This is kind of what the current doc says.
what does "user-specified process" means ? does it refer to this run custom process ? In runc start |
It means a container process. I've double-checked runc's code, and I found a poststart hook is kicked after a container process started. |
|
Feel free to re-open if there is anything you want to discuss. Thanks for your contribution 🙏 |
|
config.json {
"ociVersion": "1.0.2-dev",
"process": {
"terminal": false,
"user": {
"uid": 0,
"gid": 0
},
"args": [
"sh"
],
"env": [
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
"TERM=xterm"
],
"cwd": "/",
"capabilities": {
"bounding": [
"CAP_AUDIT_WRITE",
"CAP_KILL",
"CAP_NET_BIND_SERVICE"
],
"effective": [
"CAP_AUDIT_WRITE",
"CAP_KILL",
"CAP_NET_BIND_SERVICE"
],
"permitted": [
"CAP_AUDIT_WRITE",
"CAP_KILL",
"CAP_NET_BIND_SERVICE"
],
"ambient": [
"CAP_AUDIT_WRITE",
"CAP_KILL",
"CAP_NET_BIND_SERVICE"
]
},
"rlimits": [
{
"type": "RLIMIT_NOFILE",
"hard": 1024,
"soft": 1024
}
],
"noNewPrivileges": true
},
"root": {
"path": "rootfs",
"readonly": false
},
"hostname": "runc",
"mounts": [
{
"destination": "/proc",
"type": "proc",
"source": "proc"
},
{
"destination": "/dev",
"type": "tmpfs",
"source": "tmpfs",
"options": [
"nosuid",
"strictatime",
"mode=755",
"size=65536k"
]
},
{
"destination": "/dev/pts",
"type": "devpts",
"source": "devpts",
"options": [
"nosuid",
"noexec",
"newinstance",
"ptmxmode=0666",
"mode=0620"
]
},
{
"destination": "/dev/shm",
"type": "tmpfs",
"source": "shm",
"options": [
"nosuid",
"noexec",
"nodev",
"mode=1777",
"size=65536k"
]
},
{
"destination": "/dev/mqueue",
"type": "mqueue",
"source": "mqueue",
"options": [
"nosuid",
"noexec",
"nodev"
]
},
{
"destination": "/sys",
"type": "sysfs",
"source": "sysfs",
"options": [
"nosuid",
"noexec",
"nodev",
"ro"
]
},
{
"destination": "/sys/fs/cgroup",
"type": "cgroup",
"source": "cgroup",
"options": [
"nosuid",
"noexec",
"nodev",
"relatime",
"ro"
]
}
],
"hooks": {
"Poststart": [
{
"path": "/usr/bin/sleep",
"args": ["/usr/bin/sleep","10"]
}
]
},
"linux": {
"resources": {
"devices": [
{
"allow": false,
"access": "rwm"
}
]
},
"uidMappings": [
{
"containerID": 0,
"hostID": 1000,
"size": 1
}
],
"gidMappings": [
{
"containerID": 0,
"hostID": 1000,
"size": 1
}
],
"namespaces": [
{
"type": "pid"
},
{
"type": "network"
},
{
"type": "ipc"
},
{
"type": "uts"
},
{
"type": "mount"
}
],
"maskedPaths": [
"/proc/acpi",
"/proc/asound",
"/proc/kcore",
"/proc/keys",
"/proc/latency_stats",
"/proc/timer_list",
"/proc/timer_stats",
"/proc/sched_debug",
"/sys/firmware",
"/proc/scsi"
],
"readonlyPaths": [
"/proc/bus",
"/proc/fs",
"/proc/irq",
"/proc/sys",
"/proc/sysrq-trigger"
]
}
}
I set that means user-specified process doesn't run. (user-specified process will run in runc start stage). @utam0k |
|
@utam0k I think this is a runc bug.
That is what we are doing, but that's not what the spec says should happen AFAICS. The spec says that we should run |
cyphar
left a comment
There was a problem hiding this comment.
If runc's behaviour doesn't match the spec then we need to fix runc.
@cyphar @ningmingxiao I revised the runc's code and I found my misunderstanding. Thanks for pointing out it to me 🙏
+1 |
|
I wonder if we should check other runtimes ... |
crun have same problem |
Thanks! cc: @giuseppe |
@ningmingxiao $ time sudo ./youki create -b postStart-bug test
sudo ./youki create -b postStart-bug test 0.00s user 0.01s system 17% cpu 0.047 total |
@ningmingxiao |
I recheck crun it is ok. |
|
opencontainers/runc#4348 (comment) Could you please help to check this in crun and youki? Thanks. |
As far as my investigation, the latest crun and youki couldn't reproduce this issue. |
I find poststart is in runc create stage