Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

microVM: write back dirty shared-mapping pages of host shares before every capture

Open
#555 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
22/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
linux

Research direction

Start with guest/common/nvx-snapshot, where the sync after the cgroup freeze runs only for paired-scratch captures, and with the virtio-fs section of doc/design/machine-and-device-abi.md plus 3.6.8 and 3.6.9 of the architecture guide. Done means every capture, including blockless and fresh-scratch ones, writes back dirty shared-mapping pages of live host shares before the boundary, with a test that dirties a shared mapping before a blockless capture and checks the restore does not write back to the host file. The design choice between agent-side syncfs and a device-side refusal needs maintainer input first.

Written by the indexing model from the issue text.

Description

Summary

A restored guest continues with captured memory, including the guest page cache. The microVM virtio-fs device grants shared mappings of direct-I/O files, which the guest kernel requests (Linux 6.6 and newer; the guest kernel is 6.18), so pages of shared memory mappings of files in a live host share are cached in guest RAM and written back to the host through ordinary write requests (section 3.6.1 of the architecture guide in #529).

Only a capture with paired scratch writes dirty pages back before the boundary: guest/common/nvx-snapshot runs sync after it freezes the workload cgroup, and only in that case. A blockless capture or a fresh-scratch capture leaves dirty shared-mapping pages in captured memory. After a restore, the guest kernel writes those pages back to the live host file, overwriting any change that the host made to the same range since the capture. Every restore of one snapshot attaches the same live host files, so every clone writes the same capture-time pages back to one host file.

The architecture guide now describes this exception in 3.6.8 and 3.6.9; this issue tracks removing the hazard.

Intended behavior

Every capture writes back the dirty pages of shared mappings on the host shares before the boundary, so a snapshot carries no unwritten file data for a live host file, and no restore writes capture-time data back to one.

Options

  • Have the guest agents write back dirty file pages before every capture that has a live host share, for example with syncfs on the host-share mounts, after they stop the workload from dirtying further pages.
  • Have the device refuse capture while the guest holds dirty shared-mapping pages of a live share; the device cannot observe them, so this needs a guest-side check.

Tasks

  • Write back dirty shared-mapping pages of the host shares before every capture, not only paired-scratch captures, and define how a workload is kept from dirtying pages between the write-back and the boundary when it is not frozen.
  • Add coverage: a workload that dirties a shared mapping of a live share before a blockless capture, and a restore that must not write capture-time data back to the host file.
  • Update the capture and restore parts of the virtio-fs section of doc/design/machine-and-device-abi.md, and 3.6.8 and 3.6.9 of the architecture guide.
Dominant language
Python
Stars
380
Forks
24
Avg merge
12h 3m
Merged PRs (30d)
292

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from microsoft/nvx

All issues in microsoft/nvx

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.