Compare commits

...

6 Commits

Author SHA1 Message Date
dependabot[bot]
2d15a2cd45 build: Bump arc-swap from 1.6.0 to 1.7.1 in /fuzz
Bumps [arc-swap](https://github.com/vorner/arc-swap) from 1.6.0 to 1.7.1.
- [Changelog](https://github.com/vorner/arc-swap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/vorner/arc-swap/commits)

---
updated-dependencies:
- dependency-name: arc-swap
  dependency-type: indirect
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-29 23:41:24 +00:00
Alexandru Matei
fbe3e4d642 vmm: memory_manager: don't set backing_file for virtio_mem regions
The memory region that is associated with the hotpluggable part of
a virtio-mem zone isn't backed by the file specified in the
MemoryZoneConfig. The file is used only for the fixed part of the
zone. When you try to restore a snapshot with virtio-mem, the
backing file is used for all its regions. This results in the
following error:

  VmRestore(MemoryManager(GuestMemoryRegion(MappingPastEof)))

This patch sets backing_file only for the fixed part of a virtio-mem
zone.

Fixes: #6337

Signed-off-by: Alexandru Matei <alexandru.matei@uipath.com>
2024-03-29 20:11:20 +00:00
Nuno Das Neves
28d4957ba5 hypervisor: Remove redefinition of HV_PAGE_SIZE in mshv
HV_PAGE_SIZE is defined as a usize in mshv_bindings.
Remove the redefinition, and perform casts where necessary.

Signed-off-by: Nuno Das Neves <nudasnev@microsoft.com>
2024-03-29 13:14:37 -07:00
Nuno Das Neves
f39d5eeaf0 build: Update mshv crate commit in Cargo.lock
Signed-off-by: Nuno Das Neves <nudasnev@microsoft.com>
2024-03-29 13:14:37 -07:00
Nuno Das Neves
639db35635 vmm: Update and add seccomp IOCTL numbers for mshv
Add IOCTL number for generic hypercall ioctl (MSHV_ROOT_HVCALL).
Update IOCTL numbers for set/get vp state.

Signed-off-by: Nuno Das Neves <nudasnev@microsoft.com>
2024-03-29 13:14:37 -07:00
dependabot[bot]
6482f7e8c3 build: Bump zbus_names from 2.6.0 to 2.6.1
Bumps [zbus_names](https://github.com/dbus2/zbus) from 2.6.0 to 2.6.1.
- [Release notes](https://github.com/dbus2/zbus/releases)
- [Commits](https://github.com/dbus2/zbus/compare/zbus_names-2.6.0...zbus_names-2.6.1)

---
updated-dependencies:
- dependency-name: zbus_names
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-29 18:45:34 +00:00
5 changed files with 18 additions and 13 deletions

8
Cargo.lock generated
View File

@ -1338,7 +1338,7 @@ checksum = "9bec4598fddb13cc7b528819e697852653252b760f1228b7642679bf2ff2cd07"
[[package]]
name = "mshv-bindings"
version = "0.1.1"
source = "git+https://github.com/rust-vmm/mshv?branch=main#9d0c11fe9fedfbcf56a5d62fbf4bad80cdf91340"
source = "git+https://github.com/rust-vmm/mshv?branch=main#9f1e0cd775b30f36044bd045b27863b953c5988a"
dependencies = [
"libc",
"serde",
@ -1350,7 +1350,7 @@ dependencies = [
[[package]]
name = "mshv-ioctls"
version = "0.1.1"
source = "git+https://github.com/rust-vmm/mshv?branch=main#9d0c11fe9fedfbcf56a5d62fbf4bad80cdf91340"
source = "git+https://github.com/rust-vmm/mshv?branch=main#9f1e0cd775b30f36044bd045b27863b953c5988a"
dependencies = [
"libc",
"mshv-bindings",
@ -3064,9 +3064,9 @@ dependencies = [
[[package]]
name = "zbus_names"
version = "2.6.0"
version = "2.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fb80bb776dbda6e23d705cf0123c3b95df99c4ebeaec6c2599d4a5419902b4a9"
checksum = "437d738d3750bed6ca9b8d423ccc7a8eb284f6b1d6d4e225a0e4e6258d864c8d"
dependencies = [
"serde",
"static_assertions",

4
fuzz/Cargo.lock generated
View File

@ -79,9 +79,9 @@ checksum = "7d5a26814d8dcb93b0e5a0ff3c6d80a8843bafb21b39e8e18a6f05471870e110"
[[package]]
name = "arc-swap"
version = "1.6.0"
version = "1.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bddcadddf5e9015d310179a59bb28c4d4b9920ad0f11e8e14dbadf654890c9a6"
checksum = "69f7f8c3906b62b754cd5326047894316021dcfe5a194c8ea52bdd94934a3457"
[[package]]
name = "arch"

View File

@ -54,8 +54,6 @@ use crate::arch::x86::{CpuIdEntry, FpuState, MsrEntry};
const DIRTY_BITMAP_CLEAR_DIRTY: u64 = 0x4;
const DIRTY_BITMAP_SET_DIRTY: u64 = 0x8;
#[cfg(feature = "sev_snp")]
const HV_PAGE_SIZE: u64 = 4096;
///
/// Export generically-named wrappers of mshv-bindings for Unix-based platforms
@ -653,9 +651,9 @@ impl cpu::Vcpu for MshvVcpu {
"Releasing pages: gfn_start: {:x?}, gfn_count: {:?}",
gfn_start, gfn_count
);
let gpa_start = gfn_start * HV_PAGE_SIZE;
let gpa_start = gfn_start * HV_PAGE_SIZE as u64;
for i in 0..gfn_count {
gpas.push(gpa_start + i * HV_PAGE_SIZE);
gpas.push(gpa_start + i * HV_PAGE_SIZE as u64);
}
let mut gpa_list =

View File

@ -671,7 +671,11 @@ impl MemoryManager {
for zone_config in zones_config {
if guest_ram_mapping.zone_id == zone_config.id {
let region = MemoryManager::create_ram_region(
&zone_config.file,
if guest_ram_mapping.virtio_mem {
&None
} else {
&zone_config.file
},
guest_ram_mapping.file_offset,
GuestAddress(guest_ram_mapping.gpa),
guest_ram_mapping.size as usize,

View File

@ -165,8 +165,8 @@ mod mshv {
pub const MSHV_GET_VP_REGISTERS: u64 = 0xc010_b805;
pub const MSHV_SET_VP_REGISTERS: u64 = 0x4010_b806;
pub const MSHV_RUN_VP: u64 = 0x8100_b807;
pub const MSHV_GET_VP_STATE: u64 = 0xc028_b80a;
pub const MSHV_SET_VP_STATE: u64 = 0xc028_b80b;
pub const MSHV_GET_VP_STATE: u64 = 0xc010_b80a;
pub const MSHV_SET_VP_STATE: u64 = 0xc010_b80b;
pub const MSHV_SET_PARTITION_PROPERTY: u64 = 0x4010_b80c;
pub const MSHV_GET_GPA_ACCESS_STATES: u64 = 0xc01c_b812;
pub const MSHV_VP_TRANSLATE_GVA: u64 = 0xc020_b80e;
@ -183,6 +183,7 @@ mod mshv {
pub const MSHV_SEV_SNP_AP_CREATE: u64 = 0x4010_b834;
pub const MSHV_ISSUE_PSP_GUEST_REQUEST: u64 = 0x4010_b831;
pub const MSHV_ASSERT_INTERRUPT: u64 = 0x4018_b809;
pub const MSHV_ROOT_HVCALL: u64 = 0xc020_b835;
}
#[cfg(feature = "mshv")]
use mshv::*;
@ -244,6 +245,7 @@ fn create_vmm_ioctl_seccomp_rule_common_mshv() -> Result<Vec<SeccompRule>, Backe
Eq,
MSHV_ISSUE_PSP_GUEST_REQUEST
)?],
and![Cond::new(1, ArgLen::Dword, Eq, MSHV_ROOT_HVCALL)?],
])
}
@ -725,6 +727,7 @@ fn create_vcpu_ioctl_seccomp_rule_mshv() -> Result<Vec<SeccompRule>, BackendErro
Eq,
MSHV_ISSUE_PSP_GUEST_REQUEST
)?],
and![Cond::new(1, ArgLen::Dword, Eq, MSHV_ROOT_HVCALL)?],
])
}