]> git.proxmox.com Git - mirror_qemu.git/commitdiff
linux-user: Clear translations on mprotect()
authorIlya Leoshkevich <iii@linux.ibm.com>
Wed, 17 Aug 2022 15:05:03 +0000 (17:05 +0200)
committerRichard Henderson <richard.henderson@linaro.org>
Tue, 6 Sep 2022 07:04:25 +0000 (08:04 +0100)
Currently it's possible to execute pages that do not have PAGE_EXEC
if there is an existing translation block. Fix by invalidating TBs
that touch the affected pages.

Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Message-Id: <20220817150506.592862-2-iii@linux.ibm.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
linux-user/mmap.c

index 048c4135af14c536a0440f348a3ccc29fd18b3a7..6a828e8418a755e6d2758886a07e96cd16e75221 100644 (file)
@@ -177,9 +177,11 @@ int target_mprotect(abi_ulong start, abi_ulong len, int target_prot)
             goto error;
         }
     }
+
     page_set_flags(start, start + len, page_flags);
-    mmap_unlock();
-    return 0;
+    tb_invalidate_phys_range(start, start + len);
+    ret = 0;
+
 error:
     mmap_unlock();
     return ret;