Repository navigation
Disable checkpoint restore codepath when CRIU is not installed - #13664
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds an explicit CRI configuration switch and runtime validation to prevent checkpoint/restore paths from being exercised when CRIU is disabled or not usable, and wires shim-manager environment (notably PATH) into the CRI server to resolve the CRIU binary consistently.
Changes:
- Introduces
disable_criuruntime config and enforces it in CRI checkpoint/restore entrypoints. - Plumbs shim-manager environment into the CRI service to resolve
criufrom the shim-configured PATH (with a fallback to the daemon PATH). - Adds unit/integration coverage (Go tests + a contrib e2e script) and runs the new script in CI.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| plugins/cri/cri.go | Makes Shim plugin available to CRI init and passes shim environment into CRI service options. |
| internal/cri/server/service.go | Stores shim environment on criService and adds state for CRIU validation caching. |
| internal/cri/server/container_checkpoint_linux.go | Adds CRIU path resolution + validation and gates checkpoint/restore entrypoints on it. |
| internal/cri/server/container_checkpoint_linux_test.go | Adds unit tests for CRIU path resolution and disable/enable gating behavior. |
| internal/cri/config/config.go | Adds DisableCRIU (disable_criu) to CRI runtime configuration. |
| internal/cri/config/config_unix.go | Sets the default DisableCRIU value for Unix defaults. |
| internal/cri/config/config_windows.go | Sets the default DisableCRIU value for Windows defaults. |
| internal/cri/config/config_test.go | Adds a test asserting the default for DisableCRIU is false. |
| internal/cri/config/disable_criu_test.go | Adds TOML parsing coverage for disable_criu. |
| core/runtime/v2/shim_manager.go | Exposes shim-manager environment via an Env() accessor (defensive copy). |
| contrib/checkpoint/checkpoint-restore-cri-disable-test.sh | New e2e-style script validating fail-fast behavior when CRIU is disabled/missing and precedence vs other errors. |
| .github/workflows/ci.yml | Runs the new disable-focused checkpoint/restore validation script in CI (with an ARM exclusion). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
commented
Jun 25, 2026
|
random-ish feedback ... if we are saying that for CRIU to work you have to do:
then one would expect the flag to be |
commented
Jun 25, 2026
|
The patch set as-is doesn't change the default, so having criu installed and default config makes it work. Default disable would be slightly different and I didn't propose that (yet) since I'd like to be able to cherry pick back to 2.3, 2.2, and 2.1. Name of the option could go either way though. I'm not at all attached to what it is right now. |
commented
Jun 25, 2026
|
gotcha @samuelkarp ... am flexible as well. will leave it to you |
|
|
||
| // DisableCRIU disables CRIU (Checkpoint/Restore In Userspace) support. | ||
| // When set to true, checkpoint/restore operations will be disabled. | ||
| DisableCRIU bool `toml:"disable_criu" json:"disableCriu"` |
There was a problem hiding this comment.
My 2 cents -- I find double-negatives (disabled=false) harder to reason about than enabled=true
There was a problem hiding this comment.
Yeah, might be worth flipping this to EnableCRIU *bool with a default value of true for now. I agree about the double-negatives.
be18e31 to
cc44c5b
Compare
cc44c5b to
ce87133
Compare
ce87133 to
b3082cc
Compare
b3082cc to
bc1df90
Compare
bc1df90 to
aca39bb
Compare
aca39bb to
0acce08
Compare
0acce08 to
81a83fa
Compare
| sandbox *sandbox.Sandbox, | ||
| sandboxConfig *runtime.PodSandboxConfig, | ||
| ) (ctrID string, retErr error) { | ||
| if err := c.checkCriu(); err != nil { |
There was a problem hiding this comment.
Just for my understanding.
This PR seems to do a lot more then just disables criu checkpointing?
Otherwise it'd be as simple as:
if !c.config.EnableCRIU {
return error.New("criu disabled by administrator")
}What's the motivation to change criu discovery?
There was a problem hiding this comment.
I don't think we can (yet) change the default from enable_criu = true to enable_criu = false (I want to do that too, but it'll need deprecation warnings and wouldn't be backportable to our existing releases). But if criu isn't installed, the value of that toggle shouldn't really matter and we can avoid going into the CRIU-related codepaths entirely. If we detect the installation status and can disable the relevant codepath on nodes without criu installed, then this change could be backported to our existing releases.
commented
Jul 8, 2026
|
/cherry-pick release/2.3 |
commented
Jul 8, 2026
|
@samuelkarp: #13664 failed to apply on top of branch "release/2.2": DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
commented
Jul 8, 2026
|
@samuelkarp: new pull request created: #13734 DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
Checkpoint restore was implicated in several recent CVEs. While those have been patched, it would also be helpful to avoid running the code if it can't be used anyway (i.e., if CRIU isn't installed) or if a node administrator wants to specifically disable it.