[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 4/6] target/arm: fix crash on pmu register access
From: |
Peter Maydell |
Subject: |
[Qemu-devel] [PULL 4/6] target/arm: fix crash on pmu register access |
Date: |
Mon, 25 Mar 2019 14:31:50 +0000 |
From: Andrew Jones <address@hidden>
Fix a QEMU NULL derefence that occurs when the guest attempts to
enable PMU counters with a non-v8 cpu model or a v8 cpu model
which has not configured a PMU.
Fixes: 4e7beb0cc0f3 ("target/arm: Add a timer to predict PMU counter overflow")
Signed-off-by: Andrew Jones <address@hidden>
Reviewed-by: Richard Henderson <address@hidden>
Message-id: address@hidden
Signed-off-by: Peter Maydell <address@hidden>
---
target/arm/helper.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/target/arm/helper.c b/target/arm/helper.c
index c8d3c213b6b..fc73488f6cc 100644
--- a/target/arm/helper.c
+++ b/target/arm/helper.c
@@ -1259,6 +1259,10 @@ static bool pmu_counter_enabled(CPUARMState *env,
uint8_t counter)
int el = arm_current_el(env);
uint8_t hpmn = env->cp15.mdcr_el2 & MDCR_HPMN;
+ if (!arm_feature(env, ARM_FEATURE_PMU)) {
+ return false;
+ }
+
if (!arm_feature(env, ARM_FEATURE_EL2) ||
(counter < hpmn || counter == 31)) {
e = env->cp15.c9_pmcr & PMCRE;
--
2.20.1
- [Qemu-devel] [PULL 0/6] target-arm queue, Peter Maydell, 2019/03/25
- [Qemu-devel] [PULL 1/6] target/arm: Fix non-parallel expansion of CASP, Peter Maydell, 2019/03/25
- [Qemu-devel] [PULL 2/6] nrf51_gpio: reflect pull-up/pull-down to IRQs, Peter Maydell, 2019/03/25
- [Qemu-devel] [PULL 3/6] target/arm: add PCI_TESTDEV back to default config, Peter Maydell, 2019/03/25
- [Qemu-devel] [PULL 4/6] target/arm: fix crash on pmu register access,
Peter Maydell <=
- [Qemu-devel] [PULL 6/6] target/arm: make pmccntr_op_start/finish static, Peter Maydell, 2019/03/25
- [Qemu-devel] [PULL 5/6] target/arm: cortex-a7 and cortex-a15 have pmus, Peter Maydell, 2019/03/25
- Re: [Qemu-devel] [PULL 0/6] target-arm queue, Peter Maydell, 2019/03/25