s390x/mmu: don't overwrite pending exception in mmu translate
authorDavid Hildenbrand <david@redhat.com>
Mon, 9 Apr 2018 11:30:18 +0000 (13:30 +0200)
committerCornelia Huck <cohuck@redhat.com>
Mon, 9 Apr 2018 11:58:01 +0000 (13:58 +0200)
If we already triggered another exception, don't overwrite it with a
protection exception.

Only applies to old KVM instances without the virtual memory access
IOCTL in KVM.

Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20180409113019.14568-2-david@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
target/s390x/mmu_helper.c

index 1deeb6e6e47a42a87fdd683786bdc5ac9d29bbd2..a25deef5dd859c14346d61bef5f941ff038f9b81 100644 (file)
@@ -325,7 +325,7 @@ static int mmu_translate_asce(CPUS390XState *env, target_ulong vaddr,
 
     r = mmu_translate_region(env, vaddr, asc, asce, level, raddr, flags, rw,
                              exc);
-    if (rw == MMU_DATA_STORE && !(*flags & PAGE_WRITE)) {
+    if (!r && rw == MMU_DATA_STORE && !(*flags & PAGE_WRITE)) {
         trigger_prot_fault(env, vaddr, asc, rw, exc);
         return -1;
     }