Commit Graph

9776 Commits

Author SHA1 Message Date
CMGS
e4e2a37afa block: Restrict DISCARD to explicit sparse=true
PR #7852 fixed the missing VirtioBlockConfig fields but did not
change the feature advertisement logic. The condition
`sparse || disk_image.supports_zero_flag()` causes qcow2 to
advertise DISCARD even with sparse=false, because qcow2 can
mark clusters as zero (supports_zero_flag() returns true).

Windows viostor BSODs (DRIVER_IRQL_NOT_LESS_OR_EQUAL) when
DISCARD is advertised on qcow2 backends, making sparse=off
ineffective as a workaround for qcow2 images.

Restrict DISCARD to explicit sparse=true only. WRITE_ZEROES
remains available for all sparse-capable backends.

Fixes #7849

Signed-off-by: CMGS <ilskdw@gmail.com>
2026-03-31 18:57:52 +00:00
Anatol Belski
8ca5210603 block: Reject write zeroes with unknown flags
The virtio spec v1.2 in 5.2.6.2 requires that the device
MUST return VIRTIO_BLK_S_UNSUPP for write zeroes commands
if any unknown flag is set.

Add an early check that rejects requests with reserved flag
bits set by returning VIRTIO_BLK_S_UNSUPP via the existing
ExecuteError::Unsupported variant.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-03-31 18:54:19 +00:00
Anatol Belski
af1d69a9dd block: Reject discard requests with flags set
The virtio spec v1.2 in 5.2.6.2 requires that the device
MUST return VIRTIO_BLK_S_UNSUPP for discard commands if the
unmap flag is set or if any unknown flag is set.

The discard handler was not reading the flags field at all,
silently accepting requests with arbitrary flags. Read and
validate the flags, rejecting any non-zero value with
VIRTIO_BLK_S_UNSUPP.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-03-31 13:11:15 +00:00
CMGS
ca58685f4c vmm: call notify_guest_clock_paused for Hyper-V guests
Previously, KVM_KVMCLOCK_CTRL was skipped when kvm_hyperv=on because
Windows does not use pvclock directly. However, KVM internally uses
pvclock data structures as the basis for computing the Hyper-V
Reference TSC page parameters. Not calling KVM_KVMCLOCK_CTRL means
there is no mechanism to signal time discontinuity to Windows guests
after pause/resume, contributing to multi-minute hangs.

Remove the kvm_hyperv guard so all guests receive the clock-paused
notification.

Signed-off-by: CMGS <ilskdw@gmail.com>
2026-03-31 13:09:30 +00:00
Tobias Kässer
082fdc4d07 virtio-devices: fix guest-triggerable panic via OOB queue_select
The queue_msix_vector register (offset 0x1a in virtio PCI common
config) was indexed into the msix_queues Vec using the guest-controlled
queue_select value without bounds checking. A malicious guest can set
queue_select to any u16 value via offset 0x16, then read or write
offset 0x1a to trigger an out-of-bounds panic, crashing the VMM.

Replace direct Vec indexing with .get()/.get_mut() for bounds-checked
access, returning VIRTQ_MSI_NO_VECTOR (0xFFFF) on OOB reads to match
the virtio "no vector" sentinel. Add a regression test that sets
queue_select to 0xFFFF and exercises both the read and write paths.

AI/LLM disclosure: this patch was co-authored with Claude Code.

Fixes #7917
Signed-off-by: Tobias Kässer <t.kaesser@gmail.com>
2026-03-31 12:27:29 +00:00
Souradeep Chakrabarti
7832401816 hypervisor: Add GHCB CPUID, MSR and TERM_REQ handlers
When booting an SEV-SNP guest VM using IGVM with -pvalidate_opt 1 (lazy
page acceptance), the guest kernel's #VC exception handler may issue
VMGEXIT with SVM_EXIT_CPUID (0x72) or SVM_EXIT_MSR (0x7c) exit codes
via the GHCB page protocol. The hypervisor had no handlers for these
exit codes, causing the guest's #VC handler to fail and trigger
sev_es_terminate(), which sends GHCB_MSR_TERM_REQ (0x100). The
hypervisor then panicked on the unhandled 0x100 operation.

Add the following handlers to the GHCB VMGEXIT processing:

- SVM_EXIT_CPUID (0x72): Read function/index/xcr0/xss from the GHCB
  page and return CPUID results via get_cpuid_values().
- SVM_EXIT_MSR (0x7c): Handle MSR read (RDMSR) and write (WRMSR)
  requests from the guest via the GHCB page protocol.
