diff options
Diffstat (limited to 'meta/recipes-devtools/qemu/qemu/0009-Fix-webkitgtk-builds.patch')
-rw-r--r-- | meta/recipes-devtools/qemu/qemu/0009-Fix-webkitgtk-builds.patch | 137 |
1 files changed, 137 insertions, 0 deletions
diff --git a/meta/recipes-devtools/qemu/qemu/0009-Fix-webkitgtk-builds.patch b/meta/recipes-devtools/qemu/qemu/0009-Fix-webkitgtk-builds.patch new file mode 100644 index 0000000000..4072d9455f --- /dev/null +++ b/meta/recipes-devtools/qemu/qemu/0009-Fix-webkitgtk-builds.patch | |||
@@ -0,0 +1,137 @@ | |||
1 | From b633b9a1813fcd715dce44659a89293f1c64ae8c Mon Sep 17 00:00:00 2001 | ||
2 | From: Martin Jansa <martin.jansa@lge.com> | ||
3 | Date: Fri, 1 Jun 2018 08:41:07 +0000 | ||
4 | Subject: [PATCH] Fix webkitgtk builds | ||
5 | |||
6 | This is a partial revert of "linux-user: fix mmap/munmap/mprotect/mremap/shmat". | ||
7 | |||
8 | This patch fixes qemu-i386 hangs during gobject-introspection in webkitgtk build | ||
9 | when musl is used on qemux86. This is the same issue that | ||
10 | 0008-linux-user-Fix-webkitgtk-hangs-on-32-bit-x86-target.patch was | ||
11 | fixing in the 2.11 release. | ||
12 | |||
13 | This patch also fixes a build failure when building webkitgtk for | ||
14 | qemumips. A QEMU assert is seen while building webkitgtk: | ||
15 | page_check_range: Assertion `start < ((target_ulong)1 << L1_MAP_ADDR_SPACE_BITS)' failed. | ||
16 | |||
17 | This reverts commit ebf9a3630c911d0cfc9c20f7cafe9ba4f88cf583. | ||
18 | |||
19 | Upstream-Status: Pending | ||
20 | Signed-off-by: Alistair Francis <alistair.francis@wdc.com> | ||
21 | --- | ||
22 | include/exec/cpu-all.h | 6 +----- | ||
23 | include/exec/cpu_ldst.h | 5 ++++- | ||
24 | linux-user/mmap.c | 17 ++++------------- | ||
25 | linux-user/syscall.c | 5 +---- | ||
26 | 4 files changed, 10 insertions(+), 23 deletions(-) | ||
27 | |||
28 | diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h | ||
29 | index 536ea58f81..4c63a6a2e4 100644 | ||
30 | --- a/include/exec/cpu-all.h | ||
31 | +++ b/include/exec/cpu-all.h | ||
32 | @@ -162,12 +162,8 @@ extern unsigned long guest_base; | ||
33 | extern int have_guest_base; | ||
34 | extern unsigned long reserved_va; | ||
35 | |||
36 | -#if HOST_LONG_BITS <= TARGET_VIRT_ADDR_SPACE_BITS | ||
37 | -#define GUEST_ADDR_MAX (~0ul) | ||
38 | -#else | ||
39 | -#define GUEST_ADDR_MAX (reserved_va ? reserved_va - 1 : \ | ||
40 | +#define GUEST_ADDR_MAX (reserved_va ? reserved_va : \ | ||
41 | (1ul << TARGET_VIRT_ADDR_SPACE_BITS) - 1) | ||
42 | -#endif | ||
43 | #else | ||
44 | |||
45 | #include "exec/hwaddr.h" | ||
46 | diff --git a/include/exec/cpu_ldst.h b/include/exec/cpu_ldst.h | ||
47 | index 9151fdb042..cb2b8f329f 100644 | ||
48 | --- a/include/exec/cpu_ldst.h | ||
49 | +++ b/include/exec/cpu_ldst.h | ||
50 | @@ -65,7 +65,10 @@ typedef uint64_t abi_ptr; | ||
51 | #if HOST_LONG_BITS <= TARGET_VIRT_ADDR_SPACE_BITS | ||
52 | #define guest_addr_valid(x) (1) | ||
53 | #else | ||
54 | -#define guest_addr_valid(x) ((x) <= GUEST_ADDR_MAX) | ||
55 | +#define guest_addr_valid(x) ({ \ | ||
56 | + ((x) < (1ul << TARGET_VIRT_ADDR_SPACE_BITS)) && \ | ||
57 | + (!reserved_va || ((x) < reserved_va)); \ | ||
58 | +}) | ||
59 | #endif | ||
60 | #define h2g_valid(x) guest_addr_valid((unsigned long)(x) - guest_base) | ||
61 | |||
62 | diff --git a/linux-user/mmap.c b/linux-user/mmap.c | ||
63 | index 46a6e3a761..7735465462 100644 | ||
64 | --- a/linux-user/mmap.c | ||
65 | +++ b/linux-user/mmap.c | ||
66 | @@ -78,7 +78,7 @@ int target_mprotect(abi_ulong start, abi_ulong len, int prot) | ||
67 | return -TARGET_EINVAL; | ||
68 | len = TARGET_PAGE_ALIGN(len); | ||
69 | end = start + len; | ||
70 | - if (!guest_range_valid(start, len)) { | ||
71 | + if (end < start) { | ||
72 | return -TARGET_ENOMEM; | ||
73 | } | ||
74 | prot &= PROT_READ | PROT_WRITE | PROT_EXEC; | ||
75 | @@ -495,8 +495,8 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int prot, | ||
76 | * It can fail only on 64-bit host with 32-bit target. | ||
77 | * On any other target/host host mmap() handles this error correctly. | ||
78 | */ | ||
79 | - if (!guest_range_valid(start, len)) { | ||
80 | - errno = ENOMEM; | ||
81 | + if ((unsigned long)start + len - 1 > (abi_ulong) -1) { | ||
82 | + errno = EINVAL; | ||
83 | goto fail; | ||
84 | } | ||
85 | |||
86 | @@ -636,10 +636,8 @@ int target_munmap(abi_ulong start, abi_ulong len) | ||
87 | if (start & ~TARGET_PAGE_MASK) | ||
88 | return -TARGET_EINVAL; | ||
89 | len = TARGET_PAGE_ALIGN(len); | ||
90 | - if (len == 0 || !guest_range_valid(start, len)) { | ||
91 | + if (len == 0) | ||
92 | return -TARGET_EINVAL; | ||
93 | - } | ||
94 | - | ||
95 | mmap_lock(); | ||
96 | end = start + len; | ||
97 | real_start = start & qemu_host_page_mask; | ||
98 | @@ -694,13 +692,6 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size, | ||
99 | int prot; | ||
100 | void *host_addr; | ||
101 | |||
102 | - if (!guest_range_valid(old_addr, old_size) || | ||
103 | - ((flags & MREMAP_FIXED) && | ||
104 | - !guest_range_valid(new_addr, new_size))) { | ||
105 | - errno = ENOMEM; | ||
106 | - return -1; | ||
107 | - } | ||
108 | - | ||
109 | mmap_lock(); | ||
110 | |||
111 | if (flags & MREMAP_FIXED) { | ||
112 | diff --git a/linux-user/syscall.c b/linux-user/syscall.c | ||
113 | index 8b41a03901..bc5d85de02 100644 | ||
114 | --- a/linux-user/syscall.c | ||
115 | +++ b/linux-user/syscall.c | ||
116 | @@ -4031,9 +4031,6 @@ static inline abi_ulong do_shmat(CPUArchState *cpu_env, | ||
117 | return -TARGET_EINVAL; | ||
118 | } | ||
119 | } | ||
120 | - if (!guest_range_valid(shmaddr, shm_info.shm_segsz)) { | ||
121 | - return -TARGET_EINVAL; | ||
122 | - } | ||
123 | |||
124 | mmap_lock(); | ||
125 | |||
126 | @@ -6881,7 +6878,7 @@ static int open_self_maps(void *cpu_env, int fd) | ||
127 | } | ||
128 | if (h2g_valid(min)) { | ||
129 | int flags = page_get_flags(h2g(min)); | ||
130 | - max = h2g_valid(max - 1) ? max : (uintptr_t)g2h(GUEST_ADDR_MAX) + 1; | ||
131 | + max = h2g_valid(max - 1) ? max : (uintptr_t)g2h(GUEST_ADDR_MAX); | ||
132 | if (page_check_range(h2g(min), max - min, flags) == -1) { | ||
133 | continue; | ||
134 | } | ||
135 | -- | ||
136 | 2.22.0 | ||
137 | |||