[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PULL 19/34] address_space_access_valid: address_space_
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PULL 19/34] address_space_access_valid: address_space_to_flatview needs RCU lock |
Date: |
Wed, 7 Mar 2018 14:00:02 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 |
On 07/03/2018 13:49, Cornelia Huck wrote:
> On Tue, 6 Mar 2018 14:19:15 +0100
> Paolo Bonzini <address@hidden> wrote:
>
>> address_space_access_valid is calling address_space_to_flatview but it can
>> be called outside the RCU lock. To fix it, push the rcu_read_lock/unlock
>> pair up from flatview_access_valid to address_space_access_valid.
>>
>> Reviewed-by: Alexey Kardashevskiy <address@hidden>
>> Signed-off-by: Paolo Bonzini <address@hidden>
>> ---
>> exec.c | 12 ++++++++----
>> 1 file changed, 8 insertions(+), 4 deletions(-)
>
> This one kills my s390x guests when running under tcg:
>
> qemu-system-s390x: /home/cohuck/git/qemu/include/qemu/rcu.h:89: void
> rcu_read_unlock(void): Assertion `p_rcu_reader->depth != 0' failed.
>
> Easy to reproduce with the moon buggy image from the QEMU Advent
> Calendar:
>
> s390x-softmmu/qemu-system-s390x -M s390-ccw-virtio -nographic -smp 2 -kernel
> ~/Downloads/s390-moon-buggy/s390-bb.kernel -initrd
> ~/Downloads/s390-moon-buggy/s390-moon-buggy.initrd
This is the fix for all of these:
diff --git a/exec.c b/exec.c
index 604f03c535..a9181e6417 100644
--- a/exec.c
+++ b/exec.c
@@ -3393,7 +3393,6 @@ static bool flatview_access_valid(FlatView *fv,
hwaddr addr, int len,
if (!memory_access_is_direct(mr, is_write)) {
l = memory_access_size(mr, l, addr);
if (!memory_region_access_valid(mr, xlat, l, is_write)) {
- rcu_read_unlock();
return false;
}
}
Paolo
- [Qemu-devel] [PULL 10/34] build-sys: fix -fsanitize=address check, (continued)
- [Qemu-devel] [PULL 10/34] build-sys: fix -fsanitize=address check, Paolo Bonzini, 2018/03/06
- [Qemu-devel] [PULL 08/34] qmp: Merge ObjectPropertyInfo and DevicePropertyInfo, Paolo Bonzini, 2018/03/06
- [Qemu-devel] [PULL 06/34] cpus: CPU threads are always created initially for one CPU only, Paolo Bonzini, 2018/03/06
- [Qemu-devel] [PULL 09/34] qmp: Add qom-list-properties to list QOM object properties, Paolo Bonzini, 2018/03/06
- [Qemu-devel] [PULL 13/34] sdhci-test: fix leaks, Paolo Bonzini, 2018/03/06
- [Qemu-devel] [PULL 14/34] chardev: fix leak in tcp_chr_telnet_init_io(), Paolo Bonzini, 2018/03/06
- [Qemu-devel] [PULL 12/34] ahci-test: fix opts leak of skip tests, Paolo Bonzini, 2018/03/06
- [Qemu-devel] [PULL 15/34] openpic_kvm: drop address_space_to_flatview call, Paolo Bonzini, 2018/03/06
- [Qemu-devel] [PULL 19/34] address_space_access_valid: address_space_to_flatview needs RCU lock, Paolo Bonzini, 2018/03/06
- [Qemu-devel] [PULL 17/34] address_space_write: address_space_to_flatview needs RCU lock, Paolo Bonzini, 2018/03/06
- [Qemu-devel] [PULL 22/34] checkpatch: add a warning for basename/dirname, Paolo Bonzini, 2018/03/06
- [Qemu-devel] [PULL 18/34] address_space_read: address_space_to_flatview needs RCU lock, Paolo Bonzini, 2018/03/06
- [Qemu-devel] [PULL 16/34] memory: inline some performance-sensitive accessors, Paolo Bonzini, 2018/03/06
- [Qemu-devel] [PULL 20/34] address_space_map: address_space_to_flatview needs RCU lock, Paolo Bonzini, 2018/03/06
- [Qemu-devel] [PULL 21/34] address_space_rw: address_space_to_flatview needs RCU lock, Paolo Bonzini, 2018/03/06
- [Qemu-devel] [PULL 23/34] checkpatch: add check for `while` and `for`, Paolo Bonzini, 2018/03/06
- [Qemu-devel] [PULL 24/34] Revert "build-sys: compile with -Og or -O1 when --enable-debug", Paolo Bonzini, 2018/03/06
- [Qemu-devel] [PULL 25/34] Fixing WHPX casing to match SDK, Paolo Bonzini, 2018/03/06