linux-user: Clear translations on mprotect()

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>
This commit is contained in:
Ilya Leoshkevich 2022-08-17 17:05:03 +02:00 committed by Richard Henderson
parent 872f3d046f
commit aa98e2d885

View File

@ -177,9 +177,11 @@ int target_mprotect(abi_ulong start, abi_ulong len, int target_prot)
goto error; goto error;
} }
} }
page_set_flags(start, start + len, page_flags); page_set_flags(start, start + len, page_flags);
mmap_unlock(); tb_invalidate_phys_range(start, start + len);
return 0; ret = 0;
error: error:
mmap_unlock(); mmap_unlock();
return ret; return ret;