11154 Commits

Author SHA1 Message Date
dependabot[bot]
383773a03d build(deps): bump hadolint/hadolint-action from 3.3.0 to 3.4.0
Bumps [hadolint/hadolint-action](https://github.com/hadolint/hadolint-action) from 3.3.0 to 3.4.0.
- [Release notes](https://github.com/hadolint/hadolint-action/releases)
- [Commits](2332a7b74a...2a66e89f53)

---
updated-dependencies:
- dependency-name: hadolint/hadolint-action
  dependency-version: 3.4.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-08-05 00:44:34 +00:00
Alyssa Ross
98b1d50a0b vmm: add missing syscalls for musl TCP migration
musl uses these as part of its getaddrinfo implementation, which is
called by TcpStream::connect.

Signed-off-by: Alyssa Ross <hi@alyssa.is>
2026-08-04 21:22:00 +00:00
Alyssa Ross
e8a3e4f046 seccomp: allow pwritev2
Since the latest release, musl preferentially uses this syscall in its
pwrite and pwritev implementations.

Signed-off-by: Alyssa Ross <hi@alyssa.is>
2026-08-04 21:21:31 +00:00
leo03164
ae04fa80b2 openapi: Add missing id property to GenericVhostUserConfig
GenericVhostUserConfig flattens PciDeviceCommonConfig, so the wire
format accepts an optional id like the other PCI device configs.
FsConfig, which flattens the same struct, already documents id.
Add it here as well so generated clients can name the device and
later target it with /vm.remove-device.

Signed-off-by: leo03164 <leo03164@gmail.com>
2026-08-04 08:58:57 +00:00
leo03164
d0bc9d6907 openapi: Fix generic_vhost_user property name in VmConfig
The field is declared as generic_vhost_user in vmm/src/vm_config.rs
without a serde rename, so the wire format uses the underscore form.
The OpenAPI document names the property generic-vhost-user, which is
also the only hyphenated key in the VmConfig schema.

VmConfig deserialization does not reject unknown fields, so a client
generated from the document sends a key that serde silently ignores:
the devices are dropped on vm.create without any error.

Signed-off-by: leo03164 <leo03164@gmail.com>
2026-08-04 08:58:57 +00:00
Muminul Islam
4f6146dce2 ci: increase timeout for MSHV
Increase timeout for MSHV integration tests as enabling
live_migration/upgrade tests asks for more time to finish.

Signed-off-by: Muminul Islam <muislam@microsoft.com>
2026-08-04 08:58:49 +00:00
leo03164
6fd98728d4 openapi: Add missing BreakPoint variant to VmState
The VmState enum in vmm/src/vm.rs has five variants (Created,
Running, Shutdown, Paused, BreakPoint) but the OpenAPI document
only lists four. BreakPoint is observable through vm.info when a
guest_debug build is paused by the GDB stub (Vm::debug_pause).

Clients generated with strict enum handling (e.g. via
openapi-generator) fail to deserialize the vm.info response in
that state. The document already covers guest_debug-gated surface
such as /vm.coredump, so the enum should be complete as well.

Signed-off-by: leo03164 <leo03164@gmail.com>
2026-08-04 08:56:05 +00:00
dependabot[bot]
e54913da0b build(deps): bump docker/login-action from 4.5.2 to 4.6.0
Bumps [docker/login-action](https://github.com/docker/login-action) from 4.5.2 to 4.6.0.
- [Release notes](https://github.com/docker/login-action/releases)
- [Commits](https://github.com/docker/login-action/compare/v4.5.2...v4.6.0)

---
updated-dependencies:
- dependency-name: docker/login-action
  dependency-version: 4.6.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-08-04 00:42:42 +00:00
Sumedh Alok Sharma
aa9678da67 docs: Describe VMDK extent path handling under landlock
With landlock enabled, the vmdk disk path representing the
descriptor file is added to allowed path. However, this is a
plain text file which points to actual data blobs called extents.
The extent paths are not allowed and must be explicitly passed via
landlock-rules path.

Signed-off-by: Sumedh Alok Sharma <sumsharma@microsoft.com>
2026-08-03 20:26:32 +00:00
Sumedh Alok Sharma
d69fb67f5b block: Add integration tests
Adds integration tests for vmdk to cover i/o scenarios
for single extent & multi-extent span read writes. All tests
run disk consistency check in the end. The tests also extend
direct_io for VMDK backend.

Signed-off-by: Sumedh Alok Sharma <sumsharma@microsoft.com>
2026-08-03 20:26:32 +00:00
Sumedh Alok Sharma
82b65c3352 block: Detect and open flat VMDK images
Adds support to detect and open flat vmdk images.
In particular, it updates the `detect_image_type` method to
account for unaligned & small sized descriptor file (which describes
the VMDK disk) reads using AlignedFile::read_at instead of
read_file_at to loop over for small reads.

Signed-off-by: Sumedh Alok Sharma <sumsharma@microsoft.com>
2026-08-03 20:26:32 +00:00
Sumedh Alok Sharma
e6fd5fefc4 block: Implement synchronous I/O engine for Flat VMDK
Implements synchronous I/O engine for flat VMDK backend.
It uses an extent aware worker to map each request
to one or more backing extents. The implementation supports extents
opened with O_DIRECT using AlignedFile.

Async backends of io_uring and AIO are unimplemented because
requests spanning extents cannot be submitted with one fd + offset.

Signed-off-by: Sumedh Alok Sharma <sumsharma@microsoft.com>
2026-08-03 20:26:32 +00:00
Sumedh Alok Sharma
0769215d42 block: Add flat VMDK extent layout
Defines and implements the layout of a VMDK extent, the region
of storage that is used by the virtual disk. Each line in the
descriptor file's extent section describes one extent.

Signed-off-by: Sumedh Alok Sharma <sumsharma@microsoft.com>
2026-08-03 20:26:32 +00:00
Sumedh Alok Sharma
7b24354020 block: Add VMDK descriptor file parser for Flat createType
Adds parser for the Virtual Machine DisK descriptor
file. The parser supports 2 flat/pre-allocated create types,
monolithicFlat & twoGbMaxExtentFlat. The parser marks any other
type as unsupported.

The implementation references VMDK descriptor specification from
https://web.archive.org/web/20240527050638if_/https://www.vmware.com/app/vmdk/?src=vmdk

Signed-off-by: Sumedh Alok Sharma <sumsharma@microsoft.com>
2026-08-03 20:26:32 +00:00
Stepan Rabotkin
dcea656a72 vmm: api: Map config-validation errors to 400/409 (not 500)
Map VmError::ConfigValidation in api_error_status_code() to client-error
codes: 409 Conflict for a duplicate identifier or path, 400 Bad Request
otherwise. Update the OpenAPI responses for the vm.add-* and vm.restore
endpoints, fix the InvalidIdentifier message, and add unit tests.

Signed-off-by: Stepan Rabotkin <epicstyt@gmail.com>
Assisted-by: Claude:Opus-4.8
2026-07-31 12:55:30 +00:00
dependabot[bot]
bff57a8471 build(deps): bump the non-rust-vmm group across 2 directories with 17 updates
Bumps the non-rust-vmm group with 11 updates in the / directory:

| Package | From | To |
| --- | --- | --- |
| [base64](https://github.com/marshallpierce/rust-base64) | `0.22.1` | `0.23.0` |
| [jiff](https://github.com/BurntSushi/jiff) | `0.2.34` | `0.2.35` |
| [zbus](https://github.com/z-galaxy/zbus) | `5.17.0` | `5.18.0` |
| [landlock](https://github.com/landlock-lsm/rust-landlock) | `0.4.5` | `0.4.7` |
| [cc](https://github.com/rust-lang/cc-rs) | `1.2.67` | `1.3.0` |
| [event-listener](https://github.com/smol-rs/event-listener) | `5.4.1` | `5.4.2` |
| [fastrand](https://github.com/smol-rs/fastrand) | `2.4.1` | `2.5.0` |
| [glob](https://github.com/rust-lang/glob) | `0.3.3` | `0.3.4` |
| [portable-atomic](https://github.com/taiki-e/portable-atomic) | `1.13.1` | `1.14.0` |
| [rustls-pki-types](https://github.com/rustls/pki-types) | `1.15.0` | `1.15.1` |
| [toml_parser](https://github.com/toml-rs/toml) | `1.1.2+spec-1.1.0` | `1.1.3+spec-1.1.0` |

Bumps the non-rust-vmm group with 8 updates in the /fuzz directory:

| Package | From | To |
| --- | --- | --- |
| [base64](https://github.com/marshallpierce/rust-base64) | `0.22.1` | `0.23.0` |
| [libc](https://github.com/rust-lang/libc) | `0.2.187` | `0.2.189` |
| [getrandom](https://github.com/rust-random/getrandom) | `0.4.2` | `0.4.3` |
| [landlock](https://github.com/landlock-lsm/rust-landlock) | `0.4.5` | `0.4.7` |
| [cc](https://github.com/rust-lang/cc-rs) | `1.2.67` | `1.3.0` |
| [fastrand](https://github.com/smol-rs/fastrand) | `2.4.1` | `2.5.0` |
| [rustls-pki-types](https://github.com/rustls/pki-types) | `1.15.0` | `1.15.1` |
| [toml_parser](https://github.com/toml-rs/toml) | `1.1.2+spec-1.1.0` | `1.1.3+spec-1.1.0` |



Updates `base64` from 0.22.1 to 0.23.0
- [Changelog](https://github.com/marshallpierce/rust-base64/blob/master/RELEASE-NOTES.md)
- [Commits](https://github.com/marshallpierce/rust-base64/compare/v0.22.1...v0.23.0)

Updates `jiff` from 0.2.34 to 0.2.35
- [Release notes](https://github.com/BurntSushi/jiff/releases)
- [Changelog](https://github.com/BurntSushi/jiff/blob/master/CHANGELOG.md)
- [Commits](https://github.com/BurntSushi/jiff/compare/jiff-static-0.2.34...jiff-static-0.2.35)

Updates `zbus` from 5.17.0 to 5.18.0
- [Release notes](https://github.com/z-galaxy/zbus/releases)
- [Changelog](https://github.com/z-galaxy/zbus/blob/main/release-plz.toml)
- [Commits](https://github.com/z-galaxy/zbus/compare/zbus-5.17.0...zbus-5.18.0)

Updates `landlock` from 0.4.5 to 0.4.7
- [Release notes](https://github.com/landlock-lsm/rust-landlock/releases)
- [Changelog](https://github.com/landlock-lsm/rust-landlock/blob/main/CHANGELOG.md)
- [Commits](https://github.com/landlock-lsm/rust-landlock/compare/v0.4.5...v0.4.7)

Updates `cc` from 1.2.67 to 1.3.0
- [Release notes](https://github.com/rust-lang/cc-rs/releases)
- [Changelog](https://github.com/rust-lang/cc-rs/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/cc-rs/compare/cc-v1.2.67...cc-v1.3.0)

Updates `event-listener` from 5.4.1 to 5.4.2
- [Release notes](https://github.com/smol-rs/event-listener/releases)
- [Changelog](https://github.com/smol-rs/event-listener/blob/master/CHANGELOG.md)
- [Commits](https://github.com/smol-rs/event-listener/compare/v5.4.1...v5.4.2)

Updates `fastrand` from 2.4.1 to 2.5.0
- [Release notes](https://github.com/smol-rs/fastrand/releases)
- [Changelog](https://github.com/smol-rs/fastrand/blob/master/CHANGELOG.md)
- [Commits](https://github.com/smol-rs/fastrand/compare/v2.4.1...v2.5.0)

Updates `glob` from 0.3.3 to 0.3.4
- [Release notes](https://github.com/rust-lang/glob/releases)
- [Changelog](https://github.com/rust-lang/glob/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/glob/compare/v0.3.3...v0.3.4)

Updates `jiff-static` from 0.2.34 to 0.2.35
- [Release notes](https://github.com/BurntSushi/jiff/releases)
- [Changelog](https://github.com/BurntSushi/jiff/blob/master/CHANGELOG.md)
- [Commits](https://github.com/BurntSushi/jiff/compare/jiff-static-0.2.34...jiff-static-0.2.35)

Updates `portable-atomic` from 1.13.1 to 1.14.0
- [Release notes](https://github.com/taiki-e/portable-atomic/releases)
- [Changelog](https://github.com/taiki-e/portable-atomic/blob/main/CHANGELOG.md)
- [Commits](https://github.com/taiki-e/portable-atomic/compare/v1.13.1...v1.14.0)

Updates `rustls-pki-types` from 1.15.0 to 1.15.1
- [Release notes](https://github.com/rustls/pki-types/releases)
- [Commits](https://github.com/rustls/pki-types/compare/v/1.15.0...v/1.15.1)

Updates `toml_parser` from 1.1.2+spec-1.1.0 to 1.1.3+spec-1.1.0
- [Commits](https://github.com/toml-rs/toml/compare/toml_parser-v1.1.2...toml_parser-v1.1.3)

Updates `zbus_macros` from 5.17.0 to 5.18.0
- [Release notes](https://github.com/z-galaxy/zbus/releases)
- [Changelog](https://github.com/z-galaxy/zbus/blob/main/release-plz.toml)
- [Commits](https://github.com/z-galaxy/zbus/compare/zbus_macros-5.17.0...zbus_macros-5.18.0)

Updates `base64` from 0.22.1 to 0.23.0
- [Changelog](https://github.com/marshallpierce/rust-base64/blob/master/RELEASE-NOTES.md)
- [Commits](https://github.com/marshallpierce/rust-base64/compare/v0.22.1...v0.23.0)

Updates `libc` from 0.2.187 to 0.2.189
- [Release notes](https://github.com/rust-lang/libc/releases)
- [Changelog](https://github.com/rust-lang/libc/blob/0.2.189/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/libc/compare/0.2.187...0.2.189)

Updates `getrandom` from 0.4.2 to 0.4.3
- [Changelog](https://github.com/rust-random/getrandom/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-random/getrandom/compare/v0.4.2...v0.4.3)

Updates `landlock` from 0.4.5 to 0.4.7
- [Release notes](https://github.com/landlock-lsm/rust-landlock/releases)
- [Changelog](https://github.com/landlock-lsm/rust-landlock/blob/main/CHANGELOG.md)
- [Commits](https://github.com/landlock-lsm/rust-landlock/compare/v0.4.5...v0.4.7)

Updates `cc` from 1.2.67 to 1.3.0
- [Release notes](https://github.com/rust-lang/cc-rs/releases)
- [Changelog](https://github.com/rust-lang/cc-rs/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/cc-rs/compare/cc-v1.2.67...cc-v1.3.0)

Updates `fastrand` from 2.4.1 to 2.5.0
- [Release notes](https://github.com/smol-rs/fastrand/releases)
- [Changelog](https://github.com/smol-rs/fastrand/blob/master/CHANGELOG.md)
- [Commits](https://github.com/smol-rs/fastrand/compare/v2.4.1...v2.5.0)

Updates `hashbrown` from 0.15.5 to 0.17.0
- [Release notes](https://github.com/rust-lang/hashbrown/releases)
- [Changelog](https://github.com/rust-lang/hashbrown/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/hashbrown/compare/v0.15.5...v0.17.0)

Updates `r-efi` from 5.3.0 to 6.0.0
- [Release notes](https://github.com/r-efi/r-efi/releases)
- [Changelog](https://github.com/r-efi/r-efi/blob/main/NEWS.md)
- [Commits](https://github.com/r-efi/r-efi/compare/v5.3.0...v6.0.0)

Updates `rustls-pki-types` from 1.15.0 to 1.15.1
- [Release notes](https://github.com/rustls/pki-types/releases)
- [Commits](https://github.com/rustls/pki-types/compare/v/1.15.0...v/1.15.1)

Updates `toml_parser` from 1.1.2+spec-1.1.0 to 1.1.3+spec-1.1.0
- [Commits](https://github.com/toml-rs/toml/compare/toml_parser-v1.1.2...toml_parser-v1.1.3)

---
updated-dependencies:
- dependency-name: base64
  dependency-version: 0.23.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: non-rust-vmm
- dependency-name: jiff
  dependency-version: 0.2.35
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: non-rust-vmm
- dependency-name: zbus
  dependency-version: 5.18.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: non-rust-vmm
- dependency-name: landlock
  dependency-version: 0.4.7
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: non-rust-vmm
- dependency-name: cc
  dependency-version: 1.3.0
  dependency-type: indirect
  update-type: version-update:semver-minor
  dependency-group: non-rust-vmm
- dependency-name: event-listener
  dependency-version: 5.4.2
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: non-rust-vmm
- dependency-name: fastrand
  dependency-version: 2.5.0
  dependency-type: indirect
  update-type: version-update:semver-minor
  dependency-group: non-rust-vmm
- dependency-name: glob
  dependency-version: 0.3.4
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: non-rust-vmm
- dependency-name: jiff-static
  dependency-version: 0.2.35
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: non-rust-vmm
- dependency-name: portable-atomic
  dependency-version: 1.14.0
  dependency-type: indirect
  update-type: version-update:semver-minor
  dependency-group: non-rust-vmm
- dependency-name: rustls-pki-types
  dependency-version: 1.15.1
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: non-rust-vmm
- dependency-name: toml_parser
  dependency-version: 1.1.3+spec-1.1.0
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: non-rust-vmm
- dependency-name: zbus_macros
  dependency-version: 5.18.0
  dependency-type: indirect
  update-type: version-update:semver-minor
  dependency-group: non-rust-vmm
- dependency-name: base64
  dependency-version: 0.23.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: non-rust-vmm
- dependency-name: libc
  dependency-version: 0.2.189
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: non-rust-vmm
- dependency-name: getrandom
  dependency-version: 0.4.3
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: non-rust-vmm
- dependency-name: landlock
  dependency-version: 0.4.7
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: non-rust-vmm
- dependency-name: cc
  dependency-version: 1.3.0
  dependency-type: indirect
  update-type: version-update:semver-minor
  dependency-group: non-rust-vmm
- dependency-name: fastrand
  dependency-version: 2.5.0
  dependency-type: indirect
  update-type: version-update:semver-minor
  dependency-group: non-rust-vmm
- dependency-name: hashbrown
  dependency-version: 0.17.0
  dependency-type: indirect
  update-type: version-update:semver-minor
  dependency-group: non-rust-vmm
- dependency-name: r-efi
  dependency-version: 6.0.0
  dependency-type: indirect
  update-type: version-update:semver-major
  dependency-group: non-rust-vmm
- dependency-name: rustls-pki-types
  dependency-version: 1.15.1
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: non-rust-vmm
- dependency-name: toml_parser
  dependency-version: 1.1.3+spec-1.1.0
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: non-rust-vmm
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-07-31 00:58:50 +00:00
dependabot[bot]
c70d5d56f0 build(deps): bump the rust-vmm group across 2 directories with 1 update
Bumps the rust-vmm group with 1 update in the / directory: [micro_http](https://github.com/firecracker-microvm/micro-http).
Bumps the rust-vmm group with 1 update in the /fuzz directory: [micro_http](https://github.com/firecracker-microvm/micro-http).


Updates `micro_http` from `876f3fe` to `f2d9170`
- [Commits](876f3feccc...f2d91703a1)

Updates `micro_http` from `876f3fe` to `f2d9170`
- [Commits](876f3feccc...f2d91703a1)

---
updated-dependencies:
- dependency-name: micro_http
  dependency-version: f2d91703a103521430209f48ddf5925be1e35ff8
  dependency-type: direct:production
  dependency-group: rust-vmm
- dependency-name: micro_http
  dependency-version: f2d91703a103521430209f48ddf5925be1e35ff8
  dependency-type: direct:production
  dependency-group: rust-vmm
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-07-31 00:50:31 +00:00
dependabot[bot]
4dd5ae0e33 build(deps): bump docker/login-action from 4 to 4.5.2
Bumps [docker/login-action](https://github.com/docker/login-action) from 4 to 4.5.2.
- [Release notes](https://github.com/docker/login-action/releases)
- [Commits](https://github.com/docker/login-action/compare/v4...v4.5.2)

---
updated-dependencies:
- dependency-name: docker/login-action
  dependency-version: 4.5.2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-07-31 00:43:59 +00:00
Oliver Anderson
579f0c11a1 arch: Add compatibility check for CPUID.0x7.0x2:EDX
Register EDX of CPUID leaf 0x7 sub-leaf 0x2 (Structured Extended Feature
Enumeration Sub-leaf) is currently not checked, but it should be.

KVM supports several of the features enumerated by this value when they
are supported by the host such as Intel PSFD, IPRED_CTRL, RRSBA_CTRL
and more.

The migration destination needs to support any such feature exposed to
the guest from the migration source.

Signed-off-by: Oliver Anderson <oliver.anderson@cyberus-technology.de>
On-behalf-of: SAP oliver.anderson@sap.com
2026-07-30 12:35:17 +00:00
Oliver Anderson
193e99c23a arch: Add compatibility check for CPUID.0x7.0x1:EDX
Register EDX of CPUID leaf 0x7 sub-leaf 0x1 (Structured Extended Feature
Enumeration Sub-leaf) is currently not checked, but it should be.

KVM supports several of the features enumerated by this value when they
are supported by the host, such as AVX-VNNI-INT8, AMX-COMPLEX, AVX10
and more.

The migration destination needs to support any such feature exposed to
the guest from the migration source.

Signed-off-by: Oliver Anderson <oliver.anderson@cyberus-technology.de>
On-behalf-of: SAP oliver.anderson@sap.com
2026-07-30 12:35:17 +00:00
Oliver Anderson
c22b42d2de arch: Add compatibility check for CPUID.0x7.0x1:ECX
Register ECX of CPUID leaf 0x7 sub-leaf 0x1 (Structured Extended Feature
Enumeration Sub-leaf) is currently not checked, but it should be.

KVM exposes bit 5 (MSR_IMM: the immediate forms of the RDMSR and WRMSR
instructions) when the host does.

Live migrating from a source that supports MSR_IMM to a destination
that does not is not safe.

Signed-off-by: Oliver Anderson <oliver.anderson@cyberus-technology.de>
On-behalf-of: SAP oliver.anderson@sap.com
2026-07-30 12:35:17 +00:00
Julian Schindel
fa74e7a843 vmm: detect dead connections during live migration
During a live migration, connections may get interrupted silently,
without being reset or closed. Interrupted idle connections may stay
alive indefinitely, for example if a connection dies during prefaulting
on the receiver side.

To detect dead idle connections, we enable
`SO_KEEPALIVE`. With `SO_KEEPALIVE`, the kernel will send keepalive
probes if a connection is idle and close the connection if the probes
remain unacknowledged.

To detect dead connections when actively sending data in a timely
manner, we enable `TCP_USER_TIMEOUT`, to reduce the timeout for closing
a connection where the peer doesn't acknowledge sent data.

On-behalf-of: SAP julian.schindel@sap.com
Signed-off-by: Julian Schindel <julian.schindel@cyberus-technology.de>
2026-07-30 10:33:52 +00:00
Anatol Belski
27e8e66e2e block: qcow: Share the synchronous read path between the two engines
Both engines walked the same cluster mappings to serve a read from
allocated clusters, the backing file, or zero fill. In the uring
engine this walk was a separate helper, scatter_read_sync, reached
only when the read was not a single contiguous allocated extent. In
the sync engine the same loop sat directly in the read path. Move
scatter_read_sync into common.rs and call it from both. The uring
contiguous fast path stays in resolve_read, so those reads still
offload to the ring.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-07-30 09:08:35 +00:00
Anatol Belski
25b270010f block: qcow: Share the synchronous write path between the two engines
Both engines ran the same copy on write loop for a partial cluster
write. In the uring engine it was a separate helper, cow_write_sync.
In the sync engine the same loop sat directly in the write path. Move
cow_write_sync into common.rs and call it from both. The uring write
already runs synchronously, so its behavior does not change.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-07-30 09:08:35 +00:00
Anatol Belski
eeb71091db block: qcow: Share the deallocation path between the two engines
The sync and uring qcow engines each carried an identical
apply_dealloc_action plus punch_hole and write_zeroes bodies that
differed only by a flag and the completion sink. Move that shared
deallocation logic into common.rs as apply_dealloc_action and
deallocate_range_result. Each engine now calls it and injects the
completion through its own queue.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-07-30 09:08:35 +00:00
Anatol Belski
9ea9019d29 docs: Expand KDNET guide with NAT routing and SAC setup
Add a NAT variant for debuggers on a different subnet or reached only
through the host uplink. Source NAT suffices because KDNET is target
initiated, so replies return along the conntrack entry with no inbound
port forward.

Note that KDNET needs a routable tap address from DHCP or a static SAC
assignment, add SAC steps to enable it on a headless guest, and move
busparams pinning into an optional section.

Assisted-by: Claude:Opus-4.8
Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-07-29 17:26:06 +00:00
Anatol Belski
bbdec8fbd6 performance-metrics: Report restore child exit status on failure
When the restore event is missing, the restore latency test panics with
a generic RestoreTimeParse error that gives no clue about the cause.

Include the exit status of the restore child in the diagnostic. Status 1
means Cloud Hypervisor aborted the restore, while SIGKILL means the test
killed a still running child at its timeout.

Assisted-by: Claude:Opus-4.8
Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-07-29 15:45:08 +00:00
Rob Bradford
7c5b66b2c0 vmm: device_manager: Disallow removal of iommu attached devices
If a device is attached to the iommu individually (not behind an iommu
backed segment) then we shouldn't allow its removal as the static VIOT
ACPI table establishes which devices (or whole segments) are behind the
IOMMU. After a removal that would be incorrect.

An alternative that was considered was to "block" the BDF from being
used for another PCI device that was hotplugged unless it was also IOMMU
attached that however feels unncessary complex when the primary purpose
of the vIOMMU backing is for nested device testing.

Signed-off-by: Rob Bradford <rbradford@meta.com>
2026-07-29 14:58:08 +00:00
Julian Schindel
ee6cafdcdd vmm: clean up migration threads on failure
Migration threads may be left orphaned and keep the socket bound after
a migration has failed. Prevent this by signaling termination via the
`kill_evt` in `ReceiveAdditionalConnections`'s `Drop` impl.

On-behalf-of: SAP julian.schindel@sap.com
Signed-off-by: Julian Schindel <julian.schindel@cyberus-technology.de>
2026-07-29 14:40:21 +00:00
Julian Schindel
11eace2660 vmm: rename terminate_fd to kill_evt for consistency
On-behalf-of: SAP julian.schindel@sap.com
Signed-off-by: Julian Schindel <julian.schindel@cyberus-technology.de>
2026-07-29 14:40:21 +00:00
Rob Bradford
2ec52debc8 vmm: Apply huge page checks to zone config
Replicate the checks that are made against the top level MemoryConfig
into those for the per-zone configuration.

Signed-off-by: Rob Bradford <rbradford@meta.com>
2026-07-29 14:39:46 +00:00
Julian Schindel
ec68508a2a vm-migration, vmm: Remove unsafe code when setting socket options
The introduced `TcpStream` accessor allows setting socket options on the
`TcpStream` without going through the file descriptor and unsafe
methods.

On-behalf-of: SAP julian.schindel@sap.com
Signed-off-by: Julian Schindel <julian.schindel@cyberus-technology.de>
2026-07-29 11:46:46 +00:00
Rob Bradford
53ee9ebb77 block: qcow: Only clear DIRTY bit when last QcowDisk destroyed
Multiple QcowDisk/Qcow2Backing can share references to the same
QcowMetadata via an Arc. Unfortunately the .shutdown() which clears the
DIRTY bit was being called when the first of those was dropped. Instead
move this to the drop of the metadata itself. Now only once all
references to the metadata are dropped then we can safely set the DIRTY
bit.

Assisted-by: Codex:GPT-5.6
Signed-off-by: Rob Bradford <rbradford@meta.com>
2026-07-29 10:25:58 +00:00
Rob Bradford
8268a4fd5b devices: ivshmem: Don't remap file on BAR reprogramming
The ivshmem device was remapping the host file every time the BAR was
reprogrammed. This occurs on the vCPU thread and so was falling foul of
our improved seccomp filters. Avoid this by maintaining the existing
region when the device BARs are changed and just adjust the guest GPA.

Assisted-by: Codex:GPT-5.6
Signed-off-by: Rob Bradford <rbradford@meta.com>
2026-07-29 10:25:42 +00:00
Rob Bradford
660b18eaac vmm: Clean up seccomp handling for glibc overcommit sysctl
Unfortunately glibc can read the overcommit sysctl from any thread. This
has lead to us adding a patchwork of openat/read syscalls to our allow
list when those threads don't necessarily need openat for their actual
uses.

Only the VMM and migration worker thread have a strict requirement for
the openat syscall. The syscall was added to the other threads to deal
with this glibc behaviour.

As read() is itself harmless move it to the common syscalls, strip
full openat() from all but the threads that need it and add limited,
read only, openat to all threads.

Signed-off-by: Rob Bradford <rbradford@meta.com>
2026-07-29 10:25:42 +00:00
Rob Bradford
9b7ca3be18 tests: Disable flaky test_live_migration_tcp_timeout_cancel()
This test flakes out regularly and never succeeds on retry (as it is
more likely to fail under the reduced load of the retry)

See: #8651

Signed-off-by: Rob Bradford <rbradford@meta.com>
2026-07-29 11:25:25 +01:00
Oliver Anderson
d57c996485 vmm: Set vCPU MSR config updates when creating vCPUs
Vcpus need to be configured according to the selected CPU profile.
We thus store the computed vCPU MSR config update in the CPU manager
and use it whenever a vCPU is created.

Signed-off-by: Oliver Anderson <oliver.anderson@cyberus-technology.de>
On-behalf-of: SAP oliver.anderson@sap.com
2026-07-28 10:55:18 +00:00
Oliver Anderson
6d9dd42abb arch: Generate required_msr_updates function
We introduce a function somewhat analogous to `generate_common_cpuid`,
except that it is only relevant for CPU profiles.

This function is more "high level" than the
CpuProfile::required_msr_updates method and is intended to be called
from the vmm crate.

Signed-off-by: Oliver Anderson <oliver.anderson@cyberus-technology.de>
On-behalf-of: SAP oliver.anderson@sap.com
2026-07-28 10:55:18 +00:00
Oliver Anderson
faa94bddec arch: Introduce IA32_ARCH_CAPABILITIES compatibility checks
In order to safely apply CPU profiles we need to ensure that the host's
feature MSRs that are permitted by the CPU profile are also compatible
with the values the CPU profile dictates.

KVM_SET_MSRs takes care of checking compatibility for most feature MSRs
on both Intel and AMD CPUs that we will permit CPU profiles to have
(more on this in the upcoming CPU profile generation tool PRs),
but there is one exception.

Userspace may set whatever value for the Intel exclusive
IA32_ARCH_CAPABILITIES MSR without receiving any complaints from KVM.

We thus introduce our own compatibility check for
IA32_ARCH_CAPABILITIES.

One might even argue that KVM_SET_MSRs is called relatively late when
creating or receiving a VM and that it would be preferable to have
compatibility checks for all permitted feature MSRs run earlier. This
would also mean more informative debug logs.

We argue however that those additional checks would lead to too much
code that is not strictly necessary which is why we decided against
doing that in this patch set.

The code introduced here is only intended to be used with CPU profiles
at this point in time, but it is written in such a way that it could
also be used for MSR compatibility checks between a migration source
and destination (when the Host profile is in use) should that be
desired in the future.

Signed-off-by: Oliver Anderson <oliver.anderson@cyberus-technology.de>
On-behalf-of: SAP oliver.anderson@sap.com
2026-07-28 10:55:18 +00:00
Oliver Anderson
39ee018b60 arch: Required MSR updates method on CpuProfile
We introduce a method on the CpuProfile enum that computes the required
MSR related updates in order to be compatible with the CPU profile.

The output of this function describes the feature MSRs that need to be
set and the snapshottable MSRs that are compatible with the chosen CPU
profile. The former provides the guest information about CPU features
(that are not obtainable from inspecting CPUID) while the latter is
used to ensure that MSRs that are incompatible with the CPU profile
are not set upon snapshot/restore.

These will be utilized in the vmm crate in a follow up commit.

We expect the hypervisor to take care of checking compatibility of the
feature MSRs when they are set. IA32_ARCH_CAPABILITIES is a known
exception however which we introduce our own checks for in a follow
up commit.

Signed-off-by: Oliver Anderson <oliver.anderson@cyberus-technology.de>
On-behalf-of: SAP oliver.anderson@sap.com
2026-07-28 10:55:18 +00:00
Oliver Anderson
96d79fec74 arch: Add a list of Hyper-V MSRs
When Cloud hypervisor has not been configured for (KVM) Hyper-V we want
to adapt the CPU profiles not to require existence of Hyper-V related
MSRs.

The first step introduced here is to create a list of such MSRs.

Signed-off-by: Oliver Anderson <oliver.anderson@cyberus-technology.de>
On-behalf-of: SAP oliver.anderson@sap.com
2026-07-28 10:55:18 +00:00
Oliver Anderson
67c758b1ac arch: Introduce MSR CPU profile data
We introduce a type describing MSR adjustments associated with a
CPU profile.

The upcoming CPU profile generation tool will serialize instances of
this struct when generating a CPU profile.

A follow up PR will take care of filling out the currently stubbed
`msr_data` method.

Signed-off-by: Oliver Anderson <oliver.anderson@cyberus-technology.de>
On-behalf-of: SAP oliver.anderson@sap.com
2026-07-28 10:55:18 +00:00
Oliver Anderson
26305445b6 arch: FeatureMsrAdjustment type
We introduce a type analogous to CpuidOutputRegisterAdjustment, but for
feature MSRs.

Signed-off-by: Oliver Anderson <oliver.anderson@cyberus-technology.de>
On-behalf-of: SAP oliver.anderson@sap.com
2026-07-28 10:55:18 +00:00
Oliver Anderson
37aa545c2a arch: Wrapper type for (de-)serializing MSR register addresses
CPU Profiles will be serialized to JSON by the upcoming CPU Profile
generation tool and we want MSRs to be serialized as hex strings.

Signed-off-by: Oliver Anderson <oliver.anderson@cyberus-technology.de>
On-behalf-of: SAP oliver.anderson@sap.com
2026-07-28 10:55:18 +00:00
Oliver Anderson
838d01b0bc arch: Helper functions for 64-bit hex (de-)serialization
We create 64-bit analogues of the already existing hex (de-)serializer
helper functions for the 32-bit case.

These are necessary because the CPU profile needs associated data
describing how to adjust feature MSRs whose values are 64-bits.

In this case we prefer some small amount of code duplication over
macros and/or traits since we do not expect the need for further
variants of these helpers.

Signed-off-by: Oliver Anderson <oliver.anderson@cyberus-technology.de>
On-behalf-of: SAP oliver.anderson@sap.com
2026-07-28 10:55:18 +00:00
Oliver Anderson
2eb64a2b4f hypervisor: Ensure required feature MSRs are successfully restored
Feature MSRs must have consistent values across snapshot and restore,
otherwise we risk subtle time of check to time of use errors.

We thus adapt `Vcpu::set_state` to return a hard error if any feature
MSR cannot be restored.

It is enough to check that each MSR failing to be set does not have
an address corresponding to any of the feature MSRs stored in the
`KvmVcpu`. This is because the `msrs` in the `VcpuKvmState` contain all
the feature MSRs required by the selected CPU profile by construction.

Signed-off-by: Oliver Anderson <oliver.anderson@cyberus-technology.de>
On-behalf-of: SAP oliver.anderson@sap.com
2026-07-28 10:55:18 +00:00
Oliver Anderson
30063eff7e hypervisor: Include feature MSRs in boot_msr_entries
Whenever a CPU profile is selected there will be feature MSRs that need
to be set when the CPU is configured.

We thus adapt the boot_msr_entries method to include the feature MSRs
that are passed to the vCPU upon construction.

Since KVM applies compatibility checks for all feature MSRs (except
IA32_ARCH_CAPABILITIES) we can only proceed if all MSR boot entries
are successfully set upon vCPU configuration.

This new check also applies to the regular boot entries when the host
profile is selected (the default), but that is arguably an improvement
in terms of correctness.

Signed-off-by: Oliver Anderson <oliver.anderson@cyberus-technology.de>
On-behalf-of: SAP oliver.anderson@sap.com
2026-07-28 10:55:18 +00:00
Oliver Anderson
d2d13beb28 hypervisor: hypervisor_type method on Vcpu trait
Although it is already possible to obtain the hypervisor type from the
hypervisor trait object, there is currently no way for functions that
only have a vCPU object to work with to know what the hypervisor
backend is.

In the rare case where there is significant divergence between the
supported hypervisor backends when working with vCPU objects the caller
must necessarily branch on the hypervisor type.

We thus introduce a hypervisor_type method on the Vcpu trait.

This will be utilized in a follow up commit where we need special
handling when configuring MSRs of vCPUs.

Signed-off-by: Oliver Anderson <oliver.anderson@cyberus-technology.de>
On-behalf-of: SAP oliver.anderson@sap.com
2026-07-28 10:55:18 +00:00
Oliver Anderson
6ea8e8e20e hypervisor: Optional vCPU MSR configuration update in vcpu constructor
When applying a CPU profile we need a way to change the configuration of
each vCPU to respect the requirements of the CPU profile.

This means that we need to set the feature MSRs in accordance with the
CPU profile upon configuring the vCPU and also ensuring that we do not
attempt to restore any MSRs that are not compatible with the profile
upon snapshot/restore.

The first step is to update `Vm::create_vcpu` to take an extra
parameter describing the necessary update.

In the case of KVM we modify the internal MSR state buffer when
constructing the vCPU whenever a VcpuMsrConfigUpdate is present.

The feature MSRs contained in the configuration will be treated in
follow up commits.

The changes to the vmm crate that are part of this commit are just
the minimum necessary to make the crate compile. We will update the
vmm crate to take CPU profiles into account in a follow up commit.

Signed-off-by: Oliver Anderson <oliver.anderson@cyberus-technology.de>
On-behalf-of: SAP oliver.anderson@sap.com
2026-07-28 10:55:18 +00:00
Oliver Anderson
2aff169533 hypervisor: Add get_msr_index_list method to the hypervisor trait
CPU profiles will describe a list of MSRs they require when applying
the profile we want to check that the host has all the required MSRs
otherwise we have an incompatibility issue.

In order to check which MSRs the host supports we start by exposing the
hypervisor's get_msr_index_list method.

The MSRs required by a chosen CPU profile will be checked against the
output of the get_msr_index_list and get_feature_msrs on the hypervisor
in a follow up commit.

The get_msr_index_list method does not have an obvious implementation
for MSHV, because in that case one needs to obtain MSR indices from
the VM fd, after the VM has been initialized.

Since CPU profiles are only intended for the KVM hypervisor to begin
with, we leave the MSHV implementation as unimplemented for now. A
proper solution for MSHV should rather be found if/when CPU profiles
are also desired in that context.

Signed-off-by: Oliver Anderson <oliver.anderson@cyberus-technology.de>
On-behalf-of: SAP oliver.anderson@sap.com
2026-07-28 10:55:18 +00:00