summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/qemu/qemu/0011-Revert-linux-user-fix-mmap-munmap-mprotect-mremap-sh.patch
diff options
context:
space:
mode:
authorMartin Jansa <martin.jansa@gmail.com>2018-06-01 10:29:39 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-06-07 08:52:55 +0100
commitf8ec8e89bbe913dd8afcf5136efc64a1d2793a8f (patch)
tree899b05ba8ceb6a5655c76a5ef095b95c20a87ed0 /meta/recipes-devtools/qemu/qemu/0011-Revert-linux-user-fix-mmap-munmap-mprotect-mremap-sh.patch
parent1c7ad49bfd3e60c44281a8f49d69f4b96c359703 (diff)
downloadpoky-f8ec8e89bbe913dd8afcf5136efc64a1d2793a8f.tar.gz
qemu: upgrade to 2.12.0
* drop patches which are now included upstream * revert "linux-user: fix mmap/munmap/mprotect/mremap/shma" which is causing 0010-linux-user-Fix-webkitgtk-hangs-on-32-bit-x86-target.patch to stop working and qemu-i386 hanging during gobject-introspection in webkitgtk when building for qemux86 with musl (From OE-Core rev: e9d6e09bb51a857ce248f45124548d338a350ba1) Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/qemu/qemu/0011-Revert-linux-user-fix-mmap-munmap-mprotect-mremap-sh.patch')
-rw-r--r--meta/recipes-devtools/qemu/qemu/0011-Revert-linux-user-fix-mmap-munmap-mprotect-mremap-sh.patch141
1 files changed, 141 insertions, 0 deletions
diff --git a/meta/recipes-devtools/qemu/qemu/0011-Revert-linux-user-fix-mmap-munmap-mprotect-mremap-sh.patch b/meta/recipes-devtools/qemu/qemu/0011-Revert-linux-user-fix-mmap-munmap-mprotect-mremap-sh.patch
new file mode 100644
index 0000000000..41626eb87c
--- /dev/null
+++ b/meta/recipes-devtools/qemu/qemu/0011-Revert-linux-user-fix-mmap-munmap-mprotect-mremap-sh.patch
@@ -0,0 +1,141 @@
1From 3ed26be2091436296933ed2146f7269c791c7bfe Mon Sep 17 00:00:00 2001
2From: Martin Jansa <martin.jansa@lge.com>
3Date: Fri, 1 Jun 2018 08:41:07 +0000
4Subject: [PATCH] Revert "linux-user: fix mmap/munmap/mprotect/mremap/shmat"
5
6Causes qemu-i386 to hang during gobject-introspection in webkitgtk build
7when musl is used on qemux86 - the same issue as
80010-linux-user-Fix-webkitgtk-hangs-on-32-bit-x86-target.patch
9was fixing in 2.11.0 release, but with this patch the fix no longer worked
10as discussed here:
11http://lists.openembedded.org/pipermail/openembedded-core/2018-May/150302.html
12http://lists.openembedded.org/pipermail/openembedded-core/2018-June/151382.html
13
14This reverts commit ebf9a3630c911d0cfc9c20f7cafe9ba4f88cf583.
15
16Upstream-Status: Pending
17---
18 include/exec/cpu-all.h | 6 +-----
19 include/exec/cpu_ldst.h | 16 +++++++++-------
20 linux-user/mmap.c | 17 ++++-------------
21 linux-user/syscall.c | 5 +----
22 4 files changed, 15 insertions(+), 29 deletions(-)
23
24diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h
25index f4fa94e966..0b141683f0 100644
26--- a/include/exec/cpu-all.h
27+++ b/include/exec/cpu-all.h
28@@ -159,12 +159,8 @@ extern unsigned long guest_base;
29 extern int have_guest_base;
30 extern unsigned long reserved_va;
31
32-#if HOST_LONG_BITS <= TARGET_VIRT_ADDR_SPACE_BITS
33-#define GUEST_ADDR_MAX (~0ul)
34-#else
35-#define GUEST_ADDR_MAX (reserved_va ? reserved_va - 1 : \
36+#define GUEST_ADDR_MAX (reserved_va ? reserved_va : \
37 (1ul << TARGET_VIRT_ADDR_SPACE_BITS) - 1)
38-#endif
39 #else
40
41 #include "exec/hwaddr.h"
42diff --git a/include/exec/cpu_ldst.h b/include/exec/cpu_ldst.h
43index 5de8c8a5af..191f2e962a 100644
44--- a/include/exec/cpu_ldst.h
45+++ b/include/exec/cpu_ldst.h
46@@ -51,13 +51,15 @@
47 /* All direct uses of g2h and h2g need to go away for usermode softmmu. */
48 #define g2h(x) ((void *)((unsigned long)(target_ulong)(x) + guest_base))
49
50-#define guest_addr_valid(x) ((x) <= GUEST_ADDR_MAX)
51-#define h2g_valid(x) guest_addr_valid((unsigned long)(x) - guest_base)
52-
53-static inline int guest_range_valid(unsigned long start, unsigned long len)
54-{
55- return len - 1 <= GUEST_ADDR_MAX && start <= GUEST_ADDR_MAX - len + 1;
56-}
57+#if HOST_LONG_BITS <= TARGET_VIRT_ADDR_SPACE_BITS
58+#define h2g_valid(x) 1
59+#else
60+#define h2g_valid(x) ({ \
61+ unsigned long __guest = (unsigned long)(x) - guest_base; \
62+ (__guest < (1ul << TARGET_VIRT_ADDR_SPACE_BITS)) && \
63+ (!reserved_va || (__guest < reserved_va)); \
64+})
65+#endif
66
67 #define h2g_nocheck(x) ({ \
68 unsigned long __ret = (unsigned long)(x) - guest_base; \
69diff --git a/linux-user/mmap.c b/linux-user/mmap.c
70index 9168a2051c..de85669aab 100644
71--- a/linux-user/mmap.c
72+++ b/linux-user/mmap.c
73@@ -80,7 +80,7 @@ int target_mprotect(abi_ulong start, abi_ulong len, int prot)
74 return -TARGET_EINVAL;
75 len = TARGET_PAGE_ALIGN(len);
76 end = start + len;
77- if (!guest_range_valid(start, len)) {
78+ if (end < start) {
79 return -TARGET_ENOMEM;
80 }
81 prot &= PROT_READ | PROT_WRITE | PROT_EXEC;
82@@ -482,8 +482,8 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int prot,
83 * It can fail only on 64-bit host with 32-bit target.
84 * On any other target/host host mmap() handles this error correctly.
85 */
86- if (!guest_range_valid(start, len)) {
87- errno = ENOMEM;
88+ if ((unsigned long)start + len - 1 > (abi_ulong) -1) {
89+ errno = EINVAL;
90 goto fail;
91 }
92
93@@ -623,10 +623,8 @@ int target_munmap(abi_ulong start, abi_ulong len)
94 if (start & ~TARGET_PAGE_MASK)
95 return -TARGET_EINVAL;
96 len = TARGET_PAGE_ALIGN(len);
97- if (len == 0 || !guest_range_valid(start, len)) {
98+ if (len == 0)
99 return -TARGET_EINVAL;
100- }
101-
102 mmap_lock();
103 end = start + len;
104 real_start = start & qemu_host_page_mask;
105@@ -681,13 +679,6 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size,
106 int prot;
107 void *host_addr;
108
109- if (!guest_range_valid(old_addr, old_size) ||
110- ((flags & MREMAP_FIXED) &&
111- !guest_range_valid(new_addr, new_size))) {
112- errno = ENOMEM;
113- return -1;
114- }
115-
116 mmap_lock();
117
118 if (flags & MREMAP_FIXED) {
119diff --git a/linux-user/syscall.c b/linux-user/syscall.c
120index 643b8833de..271f215147 100644
121--- a/linux-user/syscall.c
122+++ b/linux-user/syscall.c
123@@ -4919,9 +4919,6 @@ static inline abi_ulong do_shmat(CPUArchState *cpu_env,
124 return -TARGET_EINVAL;
125 }
126 }
127- if (!guest_range_valid(shmaddr, shm_info.shm_segsz)) {
128- return -TARGET_EINVAL;
129- }
130
131 mmap_lock();
132
133@@ -7497,7 +7494,7 @@ static int open_self_maps(void *cpu_env, int fd)
134 }
135 if (h2g_valid(min)) {
136 int flags = page_get_flags(h2g(min));
137- max = h2g_valid(max - 1) ? max : (uintptr_t)g2h(GUEST_ADDR_MAX) + 1;
138+ max = h2g_valid(max - 1) ? max : (uintptr_t)g2h(GUEST_ADDR_MAX);
139 if (page_check_range(h2g(min), max - min, flags) == -1) {
140 continue;
141 }