[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 06/11] target/s390x: Fix CLC corrupting cc_src
From: |
Thomas Huth |
Subject: |
[PULL 06/11] target/s390x: Fix CLC corrupting cc_src |
Date: |
Tue, 7 Nov 2023 19:32:23 +0100 |
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>
---
target/s390x/tcg/translate.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/target/s390x/tcg/translate.c b/target/s390x/tcg/translate.c
index 4bae1509f5..a0d6a2a35d 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.41.0
- [PULL 00/11] s390x and MAINTAINERS updates, Thomas Huth, 2023/11/07
- [PULL 01/11] MAINTAINERS: Add the virtio-gpu documentation to the corresponding section, Thomas Huth, 2023/11/07
- [PULL 02/11] MAINTAINERS: Add artist.c to the hppa machine section, Thomas Huth, 2023/11/07
- [PULL 04/11] s390/sclp: fix SCLP facility map, Thomas Huth, 2023/11/07
- [PULL 05/11] target/s390x/cpu_models: Use 'first_cpu' in s390_get_feat_block(), Thomas Huth, 2023/11/07
- [PULL 03/11] tests/avocado: Allow newer versions of tesseract in the nextcube test, Thomas Huth, 2023/11/07
- [PULL 06/11] target/s390x: Fix CLC corrupting cc_src,
Thomas Huth <=
- [PULL 07/11] tests/tcg/s390x: Test CLC with inaccessible second operand, Thomas Huth, 2023/11/07
- [PULL 08/11] target/s390x: Fix LAALG not updating cc_src, Thomas Huth, 2023/11/07
- [PULL 10/11] tests/tcg/s390x: Test ADD LOGICAL WITH CARRY, Thomas Huth, 2023/11/07
- [PULL 09/11] tests/tcg/s390x: Test LAALG with negative cc_src, Thomas Huth, 2023/11/07
- [PULL 11/11] target/s390x/cpu topology: Fix ordering and creation of TLEs, Thomas Huth, 2023/11/07
- Re: [PULL 00/11] s390x and MAINTAINERS updates, Stefan Hajnoczi, 2023/11/08