[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 56/60] linux-user/x86_64: Handle the vsyscall page in open_self_m
From: |
Richard Henderson |
Subject: |
[PATCH 56/60] linux-user/x86_64: Handle the vsyscall page in open_self_maps_{2, 4} |
Date: |
Fri, 1 Mar 2024 13:06:15 -1000 |
This is the only case in which we expect to have no host memory backing
for a guest memory page, because in general linux user processes cannot
map any pages in the top half of the 64-bit address space.
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2170
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
linux-user/syscall.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index e384e14248..bc8c06522f 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -7994,6 +7994,10 @@ static void open_self_maps_4(const struct
open_self_maps_data *d,
path = "[heap]";
} else if (start == info->vdso) {
path = "[vdso]";
+#ifdef TARGET_X86_64
+ } else if (start == TARGET_VSYSCALL_PAGE) {
+ path = "[vsyscall]";
+#endif
}
/* Except null device (MAP_ANON), adjust offset for this fragment. */
@@ -8082,6 +8086,18 @@ static int open_self_maps_2(void *opaque, target_ulong
guest_start,
uintptr_t host_start = (uintptr_t)g2h_untagged(guest_start);
uintptr_t host_last = (uintptr_t)g2h_untagged(guest_end - 1);
+#ifdef TARGET_X86_64
+ /*
+ * Because of the extremely high position of the page within the guest
+ * virtual address space, this is not backed by host memory at all.
+ * Therefore the loop below would fail. This is the only instance
+ * of not having host backing memory.
+ */
+ if (guest_start == TARGET_VSYSCALL_PAGE) {
+ return open_self_maps_3(opaque, guest_start, guest_end, flags);
+ }
+#endif
+
while (1) {
IntervalTreeNode *n =
interval_tree_iter_first(d->host_maps, host_start, host_start);
--
2.34.1
- [PATCH 47/60] cpu: Remove page_size_init, (continued)
- [PATCH 47/60] cpu: Remove page_size_init, Richard Henderson, 2024/03/01
- [PATCH 40/60] linux-user: Use do_munmap for target_mmap failure, Richard Henderson, 2024/03/01
- [PATCH 51/60] linux-user: Bound mmap_min_addr by host page size, Richard Henderson, 2024/03/01
- [PATCH 57/60] linux-user/loongarch64: Remove TARGET_FORCE_SHMLBA, Richard Henderson, 2024/03/01
- [PATCH 55/60] tcg/optimize: fix uninitialized variable, Richard Henderson, 2024/03/01
- [PATCH 59/60] linux-user: Rewrite target_shmat, Richard Henderson, 2024/03/01
- [PATCH 48/60] accel/tcg: Disconnect TargetPageDataNode from page size, Richard Henderson, 2024/03/01
- [PATCH 53/60] target/alpha: Enable TARGET_PAGE_BITS_VARY for user-only, Richard Henderson, 2024/03/01
- [PATCH 60/60] tests/tcg: Check that shmat() does not break /proc/self/maps, Richard Henderson, 2024/03/01
- [PATCH 49/60] linux-user: Allow TARGET_PAGE_BITS_VARY, Richard Henderson, 2024/03/01
- [PATCH 56/60] linux-user/x86_64: Handle the vsyscall page in open_self_maps_{2, 4},
Richard Henderson <=
- [PATCH 43/60] linux-user: Split out mmap_h_gt_g, Richard Henderson, 2024/03/01
- [PATCH 44/60] tests/tcg: Remove run-test-mmap-*, Richard Henderson, 2024/03/01
- [PATCH 46/60] *-user: Deprecate and disable -p pagesize, Richard Henderson, 2024/03/01
- [PATCH 52/60] target/ppc: Enable TARGET_PAGE_BITS_VARY for user-only, Richard Henderson, 2024/03/01
- [PULL 00/60] linux-user and tcg patch queue, Richard Henderson, 2024/03/01
- [PATCH 54/60] linux-user: Remove pgb_dynamic alignment assertion, Richard Henderson, 2024/03/01
- [PATCH 58/60] linux-user: Add strace for shmat, Richard Henderson, 2024/03/01
- Re: [PATCH 00/60] linux-user and tcg patch queue, Peter Maydell, 2024/03/05