Skip to content

Conversation

@Manciukic
Copy link
Contributor

@Manciukic Manciukic commented Nov 19, 2025

Changes

Fuzzer fixes:

  • convert bitvec to Vec<bool> to persist to avoid crashes on restore of malformed snapshot
  • check memory region state validity during snapshot restore (there is one DRAM region and it's plugged)
  • do not unwrap in mmio restore code (persist.rs)

Integ test fixes:

  • increase fillmem timeout to 30s (it was timing out on m6a)
  • increase memory size to allow 16GB hotplug in perf tests

Reason

Fix crashes detected by the fuzzer.

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

  • I have read and understand CONTRIBUTING.md.
  • I have run tools/devtool checkbuild --all to verify that the PR passes
    build checks on all supported architectures.
  • I have run tools/devtool checkstyle to verify that the PR passes the
    automated style checks.
  • I have described what is done in these changes, why they are needed, and
    how they are solving the problem in a clear and encompassing way.
  • I have updated any relevant documentation (both in code and in the docs)
    in the PR.
  • I have mentioned all user-facing changes in CHANGELOG.md.
  • If a specific issue led to this PR, this PR closes the issue.
  • When making API changes, I have followed the
    Runbook for Firecracker API changes.
  • I have tested all new and changed functionalities in unit tests and/or
    integration tests.
  • I have linked an issue to every new TODO.

  • This functionality cannot be added in rust-vmm.
@codecov
Copy link

codecov bot commented Nov 19, 2025

Codecov Report

❌ Patch coverage is 68.18182% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.32%. Comparing base (0c156c4) to head (e5f6dc9).
⚠️ Report is 5 commits behind head on feature/virtio-mem.

Files with missing lines Patch % Lines
src/vmm/src/vstate/memory.rs 58.82% 7 Missing ⚠️
Additional details and impacted files
@@ Coverage Diff @@ ## feature/virtio-mem #5521 +/- ## ====================================================== - Coverage 83.34% 83.32% -0.03%  ====================================================== Files 276 276 Lines 28810 28823 +13 ====================================================== + Hits 24012 24017 +5  - Misses 4798 4806 +8 
Flag Coverage Δ
5.10-m5n.metal 83.55% <68.18%> (-0.04%) ⬇️
5.10-m6a.metal 82.86% <68.18%> (-0.03%) ⬇️
5.10-m6g.metal 80.31% <68.18%> (-0.02%) ⬇️
5.10-m6i.metal 83.55% <68.18%> (-0.03%) ⬇️
5.10-m7a.metal-48xl 82.86% <68.18%> (-0.02%) ⬇️
5.10-m7g.metal 80.31% <68.18%> (-0.02%) ⬇️
5.10-m7i.metal-24xl 83.51% <68.18%> (-0.02%) ⬇️
5.10-m7i.metal-48xl 83.51% <68.18%> (-0.03%) ⬇️
5.10-m8g.metal-24xl 80.31% <68.18%> (-0.02%) ⬇️
5.10-m8g.metal-48xl 80.31% <68.18%> (-0.03%) ⬇️
6.1-m5n.metal 83.57% <68.18%> (-0.03%) ⬇️
6.1-m6a.metal 82.90% <68.18%> (-0.02%) ⬇️
6.1-m6g.metal 80.31% <68.18%> (-0.03%) ⬇️
6.1-m6i.metal 83.57% <68.18%> (-0.02%) ⬇️
6.1-m7a.metal-48xl 82.88% <68.18%> (-0.02%) ⬇️
6.1-m7g.metal 80.31% <68.18%> (-0.03%) ⬇️
6.1-m7i.metal-24xl 83.58% <68.18%> (-0.03%) ⬇️
6.1-m7i.metal-48xl 83.58% <68.18%> (-0.03%) ⬇️
6.1-m8g.metal-24xl 80.31% <68.18%> (-0.03%) ⬇️
6.1-m8g.metal-48xl 80.31% <68.18%> (-0.02%) ⬇️

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.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
@Manciukic Manciukic marked this pull request as ready for review November 19, 2025 14:53
@Manciukic Manciukic added the Status: Awaiting review Indicates that a pull request is ready to be reviewed label Nov 19, 2025
When the fuzzer generates an invalid bitvec state, the serde code crashes with an assertion error. To avoid these crashes, just store it as a plain Vec<bool> as we don't expect these vecs to be too big (for a 10GB hotpluggable area with 2MiB blocks it would require 5kB for the Vec<bool> compared to 640B with BitVec). Signed-off-by: Riccardo Mancini <mancio@amazon.com>
Return the error up the stack instead of unwrapping it. Note that on PCI this error is unwrapped for every device so there's no change there. Signed-off-by: Riccardo Mancini <mancio@amazon.com>
When the region state is invalid or corrupted (like when generated by the fuzzer), it is possible that a DRAM slot is unplugged, leading to segfaults when accessing guest memory (ie from vmgenid device). To avoid these crashes, validate the region state and allow the DRAM region (not hot-pluggable) to only contain one plugged slot. Signed-off-by: Riccardo Mancini <mancio@amazon.com>
Sometimes on m6a the uffd test fails to write 1.2GB within 10s. Bump the timeout to 30s. Signed-off-by: Riccardo Mancini <mancio@amazon.com>
@Manciukic Manciukic force-pushed the virtio-mem/fix-fuzzer branch from 1cab5f6 to 19fc136 Compare November 19, 2025 15:28
The previously set 256MB were not enough for hotplugging 16GB of memory. This is because the kernel needs 64B for every 4kB page, meaning 262MB for 16GB. Signed-off-by: Riccardo Mancini <mancio@amazon.com>
@Manciukic Manciukic force-pushed the virtio-mem/fix-fuzzer branch from 379c645 to e5f6dc9 Compare November 20, 2025 09:35
@Manciukic Manciukic changed the title [virtio-mem] Fix fuzzer [virtio-mem] Fuzzer and integ tests fixes Nov 20, 2025
Copy link
Contributor

@bchalios bchalios left a comment

Choose a reason for hiding this comment

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

Generally LGTM.

However, it's very annoying that we need to change a type because fuzzer isn't able to create a valid object. Isn't there a way we could skip fuzzer runs that create invalid BitVec objects?

@Manciukic Manciukic merged commit c37849c into firecracker-microvm:feature/virtio-mem Nov 21, 2025
6 of 7 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

3 participants