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: Limit amount of memory used during snapshot deserialization #4480

Merged

Conversation

roypat
Copy link
Contributor

@roypat roypat commented Mar 1, 2024

When switching from Versionize to bincode in #4230, we accidentally dropped a check limiting how much memory the deserialization routine can allocate [1]. This commit reimplements this check for the new bincode-based deserialization routine, with a limit matching that of the old Versionize check.

License Acceptance

By submitting this pull request, I confirm that my contribution is made under
the terms of the Apache 2.0 license. For more information on following Developer
Certificate of Origin and signing off your commits, please check
CONTRIBUTING.md.

PR Checklist

  • If a specific issue led to this PR, this PR closes the issue.
  • The description of changes is clear and encompassing.
  • Any required documentation changes (code and docs) are included in this
    PR.
  • API changes follow the Runbook for Firecracker API changes.
  • User-facing changes are mentioned in CHANGELOG.md.
  • All added/changed functionality is tested.
  • New TODOs link to an issue.
  • Commits meet
    contribution quality standards.

  • This functionality cannot be added in rust-vmm.

@roypat roypat added the Status: Awaiting review Indicates that a pull request is ready to be reviewed label Mar 1, 2024
When switching from Versionize to bincode in firecracker-microvm#4230, we accidentally
dropped a check limiting how much memory the deserialization routine can
allocate [[1]]. This commit reimplements this check for the new
bincode-based deserialization routine, with a limit matching that of the
old Versionize check.

[1]: https://github.com/firecracker-microvm/versionize/blob/main/src/primitives.rs#L14C33-L14C43

Signed-off-by: Patrick Roy <roypat@amazon.co.uk>
@roypat roypat changed the base branch from main to firecracker-v1.7 March 1, 2024 11:07
@roypat roypat requested review from bchalios and ShadowCurse and removed request for kalyazin, xmarcalx, pb8o and sudanl0 March 1, 2024 11:08
src/vmm/src/snapshot/mod.rs Show resolved Hide resolved
Copy link

codecov bot commented Mar 1, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 81.63%. Comparing base (84655de) to head (1fe044d).

Additional details and impacted files
@@                Coverage Diff                @@
##           firecracker-v1.7    #4480   +/-   ##
=================================================
  Coverage             81.62%   81.63%           
=================================================
  Files                   243      243           
  Lines                 29796    29803    +7     
=================================================
+ Hits                  24322    24329    +7     
  Misses                 5474     5474           
Flag Coverage Δ
4.14-c5n.metal 78.94% <100.00%> (+<0.01%) ⬆️
4.14-c7g.metal ?
4.14-m5d.metal ?
4.14-m5n.metal 78.93% <100.00%> (+<0.01%) ⬆️
4.14-m6a.metal 78.07% <100.00%> (+<0.01%) ⬆️
4.14-m6g.metal 77.03% <100.00%> (+<0.01%) ⬆️
4.14-m6i.metal 78.93% <100.00%> (+<0.01%) ⬆️
4.14-m7g.metal 77.03% <100.00%> (+<0.01%) ⬆️
5.10-c5n.metal 81.60% <100.00%> (+<0.01%) ⬆️
5.10-c7g.metal ?
5.10-m5d.metal ?
5.10-m5n.metal 81.59% <100.00%> (+<0.01%) ⬆️
5.10-m6a.metal 80.83% <100.00%> (+<0.01%) ⬆️
5.10-m6g.metal 79.92% <100.00%> (+<0.01%) ⬆️
5.10-m6i.metal 81.59% <100.00%> (+<0.01%) ⬆️
5.10-m7g.metal 79.92% <100.00%> (+<0.01%) ⬆️
6.1-c5n.metal 81.60% <100.00%> (+<0.01%) ⬆️
6.1-c7g.metal ?
6.1-m5d.metal ?
6.1-m5n.metal 81.59% <100.00%> (+<0.01%) ⬆️
6.1-m6a.metal 80.83% <100.00%> (+<0.01%) ⬆️
6.1-m6g.metal 79.92% <100.00%> (+<0.01%) ⬆️
6.1-m6i.metal 81.59% <100.00%> (+<0.01%) ⬆️
6.1-m7g.metal 79.92% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@roypat roypat merged commit 1e8f903 into firecracker-microvm:firecracker-v1.7 Mar 1, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Awaiting review Indicates that a pull request is ready to be reviewed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants