Repository navigation
runtime-tools: fix panics adjusting seccomp/rlimits of sectionless specs - #340
Merged
Merged
Conversation
AdjustSeccompPolicy() and AdjustRlimits() write to g.Config.Linux and g.Config.Process without making sure the corresponding OCI Spec section exists. Every other adjuster initializes the section it touches first (AdjustResources() calls initConfigLinux(), AdjustLinuxScheduler() and SetProcessIOPriority() call initConfigProcess(), ...), but these two are missing the corresponding calls. A plugin adjustment carrying a seccomp policy or POSIX rlimits therefore takes the runtime down with a nil pointer dereference on a Spec that does not have the relevant section. Signed-off-by: pandaWall <mangosteen922@126.com>
klihub
self-requested a review
October 29, 2026 12:01
klihub
approved these changes
Oct 29, 2026
mikebrow
approved these changes
Oct 29, 2026
mikebrow
left a comment
Member
There was a problem hiding this comment.
LGTM
A similar follow-up found in local testing: just below the AdjustRlimits() fix.. AdjustMounts() reads g.Config.Linux.RootfsPropagation in the rslave case without initializing Linux. An rslave bind mount on an empty spec panics at generate.go:639. The rshared case is safe because SetLinuxRootPropagation initializes the section. The fix is a g.initConfigLinux() before line 639, ideally with a test.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
AdjustSeccompPolicy() and AdjustRlimits() write to g.Config.Linux and g.Config.Process without making sure the corresponding OCI Spec section exists. Every other adjuster initializes the section it touches first (AdjustResources() calls initConfigLinux(), AdjustLinuxScheduler() and SetProcessIOPriority() call initConfigProcess(), ...), but these two are missing the corresponding calls. A plugin adjustment carrying a seccomp policy or POSIX rlimits therefore takes the runtime down with a nil pointer dereference on a Spec that does not have the relevant section.