summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/qemu/qemu/0011-linux-user-workaround-for-missing-MAP_FIXED_NOREPLAC.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/qemu/qemu/0011-linux-user-workaround-for-missing-MAP_FIXED_NOREPLAC.patch')
-rw-r--r--meta/recipes-devtools/qemu/qemu/0011-linux-user-workaround-for-missing-MAP_FIXED_NOREPLAC.patch62
1 files changed, 29 insertions, 33 deletions
diff --git a/meta/recipes-devtools/qemu/qemu/0011-linux-user-workaround-for-missing-MAP_FIXED_NOREPLAC.patch b/meta/recipes-devtools/qemu/qemu/0011-linux-user-workaround-for-missing-MAP_FIXED_NOREPLAC.patch
index 672d5458cd..cc53b1eedd 100644
--- a/meta/recipes-devtools/qemu/qemu/0011-linux-user-workaround-for-missing-MAP_FIXED_NOREPLAC.patch
+++ b/meta/recipes-devtools/qemu/qemu/0011-linux-user-workaround-for-missing-MAP_FIXED_NOREPLAC.patch
@@ -40,10 +40,10 @@ Signed-off-by: Mark Hatle <mark.hatle@amd.com>
40 create mode 100644 linux-user/mmap-fixed.c 40 create mode 100644 linux-user/mmap-fixed.c
41 create mode 100644 linux-user/mmap-fixed.h 41 create mode 100644 linux-user/mmap-fixed.h
42 42
43Index: qemu-8.2.0/linux-user/elfload.c 43Index: qemu-8.2.1/linux-user/elfload.c
44=================================================================== 44===================================================================
45--- qemu-8.2.0.orig/linux-user/elfload.c 45--- qemu-8.2.1.orig/linux-user/elfload.c
46+++ qemu-8.2.0/linux-user/elfload.c 46+++ qemu-8.2.1/linux-user/elfload.c
47@@ -22,6 +22,7 @@ 47@@ -22,6 +22,7 @@
48 #include "qemu/error-report.h" 48 #include "qemu/error-report.h"
49 #include "target_signal.h" 49 #include "target_signal.h"
@@ -65,10 +65,10 @@ Index: qemu-8.2.0/linux-user/elfload.c
65 int ret; 65 int ret;
66 66
67 if (p == MAP_FAILED) { 67 if (p == MAP_FAILED) {
68Index: qemu-8.2.0/linux-user/meson.build 68Index: qemu-8.2.1/linux-user/meson.build
69=================================================================== 69===================================================================
70--- qemu-8.2.0.orig/linux-user/meson.build 70--- qemu-8.2.1.orig/linux-user/meson.build
71+++ qemu-8.2.0/linux-user/meson.build 71+++ qemu-8.2.1/linux-user/meson.build
72@@ -14,6 +14,7 @@ linux_user_ss.add(files( 72@@ -14,6 +14,7 @@ linux_user_ss.add(files(
73 'linuxload.c', 73 'linuxload.c',
74 'main.c', 74 'main.c',
@@ -77,10 +77,10 @@ Index: qemu-8.2.0/linux-user/meson.build
77 'signal.c', 77 'signal.c',
78 'strace.c', 78 'strace.c',
79 'syscall.c', 79 'syscall.c',
80Index: qemu-8.2.0/linux-user/mmap-fixed.c 80Index: qemu-8.2.1/linux-user/mmap-fixed.c
81=================================================================== 81===================================================================
82--- /dev/null 82--- /dev/null
83+++ qemu-8.2.0/linux-user/mmap-fixed.c 83+++ qemu-8.2.1/linux-user/mmap-fixed.c
84@@ -0,0 +1,63 @@ 84@@ -0,0 +1,63 @@
85+/* 85+/*
86+ * Workaround for MAP_FIXED_NOREPLACE 86+ * Workaround for MAP_FIXED_NOREPLACE
@@ -145,10 +145,10 @@ Index: qemu-8.2.0/linux-user/mmap-fixed.c
145+} 145+}
146+ 146+
147+#endif 147+#endif
148Index: qemu-8.2.0/linux-user/mmap-fixed.h 148Index: qemu-8.2.1/linux-user/mmap-fixed.h
149=================================================================== 149===================================================================
150--- /dev/null 150--- /dev/null
151+++ qemu-8.2.0/linux-user/mmap-fixed.h 151+++ qemu-8.2.1/linux-user/mmap-fixed.h
152@@ -0,0 +1,39 @@ 152@@ -0,0 +1,39 @@
153+/* 153+/*
154+ * Workaround for MAP_FIXED_NOREPLACE 154+ * Workaround for MAP_FIXED_NOREPLACE
@@ -189,10 +189,10 @@ Index: qemu-8.2.0/linux-user/mmap-fixed.h
189+#endif /* MAP_FIXED_NOREPLACE */ 189+#endif /* MAP_FIXED_NOREPLACE */
190+ 190+
191+#endif /* MMAP_FIXED_H */ 191+#endif /* MMAP_FIXED_H */
192Index: qemu-8.2.0/linux-user/mmap.c 192Index: qemu-8.2.1/linux-user/mmap.c
193=================================================================== 193===================================================================
194--- qemu-8.2.0.orig/linux-user/mmap.c 194--- qemu-8.2.1.orig/linux-user/mmap.c
195+++ qemu-8.2.0/linux-user/mmap.c 195+++ qemu-8.2.1/linux-user/mmap.c
196@@ -25,6 +25,7 @@ 196@@ -25,6 +25,7 @@
197 #include "user-mmap.h" 197 #include "user-mmap.h"
198 #include "target_mman.h" 198 #include "target_mman.h"
@@ -201,7 +201,16 @@ Index: qemu-8.2.0/linux-user/mmap.c
201 201
202 #ifdef TARGET_ARM 202 #ifdef TARGET_ARM
203 #include "target/arm/cpu-features.h" 203 #include "target/arm/cpu-features.h"
204@@ -304,9 +305,9 @@ static bool mmap_frag(abi_ulong real_sta 204@@ -273,7 +274,7 @@ int target_mprotect(abi_ulong start, abi
205 static int do_munmap(void *addr, size_t len)
206 {
207 if (reserved_va) {
208- void *ptr = mmap(addr, len, PROT_NONE,
209+ void *ptr = mmap_fixed_noreplace(addr, len, PROT_NONE,
210 MAP_FIXED | MAP_ANONYMOUS
211 | MAP_PRIVATE | MAP_NORESERVE, -1, 0);
212 return ptr == addr ? 0 : -1;
213@@ -319,9 +320,9 @@ static bool mmap_frag(abi_ulong real_sta
205 * outside of the fragment we need to map. Allocate a new host 214 * outside of the fragment we need to map. Allocate a new host
206 * page to cover, discarding whatever else may have been present. 215 * page to cover, discarding whatever else may have been present.
207 */ 216 */
@@ -214,7 +223,7 @@ Index: qemu-8.2.0/linux-user/mmap.c
214 if (p != host_start) { 223 if (p != host_start) {
215 if (p != MAP_FAILED) { 224 if (p != MAP_FAILED) {
216 munmap(p, qemu_host_page_size); 225 munmap(p, qemu_host_page_size);
217@@ -405,8 +406,9 @@ abi_ulong mmap_find_vma(abi_ulong start, 226@@ -420,8 +421,9 @@ abi_ulong mmap_find_vma(abi_ulong start,
218 * - mremap() with MREMAP_FIXED flag 227 * - mremap() with MREMAP_FIXED flag
219 * - shmat() with SHM_REMAP flag 228 * - shmat() with SHM_REMAP flag
220 */ 229 */
@@ -226,7 +235,7 @@ Index: qemu-8.2.0/linux-user/mmap.c
226 235
227 /* ENOMEM, if host address space has no memory */ 236 /* ENOMEM, if host address space has no memory */
228 if (ptr == MAP_FAILED) { 237 if (ptr == MAP_FAILED) {
229@@ -600,16 +602,16 @@ abi_long target_mmap(abi_ulong start, ab 238@@ -615,16 +617,16 @@ abi_long target_mmap(abi_ulong start, ab
230 * especially important if qemu_host_page_size > 239 * especially important if qemu_host_page_size >
231 * qemu_real_host_page_size. 240 * qemu_real_host_page_size.
232 */ 241 */
@@ -247,7 +256,7 @@ Index: qemu-8.2.0/linux-user/mmap.c
247 if (p == MAP_FAILED) { 256 if (p == MAP_FAILED) {
248 munmap(g2h_untagged(start), host_len); 257 munmap(g2h_untagged(start), host_len);
249 goto fail; 258 goto fail;
250@@ -734,8 +736,9 @@ abi_long target_mmap(abi_ulong start, ab 259@@ -749,8 +751,9 @@ abi_long target_mmap(abi_ulong start, ab
251 len1 = real_last - real_start + 1; 260 len1 = real_last - real_start + 1;
252 want_p = g2h_untagged(real_start); 261 want_p = g2h_untagged(real_start);
253 262
@@ -259,23 +268,10 @@ Index: qemu-8.2.0/linux-user/mmap.c
259 if (p != want_p) { 268 if (p != want_p) {
260 if (p != MAP_FAILED) { 269 if (p != MAP_FAILED) {
261 munmap(p, len1); 270 munmap(p, len1);
262@@ -837,9 +840,9 @@ static int mmap_reserve_or_unmap(abi_ulo 271Index: qemu-8.2.1/linux-user/syscall.c
263 host_start = g2h_untagged(real_start);
264
265 if (reserved_va) {
266- void *ptr = mmap(host_start, real_len, PROT_NONE,
267- MAP_FIXED | MAP_ANONYMOUS
268- | MAP_PRIVATE | MAP_NORESERVE, -1, 0);
269+ void *ptr = mmap_fixed_noreplace(host_start, real_len, PROT_NONE,
270+ MAP_FIXED | MAP_ANONYMOUS
271+ | MAP_PRIVATE | MAP_NORESERVE, -1, 0);
272 return ptr == host_start ? 0 : -1;
273 }
274 return munmap(host_start, real_len);
275Index: qemu-8.2.0/linux-user/syscall.c
276=================================================================== 272===================================================================
277--- qemu-8.2.0.orig/linux-user/syscall.c 273--- qemu-8.2.1.orig/linux-user/syscall.c
278+++ qemu-8.2.0/linux-user/syscall.c 274+++ qemu-8.2.1/linux-user/syscall.c
279@@ -145,6 +145,7 @@ 275@@ -145,6 +145,7 @@
280 #include "qapi/error.h" 276 #include "qapi/error.h"
281 #include "fd-trans.h" 277 #include "fd-trans.h"