- GHCB_MSR_TERM_REQ (0x100): Decode reason_set and reason_val from the
  GHCB MSR and return an error instead of panicking, allowing graceful
  error propagation.

Testing:

  Reproducer (on Azure DC16as_cc_v5, /dev/mshv):

  cloud-hypervisor --cpus boot=1,nested=off --memory size=512M \
    --disk path=osdisk.img path=cloudinit \
    --net "tap=,mac=12:34:56:78:90:06,ip=192.168.6.1,mask=255.255.255.128" \
    --serial null --console pty \
    --api-socket /tmp/ch.sock \
    --igvm /igvm_files/linux-ttyS0.bin \
    --host-data <hash> --platform sev_snp=on -v

  Before fix:

    thread 'vcpu0' panicked at hypervisor/src/mshv/mod.rs:1207:30:
    Unsupported VMGEXIT operation: 100

  After fix: VM boots successfully to login prompt with no panics.
  All virtio devices (console, rng, disks) activate normally.

No regression risk for non-SEV-SNP: all new code is within the
HVMSG_X64_SEV_VMGEXIT_INTERCEPT handler which is only reached for
SEV-SNP guests.

Signed-off-by: Souradeep Chakrabarti <schakrabarti@microsoft.com>
2026-03-31 11:32:34 +00:00
CMGS
ff20f18364 vmm: restore KVM clock before resuming vCPUs
Reorder resume() to: set_clock, device_manager.resume,
cpu_manager.resume. This matches the inverse of pause()
which correctly saves the clock before pausing vCPUs.

Signed-off-by: CMGS <ilskdw@gmail.com>
2026-03-31 08:39:20 +00:00
Wei Liu
c52e151439 github: Introduce cool down periods for non-rust-vmm crates
This gives the community more time to react to possible security chain
compromises.

We have high confidence that rust-vmm crates are trusted, and the
community is fully capable of spotting any issues. There is no need to
delay that group.

Signed-off-by: Wei Liu <liuwe@microsoft.com>
2026-03-31 09:24:34 +01:00
dependabot[bot]
c943103f75 build(deps): bump the non-rust-vmm group across 2 directories with 7 updates
Bumps the non-rust-vmm group with 5 updates in the / directory:

