[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 10/38] target/arm: Fix sve_probe_page
From: |
Peter Maydell |
Subject: |
[PULL 10/38] target/arm: Fix sve_probe_page |
Date: |
Fri, 13 Jan 2023 14:10:58 +0000 |
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>
---
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 1afeadf9c85..521fc9b9697 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.34.1
- [PULL 00/38] target-arm queue, Peter Maydell, 2023/01/13
- [PULL 02/38] hw/arm: Add Olimex H405, Peter Maydell, 2023/01/13
- [PULL 01/38] hw/arm/stm32f405: correctly describe the memory layout, Peter Maydell, 2023/01/13
- [PULL 05/38] {hw/i2c,docs/system/arm}: Allwinner TWI/I2C Emulation, Peter Maydell, 2023/01/13
- [PULL 07/38] hw/arm: Add AXP209 to Cubieboard, Peter Maydell, 2023/01/13
- [PULL 10/38] target/arm: Fix sve_probe_page,
Peter Maydell <=
- [PULL 11/38] hw/arm/pxa2xx: Simplify pxa255_init(), Peter Maydell, 2023/01/13
- [PULL 04/38] hw/misc: Allwinner A10 DRAM Controller Emulation, Peter Maydell, 2023/01/13
- [PULL 03/38] hw/misc: Allwinner-A10 Clock Controller Module Emulation, Peter Maydell, 2023/01/13
- [PULL 09/38] tests/avocado: Add SD boot test to Cubieboard, Peter Maydell, 2023/01/13
- [PULL 15/38] hw/arm/gumstix: Improve documentation, Peter Maydell, 2023/01/13
- [PULL 21/38] hw/arm/z2: Use the IEC binary prefix definitions, Peter Maydell, 2023/01/13
- [PULL 06/38] hw/misc: AXP209 PMU Emulation, Peter Maydell, 2023/01/13
- [PULL 08/38] hw/arm: Allwinner A10 enable SPL load from MMC, Peter Maydell, 2023/01/13
- [PULL 13/38] hw/arm/collie: Use the IEC binary prefix definitions, Peter Maydell, 2023/01/13
- [PULL 23/38] hw/arm: Remove unreachable code calling pflash_cfi01_register(), Peter Maydell, 2023/01/13