[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 03/14] linux-user: Adjust guest page protection for the host
From: |
Laurent Vivier |
Subject: |
[PULL 03/14] linux-user: Adjust guest page protection for the host |
Date: |
Thu, 13 Aug 2020 08:49:12 +0200 |
From: Richard Henderson <richard.henderson@linaro.org>
Executable guest pages are never directly executed by
the host, but do need to be readable for translation.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20200519185645.3915-3-richard.henderson@linaro.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
linux-user/mmap.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/linux-user/mmap.c b/linux-user/mmap.c
index 46c7eeba9bd2..f2615634201d 100644
--- a/linux-user/mmap.c
+++ b/linux-user/mmap.c
@@ -76,8 +76,12 @@ static int validate_prot_to_pageflags(int *host_prot, int
prot)
* don't bother transforming guest bit to host bit. Any other
* target-specific prot bits will not be understood by the host
* and will need to be encoded into page_flags for qemu emulation.
+ *
+ * Pages that are executable by the guest will never be executed
+ * by the host, but the host will need to be able to read them.
*/
- *host_prot = prot & (PROT_READ | PROT_WRITE | PROT_EXEC);
+ *host_prot = (prot & (PROT_READ | PROT_WRITE))
+ | (prot & PROT_EXEC ? PROT_READ : 0);
return prot & ~valid ? 0 : page_flags;
}
--
2.26.2
- [PULL 00/14] Linux user for 5.2 patches, Laurent Vivier, 2020/08/13
- [PULL 01/14] linux-user: Fix "print_fdset()" in "strace.c" to not print ", " after last value, Laurent Vivier, 2020/08/13
- [PULL 02/14] linux-user: Validate mmap/mprotect prot value, Laurent Vivier, 2020/08/13
- [PULL 03/14] linux-user: Adjust guest page protection for the host,
Laurent Vivier <=
- [PULL 07/14] linux-user: Add support for a group of btrfs ioctls used for snapshots, Laurent Vivier, 2020/08/13
- [PULL 06/14] linux-user: Add support for a group of btrfs ioctls used for subvolumes, Laurent Vivier, 2020/08/13
- [PULL 05/14] linux-user: Add support for a group of 2038 safe syscalls, Laurent Vivier, 2020/08/13
- [PULL 08/14] linux-user: Add support for btrfs ioctls used to manipulate with devices, Laurent Vivier, 2020/08/13
- [PULL 04/14] linux-user: Modify 'target_to_host/host_to_target_itimerspec()', Laurent Vivier, 2020/08/13
- [PULL 09/14] linux-user: Add support for btrfs ioctls used to get/set features, Laurent Vivier, 2020/08/13
- [PULL 13/14] linux-user: Add support for btrfs ioctls used to scrub a filesystem, Laurent Vivier, 2020/08/13
- [PULL 10/14] linux-user: Add support for a group of btrfs inode ioctls, Laurent Vivier, 2020/08/13
- [PULL 14/14] linux-user: Fix 'utimensat()' implementation, Laurent Vivier, 2020/08/13
- [PULL 11/14] linux-user: Add support for two btrfs ioctls used for subvolume, Laurent Vivier, 2020/08/13