- 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>
93 lines
3.6 KiB
Diff
93 lines
3.6 KiB
Diff
From 93959a5378f57190fb79dd1ccdefb8d8cd095b58 Mon Sep 17 00:00:00 2001
|
|
From: Gao Jiazhen <gaojiazhen_yewu@cmss.chinamobile.com>
|
|
Date: Thu, 12 Sep 2024 10:29:32 +0800
|
|
Subject: [PATCH] hw/misc/bcm2835_property: Fix handling of
|
|
FRAMEBUFFER_SET_PALETTE
|
|
MIME-Version: 1.0
|
|
Content-Type: text/plain; charset=UTF-8
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
cherry picked from commit 0892fffc2abaadfb5d8b79bb0250ae1794862560
|
|
|
|
The documentation of the "Set palette" mailbox property at
|
|
https://github.com/raspberrypi/firmware/wiki/Mailbox-property-interface#set-palette
|
|
says it has the form:
|
|
|
|
Length: 24..1032
|
|
Value:
|
|
u32: offset: first palette index to set (0-255)
|
|
u32: length: number of palette entries to set (1-256)
|
|
u32...: RGBA palette values (offset to offset+length-1)
|
|
|
|
We get this wrong in a couple of ways:
|
|
* we aren't checking the offset and length are in range, so the guest
|
|
can make us spin for a long time by providing a large length
|
|
* the bounds check on our loop is wrong: we should iterate through
|
|
'length' palette entries, not 'length - offset' entries
|
|
|
|
Fix the loop to implement the bounds checks and get the loop
|
|
condition right. In the process, make the variables local to
|
|
this switch case, rather than function-global, so it's clearer
|
|
what type they are when reading the code.
|
|
|
|
Cc: qemu-stable@nongnu.org
|
|
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
|
|
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
|
|
Message-id: 20240723131029.1159908-2-peter.maydell@linaro.org
|
|
Signed-off-by: Gao Jiazhen <gaojiazhen_yewu@cmss.chinamobile.com>
|
|
---
|
|
hw/misc/bcm2835_property.c | 27 ++++++++++++++++-----------
|
|
1 file changed, 16 insertions(+), 11 deletions(-)
|
|
|
|
diff --git a/hw/misc/bcm2835_property.c b/hw/misc/bcm2835_property.c
|
|
index ff55a4e2cd..12a1bc558a 100644
|
|
--- a/hw/misc/bcm2835_property.c
|
|
+++ b/hw/misc/bcm2835_property.c
|
|
@@ -28,8 +28,6 @@ static void bcm2835_property_mbox_push(BCM2835PropertyState *s, uint32_t value)
|
|
uint32_t tot_len;
|
|
size_t resplen;
|
|
uint32_t tmp;
|
|
- int n;
|
|
- uint32_t offset, length, color;
|
|
|
|
/*
|
|
* Copy the current state of the framebuffer config; we will update
|
|
@@ -264,18 +262,25 @@ static void bcm2835_property_mbox_push(BCM2835PropertyState *s, uint32_t value)
|
|
resplen = 16;
|
|
break;
|
|
case RPI_FWREQ_FRAMEBUFFER_SET_PALETTE:
|
|
- offset = ldl_le_phys(&s->dma_as, value + 12);
|
|
- length = ldl_le_phys(&s->dma_as, value + 16);
|
|
- n = 0;
|
|
- while (n < length - offset) {
|
|
- color = ldl_le_phys(&s->dma_as, value + 20 + (n << 2));
|
|
- stl_le_phys(&s->dma_as,
|
|
- s->fbdev->vcram_base + ((offset + n) << 2), color);
|
|
- n++;
|
|
+ {
|
|
+ uint32_t offset = ldl_le_phys(&s->dma_as, value + 12);
|
|
+ uint32_t length = ldl_le_phys(&s->dma_as, value + 16);
|
|
+ int resp;
|
|
+
|
|
+ if (offset > 255 || length < 1 || length > 256) {
|
|
+ resp = 1; /* invalid request */
|
|
+ } else {
|
|
+ for (uint32_t e = 0; e < length; e++) {
|
|
+ uint32_t color = ldl_le_phys(&s->dma_as, value + 20 + (e << 2));
|
|
+ stl_le_phys(&s->dma_as,
|
|
+ s->fbdev->vcram_base + ((offset + e) << 2), color);
|
|
+ }
|
|
+ resp = 0;
|
|
}
|
|
- stl_le_phys(&s->dma_as, value + 12, 0);
|
|
+ stl_le_phys(&s->dma_as, value + 12, resp);
|
|
resplen = 4;
|
|
break;
|
|
+ }
|
|
case RPI_FWREQ_FRAMEBUFFER_GET_NUM_DISPLAYS:
|
|
stl_le_phys(&s->dma_as, value + 12, 1);
|
|
resplen = 4;
|
|
--
|
|
2.41.0.windows.1
|
|
|