Compare commits
10 Commits
36757dc5be
...
49533e49bc
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
49533e49bc | ||
|
|
34537ab6e5 | ||
|
|
9597e65c3c | ||
|
|
90c0c26525 | ||
|
|
b82980990b | ||
|
|
db174eaf32 | ||
|
|
f9d09912c7 | ||
|
|
3a58e23103 | ||
|
|
976d1ffdfd | ||
|
|
dd8bf754bc |
67
0025-micro_vm-update-seccomp-rules.patch
Normal file
67
0025-micro_vm-update-seccomp-rules.patch
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
From 024d5c4070df66913e1bf12e5f21eaa090ea2f68 Mon Sep 17 00:00:00 2001
|
||||||
|
From: zhouli57 <zhouli57@huawei.com>
|
||||||
|
Date: Tue, 12 Jul 2022 20:53:15 +0800
|
||||||
|
Subject: [PATCH] micro_vm: update seccomp rules
|
||||||
|
|
||||||
|
When you run the query-cpus QMP command in the ARM of the micro vm, a bad
|
||||||
|
system call is displayed.
|
||||||
|
|
||||||
|
Signed-off-by: zhouli57 <zhouli57@huawei.com>
|
||||||
|
---
|
||||||
|
docs/config_guidebook.md | 2 +-
|
||||||
|
machine/src/micro_vm/syscall.rs | 8 ++++----
|
||||||
|
2 files changed, 5 insertions(+), 5 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/docs/config_guidebook.md b/docs/config_guidebook.md
|
||||||
|
index a8e010a..2146f49 100644
|
||||||
|
--- a/docs/config_guidebook.md
|
||||||
|
+++ b/docs/config_guidebook.md
|
||||||
|
@@ -557,7 +557,7 @@ in StratoVirt process by default. It will make a slight influence on performance
|
||||||
|
|
||||||
|
| Number of Syscalls | GNU Toolchain | MUSL Toolchain |
|
||||||
|
| :----------------: | :-----------: | :------------: |
|
||||||
|
-| microvm | 44 | 45 |
|
||||||
|
+| microvm | 45 | 45 |
|
||||||
|
| virt | 48 | 47 |
|
||||||
|
|
||||||
|
If you want to disable seccomp, you can run StratoVirt with `-disable-seccomp`.
|
||||||
|
diff --git a/machine/src/micro_vm/syscall.rs b/machine/src/micro_vm/syscall.rs
|
||||||
|
index 81637a3..bdd232d 100644
|
||||||
|
--- a/machine/src/micro_vm/syscall.rs
|
||||||
|
+++ b/machine/src/micro_vm/syscall.rs
|
||||||
|
@@ -50,7 +50,7 @@ const KVM_RUN: u32 = 0xae80;
|
||||||
|
/// This allowlist limit syscall with:
|
||||||
|
/// * x86_64-unknown-gnu: 43 syscalls
|
||||||
|
/// * x86_64-unknown-musl: 43 syscalls
|
||||||
|
-/// * aarch64-unknown-gnu: 41 syscalls
|
||||||
|
+/// * aarch64-unknown-gnu: 42 syscalls
|
||||||
|
/// * aarch64-unknown-musl: 42 syscalls
|
||||||
|
/// To reduce performance losses, the syscall rules is ordered by frequency.
|
||||||
|
pub fn syscall_whitelist() -> Vec<BpfRule> {
|
||||||
|
@@ -108,7 +108,7 @@ pub fn syscall_whitelist() -> Vec<BpfRule> {
|
||||||
|
BpfRule::new(libc::SYS_stat),
|
||||||
|
#[cfg(all(target_env = "gnu", target_arch = "x86_64"))]
|
||||||
|
BpfRule::new(libc::SYS_newfstatat),
|
||||||
|
- #[cfg(all(target_env = "musl", target_arch = "aarch64"))]
|
||||||
|
+ #[cfg(target_arch = "aarch64")]
|
||||||
|
BpfRule::new(libc::SYS_newfstatat),
|
||||||
|
#[cfg(target_arch = "x86_64")]
|
||||||
|
BpfRule::new(libc::SYS_unlink),
|
||||||
|
@@ -178,12 +178,12 @@ fn ioctl_arch_allow_list(bpf_rule: BpfRule) -> BpfRule {
|
||||||
|
}
|
||||||
|
|
||||||
|
fn madvise_rule() -> BpfRule {
|
||||||
|
- #[cfg(all(target_env = "musl", target_arch = "x86_64"))]
|
||||||
|
+ #[cfg(target_env = "musl")]
|
||||||
|
return BpfRule::new(libc::SYS_madvise)
|
||||||
|
.add_constraint(SeccompCmpOpt::Eq, 2, libc::MADV_FREE as u32)
|
||||||
|
.add_constraint(SeccompCmpOpt::Eq, 2, libc::MADV_DONTNEED as u32)
|
||||||
|
.add_constraint(SeccompCmpOpt::Eq, 2, libc::MADV_WILLNEED as u32);
|
||||||
|
- #[cfg(not(all(target_env = "musl", target_arch = "x86_64")))]
|
||||||
|
+ #[cfg(not(target_env = "musl"))]
|
||||||
|
return BpfRule::new(libc::SYS_madvise)
|
||||||
|
.add_constraint(SeccompCmpOpt::Eq, 2, libc::MADV_DONTNEED as u32)
|
||||||
|
.add_constraint(SeccompCmpOpt::Eq, 2, libc::MADV_WILLNEED as u32);
|
||||||
|
--
|
||||||
|
2.27.0
|
||||||
|
|
||||||
78
0026-support-parameter-accel.patch
Normal file
78
0026-support-parameter-accel.patch
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
From 4761842ceae0c8ac766b04c8e7bfbb7396e802c4 Mon Sep 17 00:00:00 2001
|
||||||
|
From: yezengruan <yezengruan@huawei.com>
|
||||||
|
Date: Fri, 3 Feb 2023 14:26:34 +0800
|
||||||
|
Subject: [PATCH] support parameter -accel
|
||||||
|
|
||||||
|
The libvirt v7.10.0 (commit id d20ebdda28) changed `-machine accel=XXX`
|
||||||
|
to `-accel=XXX`, let's add `-accel` parameter support for compatibility
|
||||||
|
with libvirt.
|
||||||
|
|
||||||
|
Signed-off-by: yezengruan <yezengruan@huawei.com>
|
||||||
|
---
|
||||||
|
machine_manager/src/cmdline.rs | 8 ++++++++
|
||||||
|
machine_manager/src/config/machine_config.rs | 16 ++++++++++++++++
|
||||||
|
2 files changed, 24 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/machine_manager/src/cmdline.rs b/machine_manager/src/cmdline.rs
|
||||||
|
index 7e61a40b..8c5eb26b 100644
|
||||||
|
--- a/machine_manager/src/cmdline.rs
|
||||||
|
+++ b/machine_manager/src/cmdline.rs
|
||||||
|
@@ -91,6 +91,13 @@ pub fn create_args_parser<'a>() -> ArgParser<'a> {
|
||||||
|
.help("selects emulated machine and set properties")
|
||||||
|
.takes_value(true),
|
||||||
|
)
|
||||||
|
+ .arg(
|
||||||
|
+ Arg::with_name("accel")
|
||||||
|
+ .long("accel")
|
||||||
|
+ .value_name("[accel]")
|
||||||
|
+ .help("select accelerator, only 'kvm' is supported now.")
|
||||||
|
+ .takes_value(true),
|
||||||
|
+ )
|
||||||
|
.arg(
|
||||||
|
Arg::with_name("smp")
|
||||||
|
.long("smp")
|
||||||
|
@@ -406,6 +413,7 @@ pub fn create_vmconfig(args: &ArgMatches) -> Result<VmConfig> {
|
||||||
|
// Parse cmdline args which need to set in VmConfig
|
||||||
|
add_args_to_config!((args.value_of("name")), vm_cfg, add_name);
|
||||||
|
add_args_to_config!((args.value_of("machine")), vm_cfg, add_machine);
|
||||||
|
+ add_args_to_config!((args.value_of("accel")), vm_cfg, add_accel);
|
||||||
|
add_args_to_config!((args.value_of("memory")), vm_cfg, add_memory);
|
||||||
|
add_args_to_config!((args.value_of("mem-path")), vm_cfg, add_mem_path);
|
||||||
|
add_args_to_config!((args.value_of("smp")), vm_cfg, add_cpu);
|
||||||
|
diff --git a/machine_manager/src/config/machine_config.rs b/machine_manager/src/config/machine_config.rs
|
||||||
|
index 33755519..d9280b22 100644
|
||||||
|
--- a/machine_manager/src/config/machine_config.rs
|
||||||
|
+++ b/machine_manager/src/config/machine_config.rs
|
||||||
|
@@ -193,6 +193,7 @@ impl VmConfig {
|
||||||
|
}
|
||||||
|
|
||||||
|
if let Some(accel) = cmd_parser.get_value::<String>("accel")? {
|
||||||
|
+ // Libvirt checks the parameter types of 'kvm', 'kvm:tcg' and 'tcg'.
|
||||||
|
if accel.ne("kvm:tcg") && accel.ne("tcg") && accel.ne("kvm") {
|
||||||
|
bail!("Only \'kvm\', \'kvm:tcg\' and \'tcg\' are supported for \'accel\' of \'machine\'");
|
||||||
|
}
|
||||||
|
@@ -224,6 +225,21 @@ impl VmConfig {
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
+ /// Add '-accel' accelerator config to `VmConfig`.
|
||||||
|
+ pub fn add_accel(&mut self, accel_config: &str) -> Result<()> {
|
||||||
|
+ let mut cmd_parser = CmdParser::new("accel");
|
||||||
|
+ cmd_parser.push("");
|
||||||
|
+ cmd_parser.parse(accel_config)?;
|
||||||
|
+
|
||||||
|
+ if let Some(accel) = cmd_parser.get_value::<String>("")? {
|
||||||
|
+ if accel.ne("kvm") {
|
||||||
|
+ bail!("Only \'kvm\' is supported for \'accel\'");
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ Ok(())
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
/// Add '-m' memory config to `VmConfig`.
|
||||||
|
pub fn add_memory(&mut self, mem_config: &str) -> Result<()> {
|
||||||
|
let mut cmd_parser = CmdParser::new("m");
|
||||||
|
--
|
||||||
|
2.27.0
|
||||||
|
|
||||||
Binary file not shown.
@ -6,12 +6,12 @@
|
|||||||
|
|
||||||
Name: stratovirt
|
Name: stratovirt
|
||||||
Version: 2.1.0
|
Version: 2.1.0
|
||||||
Release: 5
|
Release: 9
|
||||||
Summary: StratoVirt is an opensource VMM(Virtual Machine Manager) which aims to perform next generation virtualization.
|
Summary: StratoVirt is an opensource VMM(Virtual Machine Manager) which aims to perform next generation virtualization.
|
||||||
|
|
||||||
License: Mulan PSL v2
|
License: MulanPSL-2.0
|
||||||
URL: https://gitee.com/openeuler/StratoVirt
|
URL: https://gitee.com/openeuler/stratovirt
|
||||||
Source0: %{name}-%{version}.tar.gz
|
Source0: https://gitee.com/openeuler/stratovirt/releases/download/v%{version}/%{name}-%{version}.tar.gz
|
||||||
|
|
||||||
Patch001: 0001-docs-update-the-document-remove-the-other-features-t.patch
|
Patch001: 0001-docs-update-the-document-remove-the-other-features-t.patch
|
||||||
Patch002: 0002-legacy-fwcfg-fix-bug-of-wrong-size-judgment.patch
|
Patch002: 0002-legacy-fwcfg-fix-bug-of-wrong-size-judgment.patch
|
||||||
@ -37,6 +37,8 @@ Patch021: 0021-console-fix-the-bug-of-delete-park-fd.patch
|
|||||||
Patch022: 0022-docs-add-the-description-of-hot-plug-of-PCI-devices.patch
|
Patch022: 0022-docs-add-the-description-of-hot-plug-of-PCI-devices.patch
|
||||||
Patch023: 0023-Modify-cargo-cllippy-warning-when-compiling-cargo-cl.patch
|
Patch023: 0023-Modify-cargo-cllippy-warning-when-compiling-cargo-cl.patch
|
||||||
Patch024: 0024-machine-clear-some-warnings.patch
|
Patch024: 0024-machine-clear-some-warnings.patch
|
||||||
|
Patch025: 0025-micro_vm-update-seccomp-rules.patch
|
||||||
|
Patch026: 0026-support-parameter-accel.patch
|
||||||
|
|
||||||
ExclusiveArch: x86_64 aarch64
|
ExclusiveArch: x86_64 aarch64
|
||||||
|
|
||||||
@ -91,6 +93,18 @@ chmod 555 ${RPM_BUILD_ROOT}/usr/bin/stratovirt
|
|||||||
chmod 555 ${RPM_BUILD_ROOT}/usr/bin/ozone
|
chmod 555 ${RPM_BUILD_ROOT}/usr/bin/ozone
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Wed Feb 08 2023 yezengruan <yezengruan@huawei.com> - 2.1.0-9
|
||||||
|
- Support parameter -accel
|
||||||
|
|
||||||
|
* Tue Nov 29 2022 Xinle.Guo <guoxinle1@huawei.com> - 2.1.0-8
|
||||||
|
- Add micro vm seccomp rules
|
||||||
|
|
||||||
|
* Thu Nov 24 2022 yezengruan <yezengruan@huawei.com> - 2.1.0-7
|
||||||
|
- Update stratovirt download url
|
||||||
|
|
||||||
|
* Sun Oct 09 2022 yezengruan <yezengruan@huawei.com> - 2.1.0-6
|
||||||
|
- Unified license name specification
|
||||||
|
|
||||||
* Wed Mar 16 2022 zhouli57 <zhouli57@huawei.com> - 2.1.0-5
|
* Wed Mar 16 2022 zhouli57 <zhouli57@huawei.com> - 2.1.0-5
|
||||||
- Clear some warnings.
|
- Clear some warnings.
|
||||||
|
|
||||||
@ -99,7 +113,7 @@ chmod 555 ${RPM_BUILD_ROOT}/usr/bin/ozone
|
|||||||
- Eliminate build warnings and clippy errors with Rust 1.57.0.
|
- Eliminate build warnings and clippy errors with Rust 1.57.0.
|
||||||
- Update docs.
|
- Update docs.
|
||||||
|
|
||||||
* Sun Mar 01 2022 Jie Yang <yangjieyj.yang@huawei.com> - 2.1.0-3
|
* Tue Mar 01 2022 Jie Yang <yangjieyj.yang@huawei.com> - 2.1.0-3
|
||||||
- Fix memory snapshot failure with hotplugged devices.
|
- Fix memory snapshot failure with hotplugged devices.
|
||||||
- Fix address translation for virtio devices.
|
- Fix address translation for virtio devices.
|
||||||
- Add some test cases for microvm.
|
- Add some test cases for microvm.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user