Skip to content

runtime-tools: fix panics adjusting seccomp/rlimits of sectionless specs - #340

Merged
mikebrow merged 1 commit into
containerd:mainfrom
bx-sec:main
Oct 29, 2026
Merged

mikebrow merged 1 commit into
containerd:mainfrom
bx-sec:main

Conversation

@pandaWall

Copy link
Copy Markdown
Contributor

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.

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
klihub self-requested a review October 29, 2026 12:01

@mikebrow mikebrow left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@mikebrow
mikebrow merged commit d030620 into containerd:main Oct 29, 2026
16 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.

3 participants