qemu/cvm-Implement-command-blacklist-for-cvm-security-enh.patch

119 lines
3.6 KiB
Diff
Raw Normal View History

QEMU update to version 8.2.0-18: - hw/loongarch/virt: Fix FDT memory node address width - hw/loongarch: Fix fdt memory node wrong 'reg' - load_elf: fix iterator's type for elf file processing - migration/colo: Fix bdrv_graph_rdlock_main_loop: Assertion `!qemu_in_… - target/i386: no single-step exception after MOV or POP SS - char-stdio: Restore blocking mode of stdout on exit - backends/cryptodev-builtin: Fix local_error leaks - target/loongarch: fix a wrong print in cpu dump - virtio-pci: fix use of a released vector - target/arm: Disable SVE extensions when SVE is disabled - hw/misc/bcm2835_property: Fix handling of FRAMEBUFFER_SET_PALETTE - target/i386: Introduce SapphireRapids-v3 to add missing features - virtio-net: Ensure queue index fits with RSS (CVE-2024-6505) - nbd/server: CVE-2024-7409: Avoid use-after-free when closing server - update io/trace-events. Parameters should remain consistent. - update docs/tools/virtfs-proxy-helper.rst. This place is spelled wrong. - kvm: Add support for CSV2 reboot - target/i386/kvm: Fix the resettable info when emulate Hygon CSV2 guest - target/i386: get/set/migrate GHCB state - target/i386: csv: Add support for migrate VMSA for CSV2 guest - migration/ram: Accelerate the loading of CSV guest's encrypted pages - migration/ram: Accelerate the transmission of CSV guest's encrypted pages - target/i386: csv: add support to load incoming encrypted pages queued in the CMD list - target/i386: csv: add support to queue the incoming page into a list - target/i386: csv: add support to encrypt the outgoing pages in the list queued before. - target/i386: csv: add support to queue the outgoing page into a list - target/i386: csv: Read cert chain from file when prepared for CSV live migration - target/i386: Introduce header file csv.h - migration/ram: Fix calculation of gfn correpond to a page in ramblock - target/i386: sev: Clear shared_regions_list when reboot CSV Guest - migration/ram: Force encrypted status for VGA vram - target/i386: sev: Return 0 if sev_send_get_packet_len() fails - kvm: Add support for userspace MSR filtering and handling of MSR_KVM_MIGRATION_CONTROL. - migration/ram: Force encrypted status for flash0 & flash1 devices. - migration/ram: add support to send encrypted pages - migration: add support to migrate shared regions list - kvm: Add support for SEV shared regions list and KVM_EXIT_HYPERCALL. - target/i386: sev: add support to load incoming encrypted page - target/i386: sev: add support to encrypt the outgoing page - target/i386: sev: do not create launch context for an incoming guest - target/i386: sev: provide callback to setup outgoing context - confidential guest support: introduce ConfidentialGuestMemoryEncryptionOps for encrypted VMs - migration.json: add AMD SEV specific migration parameters - doc: update AMD SEV to include Live migration flow - crypto/tlscredspsk: Free username on finalize - hw/nvme: fix leak of uninitialized memory in io_mgmt_recv - hw/display/vhost-user-gpu.c: fix vhost_user_gpu_chr_read() - cvm : Implement command blacklist for cvm security enhancement - crypto: Introduce SM3 hash hmac pbkdf algorithm - virtio-net: Use virtual time for RSC timers - vvfat: Fix bug in writing to middle of file - hw/core/ptimer: fix timer zero period condition for freq > 1GHz - hw/misc: support vpsp Signed-off-by: Jiabo Feng <fengjiabo1@huawei.com>
2024-09-18 15:20:53 +08:00
From 384b3f41fd69ed6f5bf376ff1aac1a12deeea0fb Mon Sep 17 00:00:00 2001
From: liupingwei <liupingwei0317@outlook.com>
Date: Fri, 16 Aug 2024 18:06:10 +0800
Subject: [PATCH] cvm : Implement command blacklist for cvm security
enhancement
Added a new feature to intercept and block specific virsh commands(virsh
save,virsh restore,virsh dump,virsh suspend,virsh resume)that can impact
the security of cvm.
Signed-off-by: liupingwei <liupingwei0317@outlook.com>
---
dump/dump.c | 7 +++++++
migration/migration-hmp-cmds.c | 6 ++++++
migration/savevm.c | 6 ++++++
monitor/qmp-cmds.c | 6 ++++++
4 files changed, 25 insertions(+)
diff --git a/dump/dump.c b/dump/dump.c
index 4819050764..787059ac2c 100644
--- a/dump/dump.c
+++ b/dump/dump.c
@@ -20,6 +20,7 @@
#include "sysemu/dump.h"
#include "sysemu/runstate.h"
#include "sysemu/cpus.h"
+#include "sysemu/kvm.h"
#include "qapi/error.h"
#include "qapi/qapi-commands-dump.h"
#include "qapi/qapi-events-dump.h"
@@ -2065,6 +2066,12 @@ void qmp_dump_guest_memory(bool paging, const char *protocol,
Error **errp)
{
ERRP_GUARD();
+
+ if (virtcca_cvm_enabled()) {
+ error_setg(errp, "The dump-guest-memory command is temporarily unsupported in cvm.");
+ return;
+ }
+
const char *p;
int fd;
DumpState *s;
diff --git a/migration/migration-hmp-cmds.c b/migration/migration-hmp-cmds.c
index 1fa6a5f478..386ba7fc98 100644
--- a/migration/migration-hmp-cmds.c
+++ b/migration/migration-hmp-cmds.c
@@ -30,6 +30,7 @@
#include "sysemu/runstate.h"
#include "ui/qemu-spice.h"
#include "sysemu/sysemu.h"
+#include "sysemu/kvm.h"
#include "options.h"
#include "migration.h"
@@ -406,6 +407,11 @@ void hmp_loadvm(Monitor *mon, const QDict *qdict)
const char *name = qdict_get_str(qdict, "name");
Error *err = NULL;
+ if (virtcca_cvm_enabled()) {
+ error_setg(&err, "The loadvm command is temporarily unsupported in cvm.");
+ return;
+ }
+
vm_stop(RUN_STATE_RESTORE_VM);
if (load_snapshot(name, NULL, false, NULL, &err) && saved_vm_running) {
diff --git a/migration/savevm.c b/migration/savevm.c
index 477a19719f..cc65da605e 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -61,6 +61,7 @@
#include "sysemu/replay.h"
#include "sysemu/runstate.h"
#include "sysemu/sysemu.h"
+#include "sysemu/kvm.h"
#include "sysemu/xen.h"
#include "migration/colo.h"
#include "qemu/bitmap.h"
@@ -3044,6 +3045,11 @@ int qemu_loadvm_approve_switchover(void)
bool save_snapshot(const char *name, bool overwrite, const char *vmstate,
bool has_devices, strList *devices, Error **errp)
{
+ if (virtcca_cvm_enabled()) {
+ error_setg(errp, "The savevm command is temporarily unsupported in cvm.");
+ return false;
+ }
+
BlockDriverState *bs;
QEMUSnapshotInfo sn1, *sn = &sn1;
int ret = -1, ret2;
diff --git a/monitor/qmp-cmds.c b/monitor/qmp-cmds.c
index e78462b857..c0b66f11bf 100644
--- a/monitor/qmp-cmds.c
+++ b/monitor/qmp-cmds.c
@@ -23,6 +23,7 @@
#include "sysemu/runstate.h"
#include "sysemu/runstate-action.h"
#include "sysemu/block-backend.h"
+#include "sysemu/kvm.h"
#include "qapi/error.h"
#include "qapi/qapi-init-commands.h"
#include "qapi/qapi-commands-control.h"
@@ -50,6 +51,11 @@ void qmp_quit(Error **errp)
void qmp_stop(Error **errp)
{
+ if (virtcca_cvm_enabled()) {
+ error_setg(errp, "The stop command is temporarily unsupported in cvm.");
+ return;
+ }
+
/* if there is a dump in background, we should wait until the dump
* finished */
if (qemu_system_dump_in_progress()) {
--
2.41.0.windows.1