* [Stable-9.1.1 00/49] Patch Round-up for stable 9.1.1, freeze on 2024-10-16 (frozen)
@ 2024-10-16 20:09 Michael Tokarev
2024-10-16 20:09 ` [Stable-9.1.1 33/49] linux-user/flatload: Take mmap_lock in load_flt_binary() Michael Tokarev
` (17 more replies)
0 siblings, 18 replies; 20+ messages in thread
From: Michael Tokarev @ 2024-10-16 20:09 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-stable, Michael Tokarev
The following patches are queued for QEMU stable v9.1.1:
https://gitlab.com/qemu-project/qemu/-/commits/staging-9.1
Patch freeze is 2024-10-16 (frozen), and the release is planned for 2024-10-18:
https://wiki.qemu.org/Planning/9.1
Please respond here or CC qemu-stable@nongnu.org on any additional patches
you think should (or shouldn't) be included in the release.
The changes which are staging for inclusion, with the original commit hash
from master branch, are given below the bottom line.
Thanks!
/mjt
--------------------------------------
01* ead5078cf1a5 Helge Deller:
target/hppa: Fix PSW V-bit packaging in cpu_hppa_get for hppa64
02* 48b8583698d9 Daniel P. Berrangé:
iotests: fix expected output from gnutls
03* c72cab5ad9f8 Tiago Pasqualini:
crypto: run qcrypto_pbkdf2_count_iters in a new thread
04* e6c09ea4f9e5 Daniel P. Berrangé:
crypto: check gnutls & gcrypt support the requested pbkdf hash
05* 586ac2c67d70 Daniel P. Berrangé:
crypto: avoid leak of ctx when bad cipher mode is given
06* d0068b746a0a Alex Bennée:
tests/docker: remove debian-armel-cross
07* 19d2111059c8 Alex Bennée:
tests/docker: update debian i686 and mipsel images to bookworm
08* 1231bc7d12c3 Thomas Huth:
contrib/plugins/Makefile: Add a 'distclean' target
09* 7fc6611cad3e Volker Rümelin:
hw/audio/virtio-sound: fix heap buffer overflow
10* 110684c9a69a Jan Klötzke:
hw/intc/arm_gic: fix spurious level triggered interrupts
11* ae23cd00170b Gert Wollny:
ui/sdl2: set swap interval explicitly when OpenGL is enabled
12* 8d5ab746b1e6 Daniel P. Berrangé:
gitlab: fix logic for changing docker tag on stable branches
13* 637b0aa13956 Mattias Nissler:
softmmu: Support concurrent bounce buffers
14* b84f06c2bee7 David Hildenbrand:
softmmu/physmem: fix memory leak in dirty_memory_extend()
15* d8d5ca40048b Fea.Wang:
softmmu/physmem.c: Keep transaction attribute in address_space_map()
16* 2d0a071e625d Mattias Nissler:
mac_dbdma: Remove leftover `dma_memory_unmap` calls
17* 4ce562290878 Fabiano Rosas:
migration/multifd: Fix rb->receivedmap cleanup race
18* 6cce0dcc6f7a Jacob Abrams:
hw/char/stm32l4x5_usart.c: Enable USART ACK bit response
19* 8676007eff04 Peter Maydell:
target/arm: Correct ID_AA64ISAR1_EL1 value for neoverse-v1
20* d33d3adb5737 Helge Deller:
target/hppa: Fix random 32-bit linux-user crashes
21* 203beb6f0474 Arman Nabiev:
target/ppc: Fix migration of CPUs with TLB_EMB TLB type
22* 405e352d28c2 Fabiano Rosas:
migration/multifd: Fix p->iov leak in multifd-uadk.c
23* 4265b4f35843 Bibo Mao:
hw/loongarch/virt: Add description for virt machine type
24* 9d8d5a5b9078 TANG Tiancheng:
tcg: Fix iteration step in 32-bit gvec operation
25* 8bded2e73e80 Fabiano Rosas:
target/ppc: Fix lxvx/stxvx facility check
26* 2e4fdf566062 Mark Cave-Ayland:
hw/mips/jazz: fix typo in in-built NIC alias
27* bc02be4508d8 Alex Bennée:
util/timer: avoid deadlock when shutting down
28* 6475155d5192 Fiona Ebner:
block/reqlist: allow adding overlapping requests
29* 67d762e716a7 Ard Biesheuvel:
target/arm: Avoid target_ulong for physical address lookups
30* 9601076b3b0b Jan Luebbe:
hw/sd/sdcard: Fix handling of disabled boot partitions
31* c60473d29254 Alex Bennée:
testing: bump mips64el cross to bookworm and fix package list
32* 0e60fc80938d Marc-André Lureau:
vnc: fix crash when no console attached
33 a9ee641bd46f Philippe Mathieu-Daudé:
linux-user/flatload: Take mmap_lock in load_flt_binary()
34 2884596f5f38 Richard Henderson:
linux-user: Fix parse_elf_properties GNU0_MAGIC check
35 4cabcb89b101 Richard Henderson:
tcg/ppc: Use TCG_REG_TMP2 for scratch tcg_out_qemu_st
36 3213da7b9539 Richard Henderson:
tcg/ppc: Use TCG_REG_TMP2 for scratch index in prepare_host_addr
37 352cc9f300d8 Richard Henderson:
target/m68k: Always return a temporary from gen_lea_mode
38 461a9252e249 Pierrick Bouvier:
meson: fix machine option for x86_version
39 6ae8c5382b23 Paolo Bonzini:
meson: define qemu_isa_flags
40 8db4e0f92e83 Paolo Bonzini:
meson: ensure -mcx16 is passed when detecting ATOMIC128
41 e0c0ea6eca4f Alexandra Diupina:
hw/intc/arm_gicv3: Add cast to match the documentation
42 12dc8f6eca1e Alexandra Diupina:
hw/intc/arm_gicv3: Add cast to match the documentation
43 3db74afec3ca Alexandra Diupina:
hw/intc/arm_gicv3_cpuif: Add cast to match the documentation
44 cd247eae16ab Peter Maydell:
hw/char/pl011: Use correct masks for IBRD and FBRD
45 f27206ceedbe Marc-André Lureau:
hw/audio/hda: free timer on exit
46 6d6e23361fc7 Marc-André Lureau:
hw/audio/hda: fix memory leak on audio setup
47 244d52ff736f Marc-André Lureau:
ui/dbus: fix leak on message filtering
48 330ef31deb2e Marc-André Lureau:
ui/win32: fix potential use-after-free with dbus shared memory
49 cf5988978129 Marc-André Lureau:
ui/dbus: fix filtering all update messages
(commit(s) marked with * were in previous series and are not resent)
^ permalink raw reply [flat|nested] 20+ messages in thread
* [Stable-9.1.1 33/49] linux-user/flatload: Take mmap_lock in load_flt_binary()
2024-10-16 20:09 [Stable-9.1.1 00/49] Patch Round-up for stable 9.1.1, freeze on 2024-10-16 (frozen) Michael Tokarev
@ 2024-10-16 20:09 ` Michael Tokarev
2024-10-16 20:09 ` [Stable-9.1.1 34/49] linux-user: Fix parse_elf_properties GNU0_MAGIC check Michael Tokarev
` (16 subsequent siblings)
17 siblings, 0 replies; 20+ messages in thread
From: Michael Tokarev @ 2024-10-16 20:09 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-stable, Philippe Mathieu-Daudé, Richard Henderson,
Michael Tokarev
From: Philippe Mathieu-Daudé <philmd@linaro.org>
load_flt_binary() calls load_flat_file() -> page_set_flags().
page_set_flags() must be called with the mmap_lock held,
otherwise it aborts:
$ qemu-arm -L stm32/lib/ stm32/bin/busybox
qemu-arm: ../accel/tcg/user-exec.c:505: page_set_flags: Assertion `have_mmap_lock()' failed.
Aborted (core dumped)
Fix by taking the lock in load_flt_binary().
Fixes: fbd3c4cff6 ("linux-user/arm: Mark the commpage executable")
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2525
Suggested-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20240822095045.72643-3-philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
(cherry picked from commit a9ee641bd46f5462eeed183ac3c3760bddfc2600)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
diff --git a/linux-user/flatload.c b/linux-user/flatload.c
index 04d8138d12..0e4be5bf44 100644
--- a/linux-user/flatload.c
+++ b/linux-user/flatload.c
@@ -487,7 +487,10 @@ int load_flt_binary(struct linux_binprm *bprm, struct image_info *info)
stack_len += (bprm->envc + 1) * 4; /* the envp array */
+ mmap_lock();
res = load_flat_file(bprm, libinfo, 0, &stack_len);
+ mmap_unlock();
+
if (is_error(res)) {
return res;
}
--
2.39.5
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [Stable-9.1.1 34/49] linux-user: Fix parse_elf_properties GNU0_MAGIC check
2024-10-16 20:09 [Stable-9.1.1 00/49] Patch Round-up for stable 9.1.1, freeze on 2024-10-16 (frozen) Michael Tokarev
2024-10-16 20:09 ` [Stable-9.1.1 33/49] linux-user/flatload: Take mmap_lock in load_flt_binary() Michael Tokarev
@ 2024-10-16 20:09 ` Michael Tokarev
2024-10-16 20:09 ` [Stable-9.1.1 35/49] tcg/ppc: Use TCG_REG_TMP2 for scratch tcg_out_qemu_st Michael Tokarev
` (15 subsequent siblings)
17 siblings, 0 replies; 20+ messages in thread
From: Michael Tokarev @ 2024-10-16 20:09 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-stable, Richard Henderson, Philippe Mathieu-Daudé,
Michael Tokarev
From: Richard Henderson <richard.henderson@linaro.org>
Comparing a string of 4 bytes only works in little-endian.
Adjust bulk bswap to only apply to the note payload.
Perform swapping of the note header manually; the magic
is defined so that it does not need a runtime swap.
Fixes: 83f990eb5adb ("linux-user/elfload: Parse NT_GNU_PROPERTY_TYPE_0 notes")
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2596
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
(cherry picked from commit 2884596f5f385b5712c356310dd4125a089888a8)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index b27dd01734..0b1c230b1c 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -3136,11 +3136,11 @@ static bool parse_elf_properties(const ImageSource *src,
}
/*
- * The contents of a valid PT_GNU_PROPERTY is a sequence
- * of uint32_t -- swap them all now.
+ * The contents of a valid PT_GNU_PROPERTY is a sequence of uint32_t.
+ * Swap most of them now, beyond the header and namesz.
*/
#ifdef BSWAP_NEEDED
- for (int i = 0; i < n / 4; i++) {
+ for (int i = 4; i < n / 4; i++) {
bswap32s(note.data + i);
}
#endif
@@ -3150,15 +3150,15 @@ static bool parse_elf_properties(const ImageSource *src,
* immediately follows nhdr and is thus at the 4th word. Further, all
* of the inputs to the kernel's round_up are multiples of 4.
*/
- if (note.nhdr.n_type != NT_GNU_PROPERTY_TYPE_0 ||
- note.nhdr.n_namesz != NOTE_NAME_SZ ||
+ if (tswap32(note.nhdr.n_type) != NT_GNU_PROPERTY_TYPE_0 ||
+ tswap32(note.nhdr.n_namesz) != NOTE_NAME_SZ ||
note.data[3] != GNU0_MAGIC) {
error_setg(errp, "Invalid note in PT_GNU_PROPERTY");
return false;
}
off = sizeof(note.nhdr) + NOTE_NAME_SZ;
- datasz = note.nhdr.n_descsz + off;
+ datasz = tswap32(note.nhdr.n_descsz) + off;
if (datasz > n) {
error_setg(errp, "Invalid note size in PT_GNU_PROPERTY");
return false;
--
2.39.5
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [Stable-9.1.1 35/49] tcg/ppc: Use TCG_REG_TMP2 for scratch tcg_out_qemu_st
2024-10-16 20:09 [Stable-9.1.1 00/49] Patch Round-up for stable 9.1.1, freeze on 2024-10-16 (frozen) Michael Tokarev
2024-10-16 20:09 ` [Stable-9.1.1 33/49] linux-user/flatload: Take mmap_lock in load_flt_binary() Michael Tokarev
2024-10-16 20:09 ` [Stable-9.1.1 34/49] linux-user: Fix parse_elf_properties GNU0_MAGIC check Michael Tokarev
@ 2024-10-16 20:09 ` Michael Tokarev
2024-10-16 20:09 ` [Stable-9.1.1 36/49] tcg/ppc: Use TCG_REG_TMP2 for scratch index in prepare_host_addr Michael Tokarev
` (14 subsequent siblings)
17 siblings, 0 replies; 20+ messages in thread
From: Michael Tokarev @ 2024-10-16 20:09 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-stable, Richard Henderson, Michael Tokarev
From: Richard Henderson <richard.henderson@linaro.org>
In the fallback when STDBRX is not available, avoid clobbering
TCG_REG_TMP1, which might be h.base, which is still in use.
Use TCG_REG_TMP2 instead.
Cc: qemu-stable@nongnu.org
Fixes: 01a112e2e9 ("tcg/ppc: Reorg tcg_out_tlb_read")
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Tested-By: Michael Tokarev <mjt@tls.msk.ru>
(cherry picked from commit 4cabcb89b101942346aebff081aa1453e958fe7f)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
diff --git a/tcg/ppc/tcg-target.c.inc b/tcg/ppc/tcg-target.c.inc
index 3553a47ba9..69abd30bbb 100644
--- a/tcg/ppc/tcg-target.c.inc
+++ b/tcg/ppc/tcg-target.c.inc
@@ -2704,9 +2704,9 @@ static void tcg_out_qemu_st(TCGContext *s, TCGReg datalo, TCGReg datahi,
uint32_t insn = qemu_stx_opc[opc & (MO_BSWAP | MO_SIZE)];
if (!have_isa_2_06 && insn == STDBRX) {
tcg_out32(s, STWBRX | SAB(datalo, h.base, h.index));
- tcg_out32(s, ADDI | TAI(TCG_REG_TMP1, h.index, 4));
+ tcg_out32(s, ADDI | TAI(TCG_REG_TMP2, h.index, 4));
tcg_out_shri64(s, TCG_REG_R0, datalo, 32);
- tcg_out32(s, STWBRX | SAB(TCG_REG_R0, h.base, TCG_REG_TMP1));
+ tcg_out32(s, STWBRX | SAB(TCG_REG_R0, h.base, TCG_REG_TMP2));
} else {
tcg_out32(s, insn | SAB(datalo, h.base, h.index));
}
--
2.39.5
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [Stable-9.1.1 36/49] tcg/ppc: Use TCG_REG_TMP2 for scratch index in prepare_host_addr
2024-10-16 20:09 [Stable-9.1.1 00/49] Patch Round-up for stable 9.1.1, freeze on 2024-10-16 (frozen) Michael Tokarev
` (2 preceding siblings ...)
2024-10-16 20:09 ` [Stable-9.1.1 35/49] tcg/ppc: Use TCG_REG_TMP2 for scratch tcg_out_qemu_st Michael Tokarev
@ 2024-10-16 20:09 ` Michael Tokarev
2024-10-16 20:09 ` [Stable-9.1.1 37/49] target/m68k: Always return a temporary from gen_lea_mode Michael Tokarev
` (13 subsequent siblings)
17 siblings, 0 replies; 20+ messages in thread
From: Michael Tokarev @ 2024-10-16 20:09 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-stable, Richard Henderson, Michael Tokarev
From: Richard Henderson <richard.henderson@linaro.org>
In tcg_out_qemu_ldst_i128, we need a non-zero index register,
which we then use as a base register in several address modes.
Since we always have TCG_REG_TMP2 available, use that.
Cc: qemu-stable@nongnu.org
Fixes: 526cd4ec01f ("tcg/ppc: Support 128-bit load/store")
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2597
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Tested-By: Michael Tokarev <mjt@tls.msk.ru>
(cherry picked from commit 3213da7b9539581c6df95f8ced5b09d0b02d425f)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
diff --git a/tcg/ppc/tcg-target.c.inc b/tcg/ppc/tcg-target.c.inc
index 69abd30bbb..deb80521b3 100644
--- a/tcg/ppc/tcg-target.c.inc
+++ b/tcg/ppc/tcg-target.c.inc
@@ -2617,8 +2617,8 @@ static TCGLabelQemuLdst *prepare_host_addr(TCGContext *s, HostAddress *h,
if (TCG_TARGET_REG_BITS == 64 && addr_type == TCG_TYPE_I32) {
/* Zero-extend the guest address for use in the host address. */
- tcg_out_ext32u(s, TCG_REG_R0, addrlo);
- h->index = TCG_REG_R0;
+ tcg_out_ext32u(s, TCG_REG_TMP2, addrlo);
+ h->index = TCG_REG_TMP2;
} else {
h->index = addrlo;
}
--
2.39.5
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [Stable-9.1.1 37/49] target/m68k: Always return a temporary from gen_lea_mode
2024-10-16 20:09 [Stable-9.1.1 00/49] Patch Round-up for stable 9.1.1, freeze on 2024-10-16 (frozen) Michael Tokarev
` (3 preceding siblings ...)
2024-10-16 20:09 ` [Stable-9.1.1 36/49] tcg/ppc: Use TCG_REG_TMP2 for scratch index in prepare_host_addr Michael Tokarev
@ 2024-10-16 20:09 ` Michael Tokarev
2024-10-16 20:09 ` [Stable-9.1.1 38/49] meson: fix machine option for x86_version Michael Tokarev
` (12 subsequent siblings)
17 siblings, 0 replies; 20+ messages in thread
From: Michael Tokarev @ 2024-10-16 20:09 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-stable, Richard Henderson, Philippe Mathieu-Daudé,
Michael Tokarev
From: Richard Henderson <richard.henderson@linaro.org>
Returning a raw areg does not preserve the value if the areg
is subsequently modified. Fixes, e.g. "jsr (sp)", where the
return address is pushed before the branch.
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2483
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20240813000737.228470-1-richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
(cherry picked from commit 352cc9f300d83ea48b8154bfd2ff985fece887d0)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
diff --git a/target/m68k/translate.c b/target/m68k/translate.c
index 445966fb6a..ad3ce34501 100644
--- a/target/m68k/translate.c
+++ b/target/m68k/translate.c
@@ -720,7 +720,9 @@ static TCGv gen_lea_mode(CPUM68KState *env, DisasContext *s,
}
/* fallthru */
case 2: /* Indirect register */
- return get_areg(s, reg0);
+ tmp = tcg_temp_new();
+ tcg_gen_mov_i32(tmp, get_areg(s, reg0));
+ return tmp;
case 4: /* Indirect predecrememnt. */
if (opsize == OS_UNSIZED) {
return NULL_QREG;
@@ -747,20 +749,23 @@ static TCGv gen_lea_mode(CPUM68KState *env, DisasContext *s,
switch (reg0) {
case 0: /* Absolute short. */
offset = (int16_t)read_im16(env, s);
- return tcg_constant_i32(offset);
+ break;
case 1: /* Absolute long. */
offset = read_im32(env, s);
- return tcg_constant_i32(offset);
+ break;
case 2: /* pc displacement */
offset = s->pc;
offset += (int16_t)read_im16(env, s);
- return tcg_constant_i32(offset);
+ break;
case 3: /* pc index+displacement. */
return gen_lea_indexed(env, s, NULL_QREG);
case 4: /* Immediate. */
default:
return NULL_QREG;
}
+ tmp = tcg_temp_new();
+ tcg_gen_movi_i32(tmp, offset);
+ return tmp;
}
/* Should never happen. */
return NULL_QREG;
--
2.39.5
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [Stable-9.1.1 38/49] meson: fix machine option for x86_version
2024-10-16 20:09 [Stable-9.1.1 00/49] Patch Round-up for stable 9.1.1, freeze on 2024-10-16 (frozen) Michael Tokarev
` (4 preceding siblings ...)
2024-10-16 20:09 ` [Stable-9.1.1 37/49] target/m68k: Always return a temporary from gen_lea_mode Michael Tokarev
@ 2024-10-16 20:09 ` Michael Tokarev
2024-10-16 20:09 ` [Stable-9.1.1 39/49] meson: define qemu_isa_flags Michael Tokarev
` (11 subsequent siblings)
17 siblings, 0 replies; 20+ messages in thread
From: Michael Tokarev @ 2024-10-16 20:09 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-stable, Pierrick Bouvier, Alex Bennée, Michael Tokarev,
Paolo Bonzini
From: Pierrick Bouvier <pierrick.bouvier@linaro.org>
s/mbmi1/mbmi/
When configuring with -Dx86_version >= 3, meson step works, but
compilation fails because option -mbmi1 is unknown.
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Tested-by: Alex Bennée <alex.bennee@linaro.org>
Link: https://lore.kernel.org/r/20241004223715.1275428-1-pierrick.bouvier@linaro.org
Cc: qemu-stable@nongnu.org
Fixes: ef7d1adfa85 ("meson: allow configuring the x86-64 baseline", 2024-06-28)
Revieved-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
(cherry picked from commit 461a9252e249adab5f0bae3b9634be77dd5be17e)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
diff --git a/meson.build b/meson.build
index fbda17c987..6e467cbe7d 100644
--- a/meson.build
+++ b/meson.build
@@ -362,7 +362,7 @@ if host_arch in ['i386', 'x86_64']
qemu_common_flags = cc.get_supported_arguments('-mneeded') + qemu_common_flags
endif
if get_option('x86_version') >= '3'
- qemu_common_flags = ['-mmovbe', '-mabm', '-mbmi1', '-mbmi2', '-mfma', '-mf16c'] + qemu_common_flags
+ qemu_common_flags = ['-mmovbe', '-mabm', '-mbmi', '-mbmi2', '-mfma', '-mf16c'] + qemu_common_flags
endif
# add required vector instruction set (each level implies those below)
--
2.39.5
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [Stable-9.1.1 39/49] meson: define qemu_isa_flags
2024-10-16 20:09 [Stable-9.1.1 00/49] Patch Round-up for stable 9.1.1, freeze on 2024-10-16 (frozen) Michael Tokarev
` (5 preceding siblings ...)
2024-10-16 20:09 ` [Stable-9.1.1 38/49] meson: fix machine option for x86_version Michael Tokarev
@ 2024-10-16 20:09 ` Michael Tokarev
2024-10-16 20:09 ` [Stable-9.1.1 40/49] meson: ensure -mcx16 is passed when detecting ATOMIC128 Michael Tokarev
` (10 subsequent siblings)
17 siblings, 0 replies; 20+ messages in thread
From: Michael Tokarev @ 2024-10-16 20:09 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-stable, Paolo Bonzini, Pierrick Bouvier, Michael Tokarev,
Alex Bennée
From: Paolo Bonzini <pbonzini@redhat.com>
Create a separate variable for compiler flags that enable
specific instruction set extensions, so that they can be used with
cc.compiles/cc.links.
Note that -mfpmath=sse is a code generation option but it does not
enable new instructions, therefore I did not make it part of
qemu_isa_flags.
Suggested-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Tested-by: Alex Bennée <alex.bennee@linaro.org>
Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
(cherry picked from commit 6ae8c5382b2396d394e135c2c6d3742d11c6d0c2)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
diff --git a/meson.build b/meson.build
index 6e467cbe7d..3031f37f45 100644
--- a/meson.build
+++ b/meson.build
@@ -322,6 +322,10 @@ elif host_os == 'windows'
endif
endif
+# Choose instruction set (currently x86-only)
+
+qemu_isa_flags = []
+
# __sync_fetch_and_and requires at least -march=i486. Many toolchains
# use i686 as default anyway, but for those that don't, an explicit
# specification is necessary
@@ -338,7 +342,7 @@ if host_arch == 'i386' and not cc.links('''
sfaa(&val);
return val;
}''')
- qemu_common_flags = ['-march=i486'] + qemu_common_flags
+ qemu_isa_flags += ['-march=i486']
endif
# Pick x86-64 baseline version
@@ -354,29 +358,31 @@ if host_arch in ['i386', 'x86_64']
else
# present on basically all processors but technically not part of
# x86-64-v1, so only include -mneeded for x86-64 version 2 and above
- qemu_common_flags = ['-mcx16'] + qemu_common_flags
+ qemu_isa_flags += ['-mcx16']
endif
endif
if get_option('x86_version') >= '2'
- qemu_common_flags = ['-mpopcnt'] + qemu_common_flags
- qemu_common_flags = cc.get_supported_arguments('-mneeded') + qemu_common_flags
+ qemu_isa_flags += ['-mpopcnt']
+ qemu_isa_flags += cc.get_supported_arguments('-mneeded')
endif
if get_option('x86_version') >= '3'
- qemu_common_flags = ['-mmovbe', '-mabm', '-mbmi', '-mbmi2', '-mfma', '-mf16c'] + qemu_common_flags
+ qemu_isa_flags += ['-mmovbe', '-mabm', '-mbmi', '-mbmi2', '-mfma', '-mf16c']
endif
# add required vector instruction set (each level implies those below)
if get_option('x86_version') == '1'
- qemu_common_flags = ['-msse2'] + qemu_common_flags
+ qemu_isa_flags += ['-msse2']
elif get_option('x86_version') == '2'
- qemu_common_flags = ['-msse4.2'] + qemu_common_flags
+ qemu_isa_flags += ['-msse4.2']
elif get_option('x86_version') == '3'
- qemu_common_flags = ['-mavx2'] + qemu_common_flags
+ qemu_isa_flags += ['-mavx2']
elif get_option('x86_version') == '4'
- qemu_common_flags = ['-mavx512f', '-mavx512bw', '-mavx512cd', '-mavx512dq', '-mavx512vl'] + qemu_common_flags
+ qemu_isa_flags += ['-mavx512f', '-mavx512bw', '-mavx512cd', '-mavx512dq', '-mavx512vl']
endif
endif
+qemu_common_flags = qemu_isa_flags + qemu_common_flags
+
if get_option('prefer_static')
qemu_ldflags += get_option('b_pie') ? '-static-pie' : '-static'
endif
--
2.39.5
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [Stable-9.1.1 40/49] meson: ensure -mcx16 is passed when detecting ATOMIC128
2024-10-16 20:09 [Stable-9.1.1 00/49] Patch Round-up for stable 9.1.1, freeze on 2024-10-16 (frozen) Michael Tokarev
` (6 preceding siblings ...)
2024-10-16 20:09 ` [Stable-9.1.1 39/49] meson: define qemu_isa_flags Michael Tokarev
@ 2024-10-16 20:09 ` Michael Tokarev
2024-10-16 20:10 ` [Stable-9.1.1 41/49] hw/intc/arm_gicv3: Add cast to match the documentation Michael Tokarev
` (9 subsequent siblings)
17 siblings, 0 replies; 20+ messages in thread
From: Michael Tokarev @ 2024-10-16 20:09 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-stable, Paolo Bonzini, Alex Bennée, Michael Tokarev
From: Paolo Bonzini <pbonzini@redhat.com>
Moving -mcx16 out of CPU_CFLAGS caused the detection of ATOMIC128 to
fail, because flags have to be specified by hand in cc.compiles and
cc.links invocations (why oh why??).
Ensure that these tests enable all the instruction set extensions that
will be used to build the emulators.
Fixes: c2bf2ccb266 ("configure: move -mcx16 flag out of CPU_CFLAGS", 2024-05-24)
Reported-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Tested-by: Alex Bennée <alex.bennee@linaro.org>
Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
(cherry picked from commit 8db4e0f92e83fd80b6609439440b303ddded7ad8)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
diff --git a/meson.build b/meson.build
index 3031f37f45..a11018b3ad 100644
--- a/meson.build
+++ b/meson.build
@@ -2795,7 +2795,7 @@ config_host_data.set('CONFIG_ATOMIC64', cc.links('''
__atomic_exchange_n(&x, y, __ATOMIC_RELAXED);
__atomic_fetch_add(&x, y, __ATOMIC_RELAXED);
return 0;
- }'''))
+ }''', args: qemu_isa_flags))
has_int128_type = cc.compiles('''
__int128_t a;
@@ -2829,7 +2829,7 @@ if has_int128_type
__atomic_compare_exchange_n(&p[4], &p[5], p[6], 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED);
return 0;
}'''
- has_atomic128 = cc.links(atomic_test_128)
+ has_atomic128 = cc.links(atomic_test_128, args: qemu_isa_flags)
config_host_data.set('CONFIG_ATOMIC128', has_atomic128)
@@ -2838,7 +2838,8 @@ if has_int128_type
# without optimization enabled. Try again with optimizations locally
# enabled for the function. See
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107389
- has_atomic128_opt = cc.links('__attribute__((optimize("O1")))' + atomic_test_128)
+ has_atomic128_opt = cc.links('__attribute__((optimize("O1")))' + atomic_test_128,
+ args: qemu_isa_flags)
config_host_data.set('CONFIG_ATOMIC128_OPT', has_atomic128_opt)
if not has_atomic128_opt
@@ -2849,7 +2850,7 @@ if has_int128_type
__sync_val_compare_and_swap_16(&x, y, x);
return 0;
}
- '''))
+ ''', args: qemu_isa_flags))
endif
endif
endif
--
2.39.5
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [Stable-9.1.1 41/49] hw/intc/arm_gicv3: Add cast to match the documentation
2024-10-16 20:09 [Stable-9.1.1 00/49] Patch Round-up for stable 9.1.1, freeze on 2024-10-16 (frozen) Michael Tokarev
` (7 preceding siblings ...)
2024-10-16 20:09 ` [Stable-9.1.1 40/49] meson: ensure -mcx16 is passed when detecting ATOMIC128 Michael Tokarev
@ 2024-10-16 20:10 ` Michael Tokarev
2024-10-16 20:10 ` [Stable-9.1.1 42/49] " Michael Tokarev
` (8 subsequent siblings)
17 siblings, 0 replies; 20+ messages in thread
From: Michael Tokarev @ 2024-10-16 20:10 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-stable, Alexandra Diupina, Peter Maydell, Michael Tokarev
From: Alexandra Diupina <adiupina@astralinux.ru>
The result of 1 << regbit with regbit==31 has a 1 in the 32nd bit.
When cast to uint64_t (for further bitwise OR), the 32 most
significant bits will be filled with 1s. However, the documentation
states that the upper 32 bits of ICH_AP[0/1]R<n>_EL2 are reserved.
Add an explicit cast to match the documentation.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Cc: qemu-stable@nongnu.org
Fixes: d2c0c6aab6 ("hw/intc/arm_gicv3: Handle icv_nmiar1_read() for icc_nmiar1_read()")
Signed-off-by: Alexandra Diupina <adiupina@astralinux.ru>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
(cherry picked from commit e0c0ea6eca4f210a52b9742817586cc97b1ee434)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
diff --git a/hw/intc/arm_gicv3_cpuif.c b/hw/intc/arm_gicv3_cpuif.c
index bdb13b00e9..ebad7aaea1 100644
--- a/hw/intc/arm_gicv3_cpuif.c
+++ b/hw/intc/arm_gicv3_cpuif.c
@@ -781,7 +781,7 @@ static void icv_activate_irq(GICv3CPUState *cs, int idx, int grp)
if (nmi) {
cs->ich_apr[grp][regno] |= ICV_AP1R_EL1_NMI;
} else {
- cs->ich_apr[grp][regno] |= (1 << regbit);
+ cs->ich_apr[grp][regno] |= (1U << regbit);
}
}
--
2.39.5
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [Stable-9.1.1 42/49] hw/intc/arm_gicv3: Add cast to match the documentation
2024-10-16 20:09 [Stable-9.1.1 00/49] Patch Round-up for stable 9.1.1, freeze on 2024-10-16 (frozen) Michael Tokarev
` (8 preceding siblings ...)
2024-10-16 20:10 ` [Stable-9.1.1 41/49] hw/intc/arm_gicv3: Add cast to match the documentation Michael Tokarev
@ 2024-10-16 20:10 ` Michael Tokarev
2024-10-16 20:10 ` [Stable-9.1.1 43/49] hw/intc/arm_gicv3_cpuif: " Michael Tokarev
` (7 subsequent siblings)
17 siblings, 0 replies; 20+ messages in thread
From: Michael Tokarev @ 2024-10-16 20:10 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-stable, Alexandra Diupina, Peter Maydell, Michael Tokarev
From: Alexandra Diupina <adiupina@astralinux.ru>
The result of 1 << regbit with regbit==31 has a 1 in the 32nd bit.
When cast to uint64_t (for further bitwise OR), the 32 most
significant bits will be filled with 1s. However, the documentation
states that the upper 32 bits of ICC_AP[0/1]R<n>_EL2 are reserved.
Add an explicit cast to match the documentation.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Cc: qemu-stable@nongnu.org
Fixes: 28cca59c46 ("hw/intc/arm_gicv3: Add NMI handling CPU interface registers")
Signed-off-by: Alexandra Diupina <adiupina@astralinux.ru>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
(cherry picked from commit 12dc8f6eca1ead876142fd3d6731cf3da1295f2a)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
diff --git a/hw/intc/arm_gicv3_cpuif.c b/hw/intc/arm_gicv3_cpuif.c
index ebad7aaea1..89359db700 100644
--- a/hw/intc/arm_gicv3_cpuif.c
+++ b/hw/intc/arm_gicv3_cpuif.c
@@ -1170,7 +1170,7 @@ static void icc_activate_irq(GICv3CPUState *cs, int irq)
if (nmi) {
cs->icc_apr[cs->hppi.grp][regno] |= ICC_AP1R_EL1_NMI;
} else {
- cs->icc_apr[cs->hppi.grp][regno] |= (1 << regbit);
+ cs->icc_apr[cs->hppi.grp][regno] |= (1U << regbit);
}
if (irq < GIC_INTERNAL) {
--
2.39.5
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [Stable-9.1.1 43/49] hw/intc/arm_gicv3_cpuif: Add cast to match the documentation
2024-10-16 20:09 [Stable-9.1.1 00/49] Patch Round-up for stable 9.1.1, freeze on 2024-10-16 (frozen) Michael Tokarev
` (9 preceding siblings ...)
2024-10-16 20:10 ` [Stable-9.1.1 42/49] " Michael Tokarev
@ 2024-10-16 20:10 ` Michael Tokarev
2024-10-16 20:10 ` [Stable-9.1.1 44/49] hw/char/pl011: Use correct masks for IBRD and FBRD Michael Tokarev
` (6 subsequent siblings)
17 siblings, 0 replies; 20+ messages in thread
From: Michael Tokarev @ 2024-10-16 20:10 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-stable, Alexandra Diupina, Peter Maydell, Michael Tokarev
From: Alexandra Diupina <adiupina@astralinux.ru>
The result of 1 << regbit with regbit==31 has a 1 in the 32nd bit.
When cast to uint64_t (for further bitwise OR), the 32 most
significant bits will be filled with 1s. However, the documentation
states that the upper 32 bits of ICH_AP[0/1]R<n>_EL2 are reserved.
Add an explicit cast to match the documentation.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Cc: qemu-stable@nongnu.org
Fixes: c3f21b065a ("hw/intc/arm_gicv3_cpuif: Support vLPIs")
Signed-off-by: Alexandra Diupina <adiupina@astralinux.ru>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
(cherry picked from commit 3db74afec3ca87f81fbdf5918ed1e21d837fbfab)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
diff --git a/hw/intc/arm_gicv3_cpuif.c b/hw/intc/arm_gicv3_cpuif.c
index 89359db700..ea1d1b3455 100644
--- a/hw/intc/arm_gicv3_cpuif.c
+++ b/hw/intc/arm_gicv3_cpuif.c
@@ -793,7 +793,7 @@ static void icv_activate_vlpi(GICv3CPUState *cs)
int regno = aprbit / 32;
int regbit = aprbit % 32;
- cs->ich_apr[cs->hppvlpi.grp][regno] |= (1 << regbit);
+ cs->ich_apr[cs->hppvlpi.grp][regno] |= (1U << regbit);
gicv3_redist_vlpi_pending(cs, cs->hppvlpi.irq, 0);
}
--
2.39.5
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [Stable-9.1.1 44/49] hw/char/pl011: Use correct masks for IBRD and FBRD
2024-10-16 20:09 [Stable-9.1.1 00/49] Patch Round-up for stable 9.1.1, freeze on 2024-10-16 (frozen) Michael Tokarev
` (10 preceding siblings ...)
2024-10-16 20:10 ` [Stable-9.1.1 43/49] hw/intc/arm_gicv3_cpuif: " Michael Tokarev
@ 2024-10-16 20:10 ` Michael Tokarev
2024-10-16 20:10 ` [Stable-9.1.1 45/49] hw/audio/hda: free timer on exit Michael Tokarev
` (5 subsequent siblings)
17 siblings, 0 replies; 20+ messages in thread
From: Michael Tokarev @ 2024-10-16 20:10 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-stable, Peter Maydell, Alex Bennée,
Philippe Mathieu-Daudé, Gavin Shan, Michael Tokarev
From: Peter Maydell <peter.maydell@linaro.org>
In commit b88cfee90268cad we defined masks for the IBRD and FBRD
integer and fractional baud rate divider registers, to prevent the
guest from writing invalid values which could cause division-by-zero.
Unfortunately we got the mask values the wrong way around: the FBRD
register is six bits and the IBRD register is 16 bits, not
vice-versa.
You would only run into this bug if you programmed the UART to a baud
rate of less than 9600, because for 9600 baud and above the IBRD
value will fit into 6 bits, as per the table in
https://developer.arm.com/documentation/ddi0183/g/programmers-model/register-descriptions/fractional-baud-rate-register--uartfbrd
The only visible effects would be that the value read back from
the register by the guest would be truncated, and we would
print an incorrect baud rate in the debug logs.
Cc: qemu-stable@nongnu.org
Fixes: b88cfee90268 ("hw/char/pl011: Avoid division-by-zero in pl011_get_baudrate()")
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2610
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Gavin Shan <gshan@redhat.com>
Message-id: 20241007144732.2491331-1-peter.maydell@linaro.org
(cherry picked from commit cd247eae16ab1b9ce97fd34c000c1b883feeda45)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
diff --git a/hw/char/pl011.c b/hw/char/pl011.c
index f8078aa216..949e9d0e0d 100644
--- a/hw/char/pl011.c
+++ b/hw/char/pl011.c
@@ -88,10 +88,10 @@ DeviceState *pl011_create(hwaddr addr, qemu_irq irq, Chardev *chr)
#define CR_LBE (1 << 7)
/* Integer Baud Rate Divider, UARTIBRD */
-#define IBRD_MASK 0x3f
+#define IBRD_MASK 0xffff
/* Fractional Baud Rate Divider, UARTFBRD */
-#define FBRD_MASK 0xffff
+#define FBRD_MASK 0x3f
static const unsigned char pl011_id_arm[8] =
{ 0x11, 0x10, 0x14, 0x00, 0x0d, 0xf0, 0x05, 0xb1 };
--
2.39.5
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [Stable-9.1.1 45/49] hw/audio/hda: free timer on exit
2024-10-16 20:09 [Stable-9.1.1 00/49] Patch Round-up for stable 9.1.1, freeze on 2024-10-16 (frozen) Michael Tokarev
` (11 preceding siblings ...)
2024-10-16 20:10 ` [Stable-9.1.1 44/49] hw/char/pl011: Use correct masks for IBRD and FBRD Michael Tokarev
@ 2024-10-16 20:10 ` Michael Tokarev
2024-10-16 20:10 ` [Stable-9.1.1 46/49] hw/audio/hda: fix memory leak on audio setup Michael Tokarev
` (4 subsequent siblings)
17 siblings, 0 replies; 20+ messages in thread
From: Michael Tokarev @ 2024-10-16 20:10 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-stable, Marc-André Lureau, Akihiko Odaki,
Michael Tokarev
From: Marc-André Lureau <marcandre.lureau@redhat.com>
Fixes: 280c1e1cd ("audio/hda: create millisecond timers that handle IO")
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Message-ID: <20241008125028.1177932-2-marcandre.lureau@redhat.com>
(cherry picked from commit f27206ceedbe2efae37c8d143c5eb2db05251508)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
diff --git a/hw/audio/hda-codec.c b/hw/audio/hda-codec.c
index b22e486fda..ee3d0a7dec 100644
--- a/hw/audio/hda-codec.c
+++ b/hw/audio/hda-codec.c
@@ -751,7 +751,7 @@ static void hda_audio_exit(HDACodecDevice *hda)
continue;
}
if (a->use_timer) {
- timer_del(st->buft);
+ timer_free(st->buft);
}
if (st->output) {
AUD_close_out(&a->card, st->voice.out);
--
2.39.5
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [Stable-9.1.1 46/49] hw/audio/hda: fix memory leak on audio setup
2024-10-16 20:09 [Stable-9.1.1 00/49] Patch Round-up for stable 9.1.1, freeze on 2024-10-16 (frozen) Michael Tokarev
` (12 preceding siblings ...)
2024-10-16 20:10 ` [Stable-9.1.1 45/49] hw/audio/hda: free timer on exit Michael Tokarev
@ 2024-10-16 20:10 ` Michael Tokarev
2024-10-16 20:10 ` [Stable-9.1.1 47/49] ui/dbus: fix leak on message filtering Michael Tokarev
` (3 subsequent siblings)
17 siblings, 0 replies; 20+ messages in thread
From: Michael Tokarev @ 2024-10-16 20:10 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-stable, Marc-André Lureau, Akihiko Odaki,
Michael Tokarev
From: Marc-André Lureau <marcandre.lureau@redhat.com>
When SET_STREAM_FORMAT is called, we should clear the existing setup.
Factor out common function to close a stream.
Direct leak of 144 byte(s) in 3 object(s) allocated from:
#0 0x7f91d38f7350 in calloc (/lib64/libasan.so.8+0xf7350) (BuildId: a4ad7eb954b390cf00f07fa10952988a41d9fc7a)
#1 0x7f91d2ab7871 in g_malloc0 (/lib64/libglib-2.0.so.0+0x64871) (BuildId: 36b60dbd02e796145a982d0151ce37202ec05649)
#2 0x562fa2f447ee in timer_new_full /home/elmarco/src/qemu/include/qemu/timer.h:538
#3 0x562fa2f4486f in timer_new /home/elmarco/src/qemu/include/qemu/timer.h:559
#4 0x562fa2f448a9 in timer_new_ns /home/elmarco/src/qemu/include/qemu/timer.h:577
#5 0x562fa2f47955 in hda_audio_setup ../hw/audio/hda-codec.c:490
#6 0x562fa2f4897e in hda_audio_command ../hw/audio/hda-codec.c:605
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Message-ID: <20241008125028.1177932-3-marcandre.lureau@redhat.com>
(cherry picked from commit 6d6e23361fc732e4fe36a8bc5873b85f264ed53a)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
diff --git a/hw/audio/hda-codec.c b/hw/audio/hda-codec.c
index ee3d0a7dec..4373565371 100644
--- a/hw/audio/hda-codec.c
+++ b/hw/audio/hda-codec.c
@@ -472,6 +472,24 @@ static void hda_audio_set_amp(HDAAudioStream *st)
}
}
+static void hda_close_stream(HDAAudioState *a, HDAAudioStream *st)
+{
+ if (st->node == NULL) {
+ return;
+ }
+ if (a->use_timer) {
+ timer_free(st->buft);
+ st->buft = NULL;
+ }
+ if (st->output) {
+ AUD_close_out(&a->card, st->voice.out);
+ st->voice.out = NULL;
+ } else {
+ AUD_close_in(&a->card, st->voice.in);
+ st->voice.in = NULL;
+ }
+}
+
static void hda_audio_setup(HDAAudioStream *st)
{
bool use_timer = st->state->use_timer;
@@ -484,6 +502,7 @@ static void hda_audio_setup(HDAAudioStream *st)
trace_hda_audio_format(st->node->name, st->as.nchannels,
fmt2name[st->as.fmt], st->as.freq);
+ hda_close_stream(st->state, st);
if (st->output) {
if (use_timer) {
cb = hda_audio_output_cb;
@@ -741,23 +760,11 @@ static void hda_audio_init(HDACodecDevice *hda,
static void hda_audio_exit(HDACodecDevice *hda)
{
HDAAudioState *a = HDA_AUDIO(hda);
- HDAAudioStream *st;
int i;
dprint(a, 1, "%s\n", __func__);
for (i = 0; i < ARRAY_SIZE(a->st); i++) {
- st = a->st + i;
- if (st->node == NULL) {
- continue;
- }
- if (a->use_timer) {
- timer_free(st->buft);
- }
- if (st->output) {
- AUD_close_out(&a->card, st->voice.out);
- } else {
- AUD_close_in(&a->card, st->voice.in);
- }
+ hda_close_stream(a, a->st + i);
}
AUD_remove_card(&a->card);
}
--
2.39.5
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [Stable-9.1.1 47/49] ui/dbus: fix leak on message filtering
2024-10-16 20:09 [Stable-9.1.1 00/49] Patch Round-up for stable 9.1.1, freeze on 2024-10-16 (frozen) Michael Tokarev
` (13 preceding siblings ...)
2024-10-16 20:10 ` [Stable-9.1.1 46/49] hw/audio/hda: fix memory leak on audio setup Michael Tokarev
@ 2024-10-16 20:10 ` Michael Tokarev
2024-10-16 20:10 ` [Stable-9.1.1 48/49] ui/win32: fix potential use-after-free with dbus shared memory Michael Tokarev
` (2 subsequent siblings)
17 siblings, 0 replies; 20+ messages in thread
From: Michael Tokarev @ 2024-10-16 20:10 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-stable, Marc-André Lureau, Akihiko Odaki,
Michael Tokarev
From: Marc-André Lureau <marcandre.lureau@redhat.com>
A filter function that wants to drop a message should return NULL, in
which case it must also unref the message itself.
Fixes: fa88b85de ("ui/dbus: filter out pending messages when scanout")
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Message-ID: <20241008125028.1177932-4-marcandre.lureau@redhat.com>
(cherry picked from commit 244d52ff736fefc3dd364ed091720aa896af306d)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
diff --git a/ui/dbus-listener.c b/ui/dbus-listener.c
index a54123acea..434bd608f2 100644
--- a/ui/dbus-listener.c
+++ b/ui/dbus-listener.c
@@ -1001,6 +1001,7 @@ dbus_filter(GDBusConnection *connection,
serial = g_dbus_message_get_serial(message);
if (serial <= ddl->out_serial_to_discard) {
trace_dbus_filter(serial, ddl->out_serial_to_discard);
+ g_object_unref(message);
return NULL;
}
--
2.39.5
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [Stable-9.1.1 48/49] ui/win32: fix potential use-after-free with dbus shared memory
2024-10-16 20:09 [Stable-9.1.1 00/49] Patch Round-up for stable 9.1.1, freeze on 2024-10-16 (frozen) Michael Tokarev
` (14 preceding siblings ...)
2024-10-16 20:10 ` [Stable-9.1.1 47/49] ui/dbus: fix leak on message filtering Michael Tokarev
@ 2024-10-16 20:10 ` Michael Tokarev
2024-10-16 20:10 ` [Stable-9.1.1 49/49] ui/dbus: fix filtering all update messages Michael Tokarev
2024-10-17 17:47 ` [Stable-9.1.1 00/49] Patch Round-up for stable 9.1.1, freeze on 2024-10-16 (frozen) Paolo Bonzini
17 siblings, 0 replies; 20+ messages in thread
From: Michael Tokarev @ 2024-10-16 20:10 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-stable, Marc-André Lureau, Akihiko Odaki,
Michael Tokarev
From: Marc-André Lureau <marcandre.lureau@redhat.com>
DisplaySurface may be free before the pixman image is freed, since the
image is refcounted and used by different objects, including pending
dbus messages.
Furthermore, setting the destroy function in
create_displaysurface_from() isn't appropriate, as it may not be used,
and may be overriden as in ramfb.
Set the destroy function when the shared handle is set, use the HANDLE
directly for destroy data, using a single common helper
qemu_pixman_win32_image_destroy().
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Message-ID: <20241008125028.1177932-5-marcandre.lureau@redhat.com>
(cherry picked from commit 330ef31deb2e5461cff907488b710f5bd9cd2327)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c
index 3281842bfe..017a0f170c 100644
--- a/hw/display/virtio-gpu.c
+++ b/hw/display/virtio-gpu.c
@@ -238,16 +238,6 @@ static uint32_t calc_image_hostmem(pixman_format_code_t pformat,
return height * stride;
}
-#ifdef WIN32
-static void
-win32_pixman_image_destroy(pixman_image_t *image, void *data)
-{
- HANDLE handle = data;
-
- qemu_win32_map_free(pixman_image_get_data(image), handle, &error_warn);
-}
-#endif
-
static void virtio_gpu_resource_create_2d(VirtIOGPU *g,
struct virtio_gpu_ctrl_command *cmd)
{
@@ -308,7 +298,7 @@ static void virtio_gpu_resource_create_2d(VirtIOGPU *g,
bits, c2d.height ? res->hostmem / c2d.height : 0);
#ifdef WIN32
if (res->image) {
- pixman_image_set_destroy_function(res->image, win32_pixman_image_destroy, res->handle);
+ pixman_image_set_destroy_function(res->image, qemu_pixman_win32_image_destroy, res->handle);
}
#endif
}
@@ -1327,7 +1317,7 @@ static int virtio_gpu_load(QEMUFile *f, void *opaque, size_t size,
return -EINVAL;
}
#ifdef WIN32
- pixman_image_set_destroy_function(res->image, win32_pixman_image_destroy, res->handle);
+ pixman_image_set_destroy_function(res->image, qemu_pixman_win32_image_destroy, res->handle);
#endif
res->addrs = g_new(uint64_t, res->iov_cnt);
diff --git a/include/ui/qemu-pixman.h b/include/ui/qemu-pixman.h
index ef13a8210c..e3dd72b9e3 100644
--- a/include/ui/qemu-pixman.h
+++ b/include/ui/qemu-pixman.h
@@ -97,6 +97,8 @@ void qemu_pixman_glyph_render(pixman_image_t *glyph,
void qemu_pixman_image_unref(pixman_image_t *image);
+void qemu_pixman_win32_image_destroy(pixman_image_t *image, void *data);
+
G_DEFINE_AUTOPTR_CLEANUP_FUNC(pixman_image_t, qemu_pixman_image_unref)
#endif /* QEMU_PIXMAN_H */
diff --git a/ui/console.c b/ui/console.c
index 105a0e2c70..8f416ff0b9 100644
--- a/ui/console.c
+++ b/ui/console.c
@@ -461,24 +461,6 @@ void qemu_displaysurface_win32_set_handle(DisplaySurface *surface,
surface->handle = h;
surface->handle_offset = offset;
}
-
-static void
-win32_pixman_image_destroy(pixman_image_t *image, void *data)
-{
- DisplaySurface *surface = data;
-
- if (!surface->handle) {
- return;
- }
-
- assert(surface->handle_offset == 0);
-
- qemu_win32_map_free(
- pixman_image_get_data(surface->image),
- surface->handle,
- &error_warn
- );
-}
#endif
DisplaySurface *qemu_create_displaysurface(int width, int height)
@@ -504,6 +486,8 @@ DisplaySurface *qemu_create_displaysurface(int width, int height)
#ifdef WIN32
qemu_displaysurface_win32_set_handle(surface, handle, 0);
+ pixman_image_set_destroy_function(surface->image,
+ qemu_pixman_win32_image_destroy, handle);
#endif
return surface;
}
@@ -519,10 +503,6 @@ DisplaySurface *qemu_create_displaysurface_from(int width, int height,
width, height,
(void *)data, linesize);
assert(surface->image != NULL);
-#ifdef WIN32
- pixman_image_set_destroy_function(surface->image,
- win32_pixman_image_destroy, surface);
-#endif
return surface;
}
diff --git a/ui/qemu-pixman.c b/ui/qemu-pixman.c
index 5ca55dd199..de6c88151c 100644
--- a/ui/qemu-pixman.c
+++ b/ui/qemu-pixman.c
@@ -4,6 +4,7 @@
*/
#include "qemu/osdep.h"
+#include "qapi/error.h"
#include "ui/console.h"
#include "standard-headers/drm/drm_fourcc.h"
#include "trace.h"
@@ -268,3 +269,17 @@ void qemu_pixman_glyph_render(pixman_image_t *glyph,
pixman_image_unref(ibg);
}
#endif /* CONFIG_PIXMAN */
+
+#ifdef WIN32
+void
+qemu_pixman_win32_image_destroy(pixman_image_t *image, void *data)
+{
+ HANDLE handle = data;
+
+ qemu_win32_map_free(
+ pixman_image_get_data(image),
+ handle,
+ &error_warn
+ );
+}
+#endif
--
2.39.5
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [Stable-9.1.1 49/49] ui/dbus: fix filtering all update messages
2024-10-16 20:09 [Stable-9.1.1 00/49] Patch Round-up for stable 9.1.1, freeze on 2024-10-16 (frozen) Michael Tokarev
` (15 preceding siblings ...)
2024-10-16 20:10 ` [Stable-9.1.1 48/49] ui/win32: fix potential use-after-free with dbus shared memory Michael Tokarev
@ 2024-10-16 20:10 ` Michael Tokarev
2024-10-17 17:47 ` [Stable-9.1.1 00/49] Patch Round-up for stable 9.1.1, freeze on 2024-10-16 (frozen) Paolo Bonzini
17 siblings, 0 replies; 20+ messages in thread
From: Michael Tokarev @ 2024-10-16 20:10 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-stable, Marc-André Lureau, Akihiko Odaki,
Michael Tokarev
From: Marc-André Lureau <marcandre.lureau@redhat.com>
Filtering pending messages when a new scanout is given shouldn't discard
pending cursor changes, for example.
Since filtering happens in a different thread, use atomic set/get.
Fixes: fa88b85dea ("ui/dbus: filter out pending messages when scanout")
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Message-ID: <20241008125028.1177932-6-marcandre.lureau@redhat.com>
(cherry picked from commit cf59889781297a5618f1735a5f31402caa806b42)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
diff --git a/ui/dbus-listener.c b/ui/dbus-listener.c
index 434bd608f2..c69afc05a8 100644
--- a/ui/dbus-listener.c
+++ b/ui/dbus-listener.c
@@ -26,6 +26,7 @@
#include "qapi/error.h"
#include "sysemu/sysemu.h"
#include "dbus.h"
+#include "glib.h"
#ifdef G_OS_UNIX
#include <gio/gunixfdlist.h>
#endif
@@ -85,7 +86,7 @@ struct _DBusDisplayListener {
#endif
guint dbus_filter;
- guint32 out_serial_to_discard;
+ guint32 display_serial_to_discard;
};
G_DEFINE_TYPE(DBusDisplayListener, dbus_display_listener, G_TYPE_OBJECT)
@@ -93,10 +94,12 @@ G_DEFINE_TYPE(DBusDisplayListener, dbus_display_listener, G_TYPE_OBJECT)
static void dbus_gfx_update(DisplayChangeListener *dcl,
int x, int y, int w, int h);
-static void ddl_discard_pending_messages(DBusDisplayListener *ddl)
+static void ddl_discard_display_messages(DBusDisplayListener *ddl)
{
- ddl->out_serial_to_discard = g_dbus_connection_get_last_serial(
+ guint32 serial = g_dbus_connection_get_last_serial(
g_dbus_proxy_get_connection(G_DBUS_PROXY(ddl->proxy)));
+
+ g_atomic_int_set(&ddl->display_serial_to_discard, serial);
}
#ifdef CONFIG_OPENGL
@@ -290,7 +293,7 @@ static void dbus_scanout_dmabuf(DisplayChangeListener *dcl,
return;
}
- ddl_discard_pending_messages(ddl);
+ ddl_discard_display_messages(ddl);
width = qemu_dmabuf_get_width(dmabuf);
height = qemu_dmabuf_get_height(dmabuf);
@@ -338,7 +341,7 @@ static bool dbus_scanout_map(DBusDisplayListener *ddl)
return false;
}
- ddl_discard_pending_messages(ddl);
+ ddl_discard_display_messages(ddl);
if (!qemu_dbus_display1_listener_win32_map_call_scanout_map_sync(
ddl->map_proxy,
@@ -401,7 +404,7 @@ dbus_scanout_share_d3d_texture(
return false;
}
- ddl_discard_pending_messages(ddl);
+ ddl_discard_display_messages(ddl);
qemu_dbus_display1_listener_win32_d3d11_call_scanout_texture2d(
ddl->d3d11_proxy,
@@ -659,7 +662,7 @@ static void ddl_scanout(DBusDisplayListener *ddl)
surface_stride(ddl->ds) * surface_height(ddl->ds), TRUE,
(GDestroyNotify)pixman_image_unref, pixman_image_ref(ddl->ds->image));
- ddl_discard_pending_messages(ddl);
+ ddl_discard_display_messages(ddl);
qemu_dbus_display1_listener_call_scanout(
ddl->proxy, surface_width(ddl->ds), surface_height(ddl->ds),
@@ -992,17 +995,35 @@ dbus_filter(GDBusConnection *connection,
gpointer user_data)
{
DBusDisplayListener *ddl = DBUS_DISPLAY_LISTENER(user_data);
- guint32 serial;
+ guint32 serial, discard_serial;
if (incoming) {
return message;
}
serial = g_dbus_message_get_serial(message);
- if (serial <= ddl->out_serial_to_discard) {
- trace_dbus_filter(serial, ddl->out_serial_to_discard);
- g_object_unref(message);
- return NULL;
+
+ discard_serial = g_atomic_int_get(&ddl->display_serial_to_discard);
+ if (serial <= discard_serial) {
+ const char *member = g_dbus_message_get_member(message);
+ static const char *const display_messages[] = {
+ "Scanout",
+ "Update",
+#ifdef CONFIG_GBM
+ "ScanoutDMABUF",
+ "UpdateDMABUF",
+#endif
+ "ScanoutMap",
+ "UpdateMap",
+ "Disable",
+ NULL,
+ };
+
+ if (g_strv_contains(display_messages, member)) {
+ trace_dbus_filter(serial, discard_serial);
+ g_object_unref(message);
+ return NULL;
+ }
}
return message;
--
2.39.5
^ permalink raw reply related [flat|nested] 20+ messages in thread
* Re: [Stable-9.1.1 00/49] Patch Round-up for stable 9.1.1, freeze on 2024-10-16 (frozen)
2024-10-16 20:09 [Stable-9.1.1 00/49] Patch Round-up for stable 9.1.1, freeze on 2024-10-16 (frozen) Michael Tokarev
` (16 preceding siblings ...)
2024-10-16 20:10 ` [Stable-9.1.1 49/49] ui/dbus: fix filtering all update messages Michael Tokarev
@ 2024-10-17 17:47 ` Paolo Bonzini
2024-10-17 19:32 ` Michael Tokarev
17 siblings, 1 reply; 20+ messages in thread
From: Paolo Bonzini @ 2024-10-17 17:47 UTC (permalink / raw)
To: Michael Tokarev, qemu-devel; +Cc: qemu-stable
On 10/16/24 22:09, Michael Tokarev wrote:
> The following patches are queued for QEMU stable v9.1.1:
>
> https://gitlab.com/qemu-project/qemu/-/commits/staging-9.1
>
> Patch freeze is 2024-10-16 (frozen), and the release is planned for 2024-10-18:
>
> https://wiki.qemu.org/Planning/9.1
>
> Please respond here or CC qemu-stable@nongnu.org on any additional patches
> you think should (or shouldn't) be included in the release.
>
> The changes which are staging for inclusion, with the original commit hash
> from master branch, are given below the bottom line.
My next pull request includes a few more:
https://gitlab.com/bonzini/qemu/-/commit/15d955975bd484c2c66af0d6daaa02a7d04d2256.patch
https://gitlab.com/bonzini/qemu/-/commit/64e0e63ea16aa0122dc0c41a0679da0ae4616208.patch
https://gitlab.com/bonzini/qemu/-/commit/615586cb356811e46c2e5f85c36db4b93f8381cd.patch
Thanks,
Paolo
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [Stable-9.1.1 00/49] Patch Round-up for stable 9.1.1, freeze on 2024-10-16 (frozen)
2024-10-17 17:47 ` [Stable-9.1.1 00/49] Patch Round-up for stable 9.1.1, freeze on 2024-10-16 (frozen) Paolo Bonzini
@ 2024-10-17 19:32 ` Michael Tokarev
0 siblings, 0 replies; 20+ messages in thread
From: Michael Tokarev @ 2024-10-17 19:32 UTC (permalink / raw)
To: Paolo Bonzini, qemu-devel; +Cc: qemu-stable
On 17.10.2024 20:47, Paolo Bonzini wrote:
> My next pull request includes a few more:
>
> https://gitlab.com/bonzini/qemu/-/commit/15d955975bd484c2c66af0d6daaa02a7d04d2256.patch
> https://gitlab.com/bonzini/qemu/-/commit/64e0e63ea16aa0122dc0c41a0679da0ae4616208.patch
> https://gitlab.com/bonzini/qemu/-/commit/615586cb356811e46c2e5f85c36db4b93f8381cd.patch
yeah, I noted them already, either earlier or due to Cc: qemu-stable.
These will be in the next release though since they missed the freeze
date (Oct-16).
I also note the wording in my cover letter for the series should be
changed a bit, so it is clear the other possible patches will only
be considered for the next stable release.
Thank you for letting me know, that's the most important part anyway!
/mjt
^ permalink raw reply [flat|nested] 20+ messages in thread
end of thread, other threads:[~2024-10-17 19:33 UTC | newest]
Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-16 20:09 [Stable-9.1.1 00/49] Patch Round-up for stable 9.1.1, freeze on 2024-10-16 (frozen) Michael Tokarev
2024-10-16 20:09 ` [Stable-9.1.1 33/49] linux-user/flatload: Take mmap_lock in load_flt_binary() Michael Tokarev
2024-10-16 20:09 ` [Stable-9.1.1 34/49] linux-user: Fix parse_elf_properties GNU0_MAGIC check Michael Tokarev
2024-10-16 20:09 ` [Stable-9.1.1 35/49] tcg/ppc: Use TCG_REG_TMP2 for scratch tcg_out_qemu_st Michael Tokarev
2024-10-16 20:09 ` [Stable-9.1.1 36/49] tcg/ppc: Use TCG_REG_TMP2 for scratch index in prepare_host_addr Michael Tokarev
2024-10-16 20:09 ` [Stable-9.1.1 37/49] target/m68k: Always return a temporary from gen_lea_mode Michael Tokarev
2024-10-16 20:09 ` [Stable-9.1.1 38/49] meson: fix machine option for x86_version Michael Tokarev
2024-10-16 20:09 ` [Stable-9.1.1 39/49] meson: define qemu_isa_flags Michael Tokarev
2024-10-16 20:09 ` [Stable-9.1.1 40/49] meson: ensure -mcx16 is passed when detecting ATOMIC128 Michael Tokarev
2024-10-16 20:10 ` [Stable-9.1.1 41/49] hw/intc/arm_gicv3: Add cast to match the documentation Michael Tokarev
2024-10-16 20:10 ` [Stable-9.1.1 42/49] " Michael Tokarev
2024-10-16 20:10 ` [Stable-9.1.1 43/49] hw/intc/arm_gicv3_cpuif: " Michael Tokarev
2024-10-16 20:10 ` [Stable-9.1.1 44/49] hw/char/pl011: Use correct masks for IBRD and FBRD Michael Tokarev
2024-10-16 20:10 ` [Stable-9.1.1 45/49] hw/audio/hda: free timer on exit Michael Tokarev
2024-10-16 20:10 ` [Stable-9.1.1 46/49] hw/audio/hda: fix memory leak on audio setup Michael Tokarev
2024-10-16 20:10 ` [Stable-9.1.1 47/49] ui/dbus: fix leak on message filtering Michael Tokarev
2024-10-16 20:10 ` [Stable-9.1.1 48/49] ui/win32: fix potential use-after-free with dbus shared memory Michael Tokarev
2024-10-16 20:10 ` [Stable-9.1.1 49/49] ui/dbus: fix filtering all update messages Michael Tokarev
2024-10-17 17:47 ` [Stable-9.1.1 00/49] Patch Round-up for stable 9.1.1, freeze on 2024-10-16 (frozen) Paolo Bonzini
2024-10-17 19:32 ` Michael Tokarev
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).