[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 12/47] target/arm: Fix sve_probe_page
From: |
Michael Tokarev |
Subject: |
[PATCH 12/47] target/arm: Fix sve_probe_page |
Date: |
Wed, 8 Mar 2023 19:57:15 +0300 |
From: Richard Henderson <richard.henderson@linaro.org>
Don't dereference CPUTLBEntryFull until we verify that
the page is valid. Move the other user-only info field
updates after the valid check to match.
Cc: qemu-stable@nongnu.org
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1412
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-id: 20230104190056.305143-1-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
(cherry picked from commit ce848378b999214777fa984a8a0a3e3deb1cf687)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
target/arm/sve_helper.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/target/arm/sve_helper.c b/target/arm/sve_helper.c
index 1afeadf9c8..521fc9b969 100644
--- a/target/arm/sve_helper.c
+++ b/target/arm/sve_helper.c
@@ -5354,15 +5354,10 @@ bool sve_probe_page(SVEHostPage *info, bool nofault,
CPUARMState *env,
#ifdef CONFIG_USER_ONLY
flags = probe_access_flags(env, addr, access_type, mmu_idx, nofault,
&info->host, retaddr);
- memset(&info->attrs, 0, sizeof(info->attrs));
- /* Require both ANON and MTE; see allocation_tag_mem(). */
- info->tagged = (flags & PAGE_ANON) && (flags & PAGE_MTE);
#else
CPUTLBEntryFull *full;
flags = probe_access_full(env, addr, access_type, mmu_idx, nofault,
&info->host, &full, retaddr);
- info->attrs = full->attrs;
- info->tagged = full->pte_attrs == 0xf0;
#endif
info->flags = flags;
@@ -5371,6 +5366,15 @@ bool sve_probe_page(SVEHostPage *info, bool nofault,
CPUARMState *env,
return false;
}
+#ifdef CONFIG_USER_ONLY
+ memset(&info->attrs, 0, sizeof(info->attrs));
+ /* Require both ANON and MTE; see allocation_tag_mem(). */
+ info->tagged = (flags & PAGE_ANON) && (flags & PAGE_MTE);
+#else
+ info->attrs = full->attrs;
+ info->tagged = full->pte_attrs == 0xf0;
+#endif
+
/* Ensure that info->host[] is relative to addr, not addr + mem_off. */
info->host -= mem_off;
return true;
--
2.30.2
- [RFC PATCH 00/47] Patch Round-up for stable 7.2.1, Michael Tokarev, 2023/03/08
- [PATCH 02/47] vhost: fix vq dirty bitmap syncing when vIOMMU is enabled, Michael Tokarev, 2023/03/08
- [PATCH 05/47] target/arm: fix handling of HLT semihosting in system mode, Michael Tokarev, 2023/03/08
- [PATCH 13/47] target/arm: allow writes to SCR_EL3.HXEn bit when FEAT_HCX is enabled, Michael Tokarev, 2023/03/08
- [PATCH 12/47] target/arm: Fix sve_probe_page,
Michael Tokarev <=
- [PATCH 11/47] configure: fix GLIB_VERSION for cross-compilation, Michael Tokarev, 2023/03/08
- [PATCH 14/47] target/arm: Fix in_debug path in S1_ptw_translate, Michael Tokarev, 2023/03/08
- [PATCH 18/47] qcow2: Fix theoretical corruption in store_bitmap() error path, Michael Tokarev, 2023/03/08
- [PATCH 17/47] migration/ram: Fix populate_read_range(), Michael Tokarev, 2023/03/08
- [PATCH 15/47] target/arm: Fix physical address resolution for Stage2, Michael Tokarev, 2023/03/08
- [PATCH 24/47] target/i386: Fix BZHI instruction, Michael Tokarev, 2023/03/08
- [PATCH 19/47] block: fix detect-zeroes= with BDRV_REQ_REGISTERED_BUF, Michael Tokarev, 2023/03/08
- [PATCH 16/47] migration/ram: Fix error handling in ram_write_tracking_start(), Michael Tokarev, 2023/03/08
- [PATCH 20/47] tests/tcg/i386: Introduce and use reg_t consistently, Michael Tokarev, 2023/03/08
- [PATCH 22/47] target/i386: Fix C flag for BLSI, BLSMSK, BLSR, Michael Tokarev, 2023/03/08