Skip to content

linux: run createContainer hooks after mounts are set up - #2168

Merged
giuseppe merged 1 commit into
containers:mainfrom
giuseppe:fix-oci-hooks-order
Aug 7, 2026
Merged

linux: run createContainer hooks after mounts are set up#2168
giuseppe merged 1 commit into
containers:mainfrom
giuseppe:fix-oci-hooks-order

Conversation

@giuseppe

@giuseppe giuseppe commented Aug 6, 2026

Copy link
Copy Markdown
Member

PR #2094 moved libcrun_set_mounts after pivot_root but left the createContainer hooks before both, so they ran before /proc and other mounts existed, violating the OCI spec and breaking the NVIDIA Container Toolkit.

Add create_container_len to can_use_open_tree_namespace() so the deferred-pivot path is used, and move the hooks to run after libcrun_set_mounts and before the pivot in libcrun_finalize_mounts.

Fixes: #2167

PR containers#2094 moved libcrun_set_mounts after pivot_root but left the
createContainer hooks before both, so they ran before /proc and other
mounts existed, violating the OCI spec and breaking the NVIDIA Container
Toolkit.

Add create_container_len to can_use_open_tree_namespace() so the
deferred-pivot path is used, and move the hooks to run after
libcrun_set_mounts and before the pivot in libcrun_finalize_mounts.

Fixes: containers#2167

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
@giuseppe

giuseppe commented Aug 6, 2026

Copy link
Copy Markdown
Member Author

@jnovy PTAL

@jnovy

jnovy commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

LGTM

@giuseppe

giuseppe commented Aug 6, 2026

Copy link
Copy Markdown
Member Author

@henry118 could you verify if it solves your issue?

@henry118

henry118 commented Aug 6, 2026

Copy link
Copy Markdown

@giuseppe this patch worked! thanks for the quick fix

@giuseppe
giuseppe merged commit a437b0e into containers:main Aug 7, 2026
47 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

createContainer hooks run before mounts are set up, violating OCI runtime spec

3 participants