exec.c: Use atomic_rcu_read() to access dispatch in memory_region_section_get_iotlb()

When accessing the dispatch pointer in an AddressSpace within an RCU
critical section we should always use atomic_rcu_read(). Fix an
access within memory_region_section_get_iotlb() which was incorrectly
doing a direct pointer access.

Backports commit 0b8e2c1002afddc8ef3d52fa6fc29e4768429f98 from qemu
This commit is contained in:
Peter Maydell 2018-02-18 19:22:30 -05:00 committed by Lioncash
parent 75701d03ee
commit 5192f806aa
No known key found for this signature in database
GPG key ID: 4E3C3CC1031BA9C7

View file

@ -774,7 +774,11 @@ hwaddr memory_region_section_get_iotlb(CPUState *cpu,
iotlb |= PHYS_SECTION_ROM;
}
} else {
iotlb = section - section->address_space->dispatch->map.sections;
AddressSpaceDispatch *d;
// Unicorn: uses atomic_read instead of atomic_rcu_read
d = atomic_read(&section->address_space->dispatch);
iotlb = section - d->map.sections;
iotlb += xlat;
}