[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Stable-8.1.3 51/55] target/s390x: Fix CLC corrupting cc_src
From: |
Michael Tokarev |
Subject: |
[Stable-8.1.3 51/55] target/s390x: Fix CLC corrupting cc_src |
Date: |
Thu, 9 Nov 2023 16:42:55 +0300 |
From: Ilya Leoshkevich <iii@linux.ibm.com>
CLC updates cc_src before accessing the second operand; if the latter
is inaccessible, the former ends up containing a bogus value.
Fix by reading cc_src into a temporary first.
Fixes: 4f7403d52b1c ("target-s390: Convert CLC")
Closes: https://gitlab.com/qemu-project/qemu/-/issues/1865
Cc: qemu-stable@nongnu.org
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Message-ID: <20231106093605.1349201-2-iii@linux.ibm.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
(cherry picked from commit aba2ec341c6d20c8dc3e6ecf87fa7c1a71e30c1e)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
diff --git a/target/s390x/tcg/translate.c b/target/s390x/tcg/translate.c
index dc7041e1d8..97ab1b3daa 100644
--- a/target/s390x/tcg/translate.c
+++ b/target/s390x/tcg/translate.c
@@ -2007,6 +2007,7 @@ static DisasJumpType op_cksm(DisasContext *s, DisasOps *o)
static DisasJumpType op_clc(DisasContext *s, DisasOps *o)
{
int l = get_field(s, l1);
+ TCGv_i64 src;
TCGv_i32 vl;
MemOp mop;
@@ -2016,9 +2017,11 @@ static DisasJumpType op_clc(DisasContext *s, DisasOps *o)
case 4:
case 8:
mop = ctz32(l + 1) | MO_TE;
- tcg_gen_qemu_ld_tl(cc_src, o->addr1, get_mem_index(s), mop);
+ /* Do not update cc_src yet: loading cc_dst may cause an exception. */
+ src = tcg_temp_new_i64();
+ tcg_gen_qemu_ld_tl(src, o->addr1, get_mem_index(s), mop);
tcg_gen_qemu_ld_tl(cc_dst, o->in2, get_mem_index(s), mop);
- gen_op_update2_cc_i64(s, CC_OP_LTUGTU_64, cc_src, cc_dst);
+ gen_op_update2_cc_i64(s, CC_OP_LTUGTU_64, src, cc_dst);
return DISAS_NEXT;
default:
vl = tcg_constant_i32(l);
--
2.39.2
- [Stable-8.1.3 45/55] ui/gtk-egl: apply scale factor when calculating window's dimension, (continued)
- [Stable-8.1.3 45/55] ui/gtk-egl: apply scale factor when calculating window's dimension, Michael Tokarev, 2023/11/09
- [Stable-8.1.3 40/55] qcow2: keep reference on zeroize with discard-no-unref enabled, Michael Tokarev, 2023/11/09
- [Stable-8.1.3 42/55] file-posix: fix over-writing of returning zone_append offset, Michael Tokarev, 2023/11/09
- [Stable-8.1.3 43/55] ati-vga: Implement fallback for pixman routines, Michael Tokarev, 2023/11/09
- [Stable-8.1.3 44/55] ui/gtk: force realization of drawing area, Michael Tokarev, 2023/11/09
- [Stable-8.1.3 46/55] ui/gtk-egl: Check EGLSurface before doing scanout, Michael Tokarev, 2023/11/09
- [Stable-8.1.3 47/55] target/mips: Fix MSA BZ/BNZ opcodes displacement, Michael Tokarev, 2023/11/09
- [Stable-8.1.3 48/55] target/mips: Fix TX79 LQ/SQ opcodes, Michael Tokarev, 2023/11/09
- [Stable-8.1.3 49/55] hw/ide: reset: cancel async DMA operation before resetting state, Michael Tokarev, 2023/11/09
- [Stable-8.1.3 50/55] tests/qtest: ahci-test: add test exposing reset issue with pending callback, Michael Tokarev, 2023/11/09
- [Stable-8.1.3 51/55] target/s390x: Fix CLC corrupting cc_src,
Michael Tokarev <=
- [Stable-8.1.3 52/55] tests/tcg/s390x: Test CLC with inaccessible second operand, Michael Tokarev, 2023/11/09
- [Stable-8.1.3 54/55] tests/tcg/s390x: Test LAALG with negative cc_src, Michael Tokarev, 2023/11/09
- [Stable-8.1.3 53/55] target/s390x: Fix LAALG not updating cc_src, Michael Tokarev, 2023/11/09
- [Stable-8.1.3 55/55] hw/ide/ahci: trigger either error IRQ or regular IRQ, not both, Michael Tokarev, 2023/11/09
- Re: [Stable-8.1.3 00/55] Patch Round-up for stable 8.1.3, freeze on 2023-11-19, Daniel Henrique Barboza, 2023/11/13