-
Notifications
You must be signed in to change notification settings - Fork 49
Fix: Add nil checks for all Linux spec dereferences #398
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Fix: Add nil checks for all Linux spec dereferences #398
Conversation
Signed-off-by: Yashika0724 <ssyashika1311@gmail.com>
✅ Deploy Preview for urunc canceled.
|
✅ Deploy Preview for urunc ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Hi @cmainas , this PR adds minimal nil checks to prevent a panic when the OCI spec omits the linux field. |
|
Hello @Yashika0724 , these changes are in the same context as #396. Therefore, please merge them under one PR. For more information take a look in the contribution guide. |
|
This PR addresses #409. SummaryThe OCI runtime-spec defines Changes
These are defensive checks that improve robustness without changing behavior for existing |
cmainas
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello @Yashika0724 ,
I think you forgot the checks from #396
Signed-off-by: Yashika0724 <ssyashika1311@gmail.com>
|
Thanks for the catch! |
Summary
This PR fixes a nil pointer dereference that can occur during container creation when the OCI spec
does not include the linux section, which is valid per the OCI runtime specification.
Several code paths assume Spec.Linux is always present, including FormatNsenterInfo() which is
executed during CREATE. When the field is missing, urunc panics before reaching Exec().
This change adds defensive checks to safely handle optional OCI fields while preserving existing
behavior for valid specs.
Root Cause
The OCI spec defines linux as optional, but the runtime dereferenced Spec.Linux without nil
checks in namespace setup and execution paths, leading to a panic when the field is absent.
Fix Applied
Defensive nil checks were added before dereferencing Spec.Linux in:
• FormatNsenterInfo()
• relevant paths in Exec()
• joinSandboxNetNs()
Valid OCI specs continue to follow the same execution flow.
Impact
• Prevents runtime panics during CREATE
• Improves stability for malformed or incomplete OCI specs
• No change to intended runtime behavior