[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Stable-8.1.1 11/34] softmmu: Assert data in bounds in iotlb_to_section
From: |
Michael Tokarev |
Subject: |
[Stable-8.1.1 11/34] softmmu: Assert data in bounds in iotlb_to_section |
Date: |
Sat, 9 Sep 2023 13:27:04 +0300 |
From: Richard Henderson <richard.henderson@linaro.org>
Acked-by: Alex Bennée <alex.bennee@linaro.org>
Suggested-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
(cherry picked from commit 86e4f93d827d3c1efd00cd8a906e38a2c0f2b5bc)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
diff --git a/softmmu/physmem.c b/softmmu/physmem.c
index 3df73542e1..7597dc1c39 100644
--- a/softmmu/physmem.c
+++ b/softmmu/physmem.c
@@ -2413,9 +2413,15 @@ MemoryRegionSection *iotlb_to_section(CPUState *cpu,
int asidx = cpu_asidx_from_attrs(cpu, attrs);
CPUAddressSpace *cpuas = &cpu->cpu_ases[asidx];
AddressSpaceDispatch *d = qatomic_rcu_read(&cpuas->memory_dispatch);
- MemoryRegionSection *sections = d->map.sections;
+ int section_index = index & ~TARGET_PAGE_MASK;
+ MemoryRegionSection *ret;
+
+ assert(section_index < d->map.sections_nb);
+ ret = d->map.sections + section_index;
+ assert(ret->mr);
+ assert(ret->mr->ops);
- return §ions[index & ~TARGET_PAGE_MASK];
+ return ret;
}
static void io_mem_init(void)
--
2.39.2
- [Stable-8.1.1 02/34] target/s390x: Use a 16-bit immediate in VREP, (continued)
- [Stable-8.1.1 02/34] target/s390x: Use a 16-bit immediate in VREP, Michael Tokarev, 2023/09/09
- [Stable-8.1.1 03/34] target/s390x: Fix VSTL with a large length, Michael Tokarev, 2023/09/09
- [Stable-8.1.1 04/34] target/s390x: Check reserved bits of VFMIN/VFMAX's M5, Michael Tokarev, 2023/09/09
- [Stable-8.1.1 01/34] target/s390x: Fix the "ignored match" case in VSTRS, Michael Tokarev, 2023/09/09
- [Stable-8.1.1 06/34] kvm: Introduce kvm_arch_get_default_type hook, Michael Tokarev, 2023/09/09
- [Stable-8.1.1 05/34] include/hw/virtio/virtio-gpu: Fix virtio-gpu with blob on big endian hosts, Michael Tokarev, 2023/09/09
- [Stable-8.1.1 08/34] target/arm: Fix SME ST1Q, Michael Tokarev, 2023/09/09
- [Stable-8.1.1 07/34] accel/kvm: Specify default IPA size for arm64, Michael Tokarev, 2023/09/09
- [Stable-8.1.1 09/34] target/arm: Fix 64-bit SSRA, Michael Tokarev, 2023/09/09
- [Stable-8.1.1 10/34] docs/about/license: Update LICENSE URL, Michael Tokarev, 2023/09/09
- [Stable-8.1.1 11/34] softmmu: Assert data in bounds in iotlb_to_section,
Michael Tokarev <=
- Re: [Stable-8.1.1 11/34] softmmu: Assert data in bounds in iotlb_to_section, Alex Bennée, 2023/09/20
- Re: [Stable-8.1.1 11/34] softmmu: Assert data in bounds in iotlb_to_section, Michael Tokarev, 2023/09/22
[Stable-8.1.1 12/34] softmmu: Use async_run_on_cpu in tcg_commit, Michael Tokarev, 2023/09/09
[Stable-8.1.1 13/34] block-migration: Ensure we don't crash during migration cleanup, Michael Tokarev, 2023/09/09
[Stable-8.1.1 14/34] target/arm: properly document FEAT_CRC32, Michael Tokarev, 2023/09/09
[Stable-8.1.1 15/34] linux-user: Adjust brk for load_bias, Michael Tokarev, 2023/09/09