| Package | From | To |
| --- | --- | --- |
| [uuid](https://github.com/uuid-rs/uuid) | `1.22.0` | `1.23.0` |
| [zerocopy](https://github.com/google/zerocopy) | `0.8.47` | `0.8.48` |
| [cc](https://github.com/rust-lang/cc-rs) | `1.2.57` | `1.2.58` |
| libredox | `0.1.14` | `0.1.15` |
| [simd-adler32](https://github.com/mcountryman/simd-adler32) | `0.3.8` | `0.3.9` |

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

| Package | From | To |
| --- | --- | --- |
| [uuid](https://github.com/uuid-rs/uuid) | `1.22.0` | `1.23.0` |
| [zerocopy](https://github.com/google/zerocopy) | `0.8.47` | `0.8.48` |
| [cc](https://github.com/rust-lang/cc-rs) | `1.2.57` | `1.2.58` |
| [simd-adler32](https://github.com/mcountryman/simd-adler32) | `0.3.8` | `0.3.9` |
| [winnow](https://github.com/winnow-rs/winnow) | `1.0.0` | `1.0.1` |



Updates `uuid` from 1.22.0 to 1.23.0
- [Release notes](https://github.com/uuid-rs/uuid/releases)
- [Commits](https://github.com/uuid-rs/uuid/compare/v1.22.0...v1.23.0)

Updates `zerocopy` from 0.8.47 to 0.8.48
- [Release notes](https://github.com/google/zerocopy/releases)
- [Changelog](https://github.com/google/zerocopy/blob/main/CHANGELOG.md)
- [Commits](https://github.com/google/zerocopy/compare/v0.8.47...v0.8.48)

Updates `cc` from 1.2.57 to 1.2.58
- [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.57...cc-v1.2.58)

Updates `libredox` from 0.1.14 to 0.1.15

Updates `simd-adler32` from 0.3.8 to 0.3.9
- [Changelog](https://github.com/mcountryman/simd-adler32/blob/main/CHANGELOG.md)
- [Commits](https://github.com/mcountryman/simd-adler32/commits/v0.3.9)

Updates `zerocopy-derive` from 0.8.47 to 0.8.48
- [Release notes](https://github.com/google/zerocopy/releases)
- [Changelog](https://github.com/google/zerocopy/blob/main/CHANGELOG.md)
- [Commits](https://github.com/google/zerocopy/compare/v0.8.47...v0.8.48)

Updates `uuid` from 1.22.0 to 1.23.0
- [Release notes](https://github.com/uuid-rs/uuid/releases)
- [Commits](https://github.com/uuid-rs/uuid/compare/v1.22.0...v1.23.0)

Updates `zerocopy` from 0.8.47 to 0.8.48
- [Release notes](https://github.com/google/zerocopy/releases)
- [Changelog](https://github.com/google/zerocopy/blob/main/CHANGELOG.md)
- [Commits](https://github.com/google/zerocopy/compare/v0.8.47...v0.8.48)

Updates `cc` from 1.2.57 to 1.2.58
- [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.57...cc-v1.2.58)

Updates `simd-adler32` from 0.3.8 to 0.3.9
- [Changelog](https://github.com/mcountryman/simd-adler32/blob/main/CHANGELOG.md)
- [Commits](https://github.com/mcountryman/simd-adler32/commits/v0.3.9)

Updates `winnow` from 1.0.0 to 1.0.1
- [Changelog](https://github.com/winnow-rs/winnow/blob/main/CHANGELOG.md)
- [Commits](https://github.com/winnow-rs/winnow/compare/v1.0.0...v1.0.1)

Updates `zerocopy-derive` from 0.8.47 to 0.8.48
- [Release notes](https://github.com/google/zerocopy/releases)
- [Changelog](https://github.com/google/zerocopy/blob/main/CHANGELOG.md)
- [Commits](https://github.com/google/zerocopy/compare/v0.8.47...v0.8.48)

---
updated-dependencies:
- dependency-name: uuid
  dependency-version: 1.23.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: non-rust-vmm
- dependency-name: zerocopy
  dependency-version: 0.8.48
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: non-rust-vmm
- dependency-name: cc
  dependency-version: 1.2.58
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: non-rust-vmm
- dependency-name: libredox
  dependency-version: 0.1.15
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: non-rust-vmm
- dependency-name: simd-adler32
  dependency-version: 0.3.9
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: non-rust-vmm
- dependency-name: zerocopy-derive
  dependency-version: 0.8.48
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: non-rust-vmm
- dependency-name: uuid
  dependency-version: 1.23.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: non-rust-vmm
- dependency-name: zerocopy
  dependency-version: 0.8.48
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: non-rust-vmm
- dependency-name: cc
  dependency-version: 1.2.58
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: non-rust-vmm
- dependency-name: simd-adler32
  dependency-version: 0.3.9
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: non-rust-vmm
- dependency-name: winnow
  dependency-version: 1.0.1
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: non-rust-vmm
- dependency-name: zerocopy-derive
  dependency-version: 0.8.48
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: non-rust-vmm
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-31 01:15:56 +00:00
Anatol Belski
5ca6ff869f block: vhd: Remove legacy async_io::DiskFile impl from FixedVhdDiskSync
No remaining consumers after switching to DiskBackend::Next.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-03-30 22:18:09 +00:00
Anatol Belski
c90f5a9e47 vmm: Switch fixed VHD sync to DiskBackend::Next
Wire FixedVhdDiskSync through the new composable trait system.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-03-30 22:18:09 +00:00
Anatol Belski
cc2f878094 block: vhd: impl AsyncDiskFile for FixedVhdDiskSync
Delegate try_clone() to FixedVhd::clone() and new_async_io() to
FixedVhdSync, preserving DiskFileError::NewAsyncIo.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-03-30 22:18:09 +00:00
Anatol Belski
ce1592d1df block: vhd: impl DiskFile for FixedVhdDiskSync
Marker impl bundling DiskSize and Geometry supertraits.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-03-30 22:18:09 +00:00
Anatol Belski
60af47c99b block: vhd: impl Resizable for FixedVhdDiskSync
Fixed VHD does not support resize, return UnsupportedFeature.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-03-30 22:18:09 +00:00
Anatol Belski
74b0613c04 block: vhd: impl SparseCapable for FixedVhdDiskSync
Fixed VHD does not support sparse operations.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-03-30 22:18:09 +00:00
Anatol Belski
1a56cb3d0e block: vhd: impl Geometry for FixedVhdDiskSync
Use default DiskTopology with 512byte sectors.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-03-30 22:18:09 +00:00
Anatol Belski
dfa9a25fd8 block: vhd: impl DiskFd for FixedVhdDiskSync
Delegate to FixedVhd::as_raw_fd() for the backing file descriptor.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-03-30 22:18:09 +00:00
Anatol Belski
266c5fc241 block: vhd: impl PhysicalSize for FixedVhdDiskSync
Delegate to FixedVhd::physical_size() which calls file.metadata().
Preserve the crate::Error::GetFileMetadata variant as the BlockError
source for diagnostic chain traversal.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-03-30 22:18:09 +00:00
Anatol Belski
7136744549 block: vhd: impl DiskSize for FixedVhdDiskSync
Delegate to FixedVhd::logical_size() which returns the guest
visible capacity parsed from the VHD footer at construction.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-03-30 22:18:09 +00:00
Anatol Belski
24e9049280 block: vhd: Switch FixedVhdDiskSync::new to BlockResult
Classify the io::Error as BlockErrorKind::Io with ErrorOp::Open.
Update vmm CreateFixedVhdDiskSync to take BlockError.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-03-30 22:18:09 +00:00
Anatol Belski
6e36932e90 block: vhdx: Remove legacy async_io::DiskFile impl from VhdxDiskSync
All functionality now provided by composable disk_file traits.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-03-30 22:17:01 +00:00
Anatol Belski
b703043f77 vmm: Switch VHDX to DiskBackend::Next
Wire VhdxDiskSync through DiskBackend::Next instead of Legacy.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-03-30 22:17:01 +00:00
Anatol Belski
cf9496376f block: vhdx: impl AsyncDiskFile for VhdxDiskSync
try_clone() shares the Arc<Mutex<Vhdx>>. new_async_io() creates
VhdxSync with a cloned Arc (no error path, infallible).

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-03-30 22:17:01 +00:00
Anatol Belski
e99ad15939 block: vhdx: impl DiskFile for VhdxDiskSync
Supertrait marker, all component traits already implemented.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-03-30 22:17:01 +00:00
Anatol Belski
ffdc8c49d1 block: vhdx: impl Resizable for VhdxDiskSync
Returns UnsupportedFeature, VHDX resize is not supported.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-03-30 22:17:01 +00:00
Anatol Belski
3e904d7a27 block: vhdx: impl SparseCapable for VhdxDiskSync
VHDX does not support sparse operations.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-03-30 22:17:01 +00:00
Anatol Belski
62244f94da block: vhdx: impl Geometry for VhdxDiskSync
Uses default topology.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-03-30 22:17:01 +00:00
Anatol Belski
eca9e14ecb block: vhdx: impl DiskFd for VhdxDiskSync
Returns the raw fd from the inner Vhdx via mutex lock.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-03-30 22:17:01 +00:00
Anatol Belski
5578f329cf block: vhdx: impl PhysicalSize for VhdxDiskSync
Explicitly matches GetFileMetadata to preserve the original error type.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-03-30 22:17:01 +00:00
Anatol Belski
3164b66cb5 block: vhdx: impl DiskSize for VhdxDiskSync
Delegates to Vhdx::virtual_disk_size() which is infallible.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-03-30 22:17:01 +00:00
Anatol Belski
b8b32f5927 block: vhdx: Switch VhdxDiskSync::new to BlockResult
Wrap VhdxError via BlockError::new(Io, e).with_op(Open). Update VMM
CreateFixedVhdxDiskSync error variant from VhdxError to BlockError.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-03-30 22:17:01 +00:00
Anatol Belski
019aa52830 block: vhd: Remove legacy async_io::DiskFile impl from FixedVhdDiskAsync
No remaining consumers after switching to DiskBackend::Next.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-03-30 22:16:04 +00:00
Anatol Belski
b69bd219fa vmm: Switch fixed VHD async to DiskBackend::Next
Wire FixedVhdDiskAsync through the new composable trait system.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-03-30 22:16:04 +00:00
Anatol Belski
c0db1f61ac block: vhd: impl AsyncDiskFile for FixedVhdDiskAsync
Delegate try_clone() to FixedVhd::clone() and new_async_io() to
FixedVhdAsync, preserving DiskFileError::NewAsyncIo.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-03-30 22:16:04 +00:00
Anatol Belski
be6ce5b878 block: vhd: impl DiskFile for FixedVhdDiskAsync
Marker impl bundling DiskSize and Geometry supertraits.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-03-30 22:16:04 +00:00
Anatol Belski
df5d2d64b2 block: vhd: impl Resizable for FixedVhdDiskAsync
Fixed VHD does not support resize, return UnsupportedFeature.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-03-30 22:16:04 +00:00
Anatol Belski
0dece29fa8 block: vhd: impl SparseCapable for FixedVhdDiskAsync
Fixed VHD does not support sparse operations.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-03-30 22:16:04 +00:00
Anatol Belski
1db64f511e block: vhd: impl Geometry for FixedVhdDiskAsync
Use default DiskTopology with 512 byte sectors.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-03-30 22:16:04 +00:00
Anatol Belski
2973987c81 block: vhd: impl DiskFd for FixedVhdDiskAsync
Delegate to FixedVhd::as_raw_fd().

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-03-30 22:16:04 +00:00
Anatol Belski
42af5913d9 block: vhd: impl PhysicalSize for FixedVhdDiskAsync
Fix .unwrap() bug: use explicit GetFileMetadata match.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-03-30 22:16:04 +00:00
Anatol Belski
d82b1101d9 block: vhd: impl DiskSize for FixedVhdDiskAsync
Delegate to infallible FixedVhd::logical_size().

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-03-30 22:16:04 +00:00
Anatol Belski
15073edf08 block: vhd: Switch FixedVhdDiskAsync::new to BlockResult
Map FixedVhd::new io::Error to BlockError with ErrorOp::Open.
Update vmm CreateFixedVhdDiskAsync source type accordingly.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-03-30 22:16:04 +00:00
Muminul Islam
38eb10d209 block: Remove legacy DiskFile impl from RawFileDiskSync
Remove the legacy async_io::DiskFile implementation from
RawFileDiskSync now that the new disk_file trait impls are
in place.

Remove unused imports: Seek, SeekFrom, DiskFile, and
DiskFileResult.

Signed-off-by: Muminul Islam <muislam@microsoft.com>
2026-03-30 22:15:31 +00:00
Muminul Islam
4f44cd9ed3 vmm: Switch RawFileDiskSync to DiskBackend::Next
Update device_manager.rs to construct DiskBackend::Next
instead of DiskBackend::Legacy for the synchronous raw
backend.

Signed-off-by: Muminul Islam <muislam@microsoft.com>
2026-03-30 22:15:31 +00:00
Muminul Islam
afd018f9d1 fuzz: Switch RawFileDiskSync to DiskBackend::Next
Update fuzz/block.rs to construct DiskBackend::Next instead
of DiskBackend::Legacy for the synchronous raw backend.

Remove the unused async_io::DiskFile import.

Signed-off-by: Muminul Islam <muislam@microsoft.com>
2026-03-30 22:15:31 +00:00
Muminul Islam
662d350cf9 block: Implement AsyncDiskFile trait for RawFileDiskSync
Add disk_file::AsyncDiskFile trait implementation for
RawFileDiskSync with try_clone() and new_async_io() methods.

try_clone() duplicates the underlying file descriptor and
wraps it in a new RawFileDiskSync. new_async_io() creates a
RawFileSync (synchronous fallback) backend, wrapping errors
in BlockError instead of DiskFileError.

Add DiskFileError::Clone variant in async_io.rs for the
try_clone() error path.

Signed-off-by: Muminul Islam <muislam@microsoft.com>
2026-03-30 22:15:31 +00:00
Muminul Islam
da72a3abfb block: Implement DiskFile marker trait for RawFileDiskSync
Add empty disk_file::DiskFile impl for RawFileDiskSync.
This marker supertrait requires DiskSize + Geometry + Sync,
all of which are now satisfied.

Signed-off-by: Muminul Islam <muislam@microsoft.com>
2026-03-30 22:15:31 +00:00
Muminul Islam
6b14d27f30 block: Implement Resizable trait for RawFileDiskSync
Add disk_file::Resizable trait implementation for
RawFileDiskSync. Calls file.set_len(size) and wraps the
I/O error in BlockError on failure.

Signed-off-by: Muminul Islam <muislam@microsoft.com>
2026-03-30 22:15:31 +00:00
Muminul Islam
fe39929a2a block: Implement SparseCapable trait for RawFileDiskSync
Add disk_file::SparseCapable trait implementation for
RawFileDiskSync. Delegates to probe_sparse_support() to
detect whether the underlying file supports hole-punching.

Signed-off-by: Muminul Islam <muislam@microsoft.com>
2026-03-30 22:15:31 +00:00
Muminul Islam
aa5aa6fe89 block: Implement Geometry trait for RawFileDiskSync
Add disk_file::Geometry trait implementation for
RawFileDiskSync. Probes disk topology from the file,
falling back to defaults on failure. Takes &self instead
of &mut self and uses unwrap_or_else for cleaner error
handling.

Signed-off-by: Muminul Islam <muislam@microsoft.com>
2026-03-30 22:15:31 +00:00