Skip to content
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

fix: Check nil values in container specification json #67

Merged
merged 1 commit into from
Oct 8, 2024

Conversation

cmainas
Copy link
Collaborator

@cmainas cmainas commented Oct 7, 2024

It seems that if we do not pass any memory specific argument in some versions of nerdctl then Linux.Resource.Memory object in container's config.json will be nil (not set). Therefore, we get nil dereference and golang traps.

This PR checks for nil objects before retrieving the memory from container's config.json file. In addition, it simplifies the process of setting the VMM memory by removing the type conventions. Moreover, it checks the corner case of giving a too small memory (less than 1MB)

@cmainas cmainas marked this pull request as ready for review October 7, 2024 11:50
@cmainas cmainas requested a review from gntouts October 7, 2024 11:51
Copy link
Collaborator

@gntouts gntouts left a comment

Choose a reason for hiding this comment

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

Thanks, @cmainas! Everything looks good.

It seems that if we do not pass any memory specific argument in
some versions of nerdctl then Linux.Resource.Memory object
in container's config.json will be nil (not set). Therefore, we get nil
dereference and golang traps.

This PR checks for nil objects before retrieving the memory from
container's config.json file. In addition, it simplifies the process of
setting the VMM memory by removing the type conventions. Moreover, it
checks the corner case of giving a too small memory (less than 1MB)

PR: #67
Signed-off-by: Charalampos Mainas <[email protected]>
Reviewed-by: Georgios Ntoutsos <[email protected]>
Approved-by: Georgios Ntoutsos <[email protected]>
@ananos ananos removed the ok-to-test label Oct 7, 2024
@github-actions github-actions bot force-pushed the fix_reconfigurable_memory branch from 7da6793 to c15050f Compare October 7, 2024 14:31
@gntouts gntouts merged commit c5ecb7b into main Oct 8, 2024
8 checks passed
@gntouts gntouts deleted the fix_reconfigurable_memory branch October 8, 2024 07:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants