diff options
| author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-09-06 16:13:14 +0100 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-09-06 16:53:39 +0100 |
| commit | 17597d2213c113a73406b20fe843dad6f284c38b (patch) | |
| tree | 284ada0baf9bd810cf06582500c638d60c254037 | |
| parent | 38613fdacf8e0699229811c870f3f7bf317ef32a (diff) | |
| download | poky-17597d2213c113a73406b20fe843dad6f284c38b.tar.gz | |
qemu: Backport a patch for recent glibc versions
This fixes compile failures of qemu-native with new versions of glibc. Patch
is taken from upstream.
(From OE-Core rev: b1b7a46f0febe7ac17ec46ecdf88b4120a7d75c4)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
| -rw-r--r-- | meta/recipes-devtools/qemu/qemu/04b33e21866412689f18b7ad6daf0a54d8f959a7.patch | 282 | ||||
| -rw-r--r-- | meta/recipes-devtools/qemu/qemu_2.7.0.bb | 1 |
2 files changed, 283 insertions, 0 deletions
diff --git a/meta/recipes-devtools/qemu/qemu/04b33e21866412689f18b7ad6daf0a54d8f959a7.patch b/meta/recipes-devtools/qemu/qemu/04b33e21866412689f18b7ad6daf0a54d8f959a7.patch new file mode 100644 index 0000000000..d947e8cba9 --- /dev/null +++ b/meta/recipes-devtools/qemu/qemu/04b33e21866412689f18b7ad6daf0a54d8f959a7.patch | |||
| @@ -0,0 +1,282 @@ | |||
| 1 | From 04b33e21866412689f18b7ad6daf0a54d8f959a7 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Khem Raj <raj.khem@gmail.com> | ||
| 3 | Date: Wed, 28 Jun 2017 13:44:52 -0700 | ||
| 4 | Subject: [PATCH] Replace 'struct ucontext' with 'ucontext_t' type | ||
| 5 | |||
| 6 | glibc used to have: | ||
| 7 | |||
| 8 | typedef struct ucontext { ... } ucontext_t; | ||
| 9 | |||
| 10 | glibc now has: | ||
| 11 | |||
| 12 | typedef struct ucontext_t { ... } ucontext_t; | ||
| 13 | |||
| 14 | (See https://sourceware.org/bugzilla/show_bug.cgi?id=21457 | ||
| 15 | for detail and rationale for the glibc change) | ||
| 16 | |||
| 17 | However, QEMU used "struct ucontext" in declarations. This is a | ||
| 18 | private name and compatibility cannot be guaranteed. Switch to | ||
| 19 | only using the standardized type name. | ||
| 20 | |||
| 21 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 22 | Message-id: 20170628204452.41230-1-raj.khem@gmail.com | ||
| 23 | Cc: Kamil Rytarowski <kamil@netbsd.org> | ||
| 24 | Cc: Riku Voipio <riku.voipio@iki.fi> | ||
| 25 | Cc: Laurent Vivier <laurent@vivier.eu> | ||
| 26 | Cc: Paolo Bonzini <pbonzini@redhat.com> | ||
| 27 | Reviewed-by: Eric Blake <eblake@redhat.com> | ||
| 28 | [PMM: Rewrote commit message, based mostly on the one from | ||
| 29 | Nathaniel McCallum] | ||
| 30 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
| 31 | |||
| 32 | Upstream-Status: Backport | ||
| 33 | RP 2017/9/6 | ||
| 34 | --- | ||
| 35 | linux-user/host/aarch64/hostdep.h | 2 +- | ||
| 36 | linux-user/host/arm/hostdep.h | 2 +- | ||
| 37 | linux-user/host/i386/hostdep.h | 2 +- | ||
| 38 | linux-user/host/ppc64/hostdep.h | 2 +- | ||
| 39 | linux-user/host/s390x/hostdep.h | 2 +- | ||
| 40 | linux-user/host/x86_64/hostdep.h | 2 +- | ||
| 41 | linux-user/signal.c | 10 +++++----- | ||
| 42 | tests/tcg/test-i386.c | 4 ++-- | ||
| 43 | user-exec.c | 18 +++++++++--------- | ||
| 44 | 9 files changed, 22 insertions(+), 22 deletions(-) | ||
| 45 | |||
| 46 | diff --git a/linux-user/host/aarch64/hostdep.h b/linux-user/host/aarch64/hostdep.h | ||
| 47 | index 64f75ce..a8d41a2 100644 | ||
| 48 | --- a/linux-user/host/aarch64/hostdep.h | ||
| 49 | +++ b/linux-user/host/aarch64/hostdep.h | ||
| 50 | @@ -24,7 +24,7 @@ extern char safe_syscall_end[]; | ||
| 51 | /* Adjust the signal context to rewind out of safe-syscall if we're in it */ | ||
| 52 | static inline void rewind_if_in_safe_syscall(void *puc) | ||
| 53 | { | ||
| 54 | - struct ucontext *uc = puc; | ||
| 55 | + ucontext_t *uc = puc; | ||
| 56 | __u64 *pcreg = &uc->uc_mcontext.pc; | ||
| 57 | |||
| 58 | if (*pcreg > (uintptr_t)safe_syscall_start | ||
| 59 | diff --git a/linux-user/host/arm/hostdep.h b/linux-user/host/arm/hostdep.h | ||
| 60 | index 5c1ae60..9276fe6 100644 | ||
| 61 | --- a/linux-user/host/arm/hostdep.h | ||
| 62 | +++ b/linux-user/host/arm/hostdep.h | ||
| 63 | @@ -24,7 +24,7 @@ extern char safe_syscall_end[]; | ||
| 64 | /* Adjust the signal context to rewind out of safe-syscall if we're in it */ | ||
| 65 | static inline void rewind_if_in_safe_syscall(void *puc) | ||
| 66 | { | ||
| 67 | - struct ucontext *uc = puc; | ||
| 68 | + ucontext_t *uc = puc; | ||
| 69 | unsigned long *pcreg = &uc->uc_mcontext.arm_pc; | ||
| 70 | |||
| 71 | if (*pcreg > (uintptr_t)safe_syscall_start | ||
| 72 | diff --git a/linux-user/host/i386/hostdep.h b/linux-user/host/i386/hostdep.h | ||
| 73 | index d834bd8..073be74 100644 | ||
| 74 | --- a/linux-user/host/i386/hostdep.h | ||
| 75 | +++ b/linux-user/host/i386/hostdep.h | ||
| 76 | @@ -24,7 +24,7 @@ extern char safe_syscall_end[]; | ||
| 77 | /* Adjust the signal context to rewind out of safe-syscall if we're in it */ | ||
| 78 | static inline void rewind_if_in_safe_syscall(void *puc) | ||
| 79 | { | ||
| 80 | - struct ucontext *uc = puc; | ||
| 81 | + ucontext_t *uc = puc; | ||
| 82 | greg_t *pcreg = &uc->uc_mcontext.gregs[REG_EIP]; | ||
| 83 | |||
| 84 | if (*pcreg > (uintptr_t)safe_syscall_start | ||
| 85 | diff --git a/linux-user/host/ppc64/hostdep.h b/linux-user/host/ppc64/hostdep.h | ||
| 86 | index 0b0f5f7..98979ad 100644 | ||
| 87 | --- a/linux-user/host/ppc64/hostdep.h | ||
| 88 | +++ b/linux-user/host/ppc64/hostdep.h | ||
| 89 | @@ -24,7 +24,7 @@ extern char safe_syscall_end[]; | ||
| 90 | /* Adjust the signal context to rewind out of safe-syscall if we're in it */ | ||
| 91 | static inline void rewind_if_in_safe_syscall(void *puc) | ||
| 92 | { | ||
| 93 | - struct ucontext *uc = puc; | ||
| 94 | + ucontext_t *uc = puc; | ||
| 95 | unsigned long *pcreg = &uc->uc_mcontext.gp_regs[PT_NIP]; | ||
| 96 | |||
| 97 | if (*pcreg > (uintptr_t)safe_syscall_start | ||
| 98 | diff --git a/linux-user/host/s390x/hostdep.h b/linux-user/host/s390x/hostdep.h | ||
| 99 | index 6f9da9c..4f0171f 100644 | ||
| 100 | --- a/linux-user/host/s390x/hostdep.h | ||
| 101 | +++ b/linux-user/host/s390x/hostdep.h | ||
| 102 | @@ -24,7 +24,7 @@ extern char safe_syscall_end[]; | ||
| 103 | /* Adjust the signal context to rewind out of safe-syscall if we're in it */ | ||
| 104 | static inline void rewind_if_in_safe_syscall(void *puc) | ||
| 105 | { | ||
| 106 | - struct ucontext *uc = puc; | ||
| 107 | + ucontext_t *uc = puc; | ||
| 108 | unsigned long *pcreg = &uc->uc_mcontext.psw.addr; | ||
| 109 | |||
| 110 | if (*pcreg > (uintptr_t)safe_syscall_start | ||
| 111 | diff --git a/linux-user/host/x86_64/hostdep.h b/linux-user/host/x86_64/hostdep.h | ||
| 112 | index 3b42596..a4fefb5 100644 | ||
| 113 | --- a/linux-user/host/x86_64/hostdep.h | ||
| 114 | +++ b/linux-user/host/x86_64/hostdep.h | ||
| 115 | @@ -24,7 +24,7 @@ extern char safe_syscall_end[]; | ||
| 116 | /* Adjust the signal context to rewind out of safe-syscall if we're in it */ | ||
| 117 | static inline void rewind_if_in_safe_syscall(void *puc) | ||
| 118 | { | ||
| 119 | - struct ucontext *uc = puc; | ||
| 120 | + ucontext_t *uc = puc; | ||
| 121 | greg_t *pcreg = &uc->uc_mcontext.gregs[REG_RIP]; | ||
| 122 | |||
| 123 | if (*pcreg > (uintptr_t)safe_syscall_start | ||
| 124 | diff --git a/linux-user/signal.c b/linux-user/signal.c | ||
| 125 | index d68bd26..cc0c3fc 100644 | ||
| 126 | --- a/linux-user/signal.c | ||
| 127 | +++ b/linux-user/signal.c | ||
| 128 | @@ -3346,7 +3346,7 @@ static void setup_rt_frame(int sig, struct target_sigaction *ka, | ||
| 129 | * | ||
| 130 | * a0 = signal number | ||
| 131 | * a1 = pointer to siginfo_t | ||
| 132 | - * a2 = pointer to struct ucontext | ||
| 133 | + * a2 = pointer to ucontext_t | ||
| 134 | * | ||
| 135 | * $25 and PC point to the signal handler, $29 points to the | ||
| 136 | * struct sigframe. | ||
| 137 | @@ -3764,7 +3764,7 @@ struct target_signal_frame { | ||
| 138 | |||
| 139 | struct rt_signal_frame { | ||
| 140 | siginfo_t info; | ||
| 141 | - struct ucontext uc; | ||
| 142 | + ucontext_t uc; | ||
| 143 | uint32_t tramp[2]; | ||
| 144 | }; | ||
| 145 | |||
| 146 | @@ -3980,7 +3980,7 @@ struct rt_signal_frame { | ||
| 147 | siginfo_t *pinfo; | ||
| 148 | void *puc; | ||
| 149 | siginfo_t info; | ||
| 150 | - struct ucontext uc; | ||
| 151 | + ucontext_t uc; | ||
| 152 | uint16_t retcode[4]; /* Trampoline code. */ | ||
| 153 | }; | ||
| 154 | |||
| 155 | @@ -4515,7 +4515,7 @@ static void setup_rt_frame(int sig, struct target_sigaction *ka, | ||
| 156 | tswap_siginfo(&frame->info, info); | ||
| 157 | } | ||
| 158 | |||
| 159 | - /*err |= __clear_user(&frame->uc, offsetof(struct ucontext, uc_mcontext));*/ | ||
| 160 | + /*err |= __clear_user(&frame->uc, offsetof(ucontext_t, uc_mcontext));*/ | ||
| 161 | __put_user(0, &frame->uc.tuc_flags); | ||
| 162 | __put_user(0, &frame->uc.tuc_link); | ||
| 163 | __put_user(target_sigaltstack_used.ss_sp, | ||
| 164 | @@ -5007,7 +5007,7 @@ enum { | ||
| 165 | |||
| 166 | struct target_ucontext { | ||
| 167 | target_ulong tuc_flags; | ||
| 168 | - target_ulong tuc_link; /* struct ucontext __user * */ | ||
| 169 | + target_ulong tuc_link; /* ucontext_t __user * */ | ||
| 170 | struct target_sigaltstack tuc_stack; | ||
| 171 | #if !defined(TARGET_PPC64) | ||
| 172 | int32_t tuc_pad[7]; | ||
| 173 | diff --git a/tests/tcg/test-i386.c b/tests/tcg/test-i386.c | ||
| 174 | index 0f7b943..9599204 100644 | ||
| 175 | --- a/tests/tcg/test-i386.c | ||
| 176 | +++ b/tests/tcg/test-i386.c | ||
| 177 | @@ -1720,7 +1720,7 @@ int tab[2]; | ||
| 178 | |||
| 179 | void sig_handler(int sig, siginfo_t *info, void *puc) | ||
| 180 | { | ||
| 181 | - struct ucontext *uc = puc; | ||
| 182 | + ucontext_t *uc = puc; | ||
| 183 | |||
| 184 | printf("si_signo=%d si_errno=%d si_code=%d", | ||
| 185 | info->si_signo, info->si_errno, info->si_code); | ||
| 186 | @@ -1912,7 +1912,7 @@ void test_exceptions(void) | ||
| 187 | /* specific precise single step test */ | ||
| 188 | void sig_trap_handler(int sig, siginfo_t *info, void *puc) | ||
| 189 | { | ||
| 190 | - struct ucontext *uc = puc; | ||
| 191 | + ucontext_t *uc = puc; | ||
| 192 | printf("EIP=" FMTLX "\n", (long)uc->uc_mcontext.gregs[REG_EIP]); | ||
| 193 | } | ||
| 194 | |||
| 195 | diff --git a/user-exec.c b/user-exec.c | ||
| 196 | index a8f95fa..2a975ea 100644 | ||
| 197 | --- a/user-exec.c | ||
| 198 | +++ b/user-exec.c | ||
| 199 | @@ -167,7 +167,7 @@ int cpu_signal_handler(int host_signum, void *pinfo, | ||
| 200 | #elif defined(__OpenBSD__) | ||
| 201 | struct sigcontext *uc = puc; | ||
| 202 | #else | ||
| 203 | - struct ucontext *uc = puc; | ||
| 204 | + ucontext_t *uc = puc; | ||
| 205 | #endif | ||
| 206 | unsigned long pc; | ||
| 207 | int trapno; | ||
| 208 | @@ -222,7 +222,7 @@ int cpu_signal_handler(int host_signum, void *pinfo, | ||
| 209 | #elif defined(__OpenBSD__) | ||
| 210 | struct sigcontext *uc = puc; | ||
| 211 | #else | ||
| 212 | - struct ucontext *uc = puc; | ||
| 213 | + ucontext_t *uc = puc; | ||
| 214 | #endif | ||
| 215 | |||
| 216 | pc = PC_sig(uc); | ||
| 217 | @@ -289,7 +289,7 @@ int cpu_signal_handler(int host_signum, void *pinfo, | ||
| 218 | #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) | ||
| 219 | ucontext_t *uc = puc; | ||
| 220 | #else | ||
| 221 | - struct ucontext *uc = puc; | ||
| 222 | + ucontext_t *uc = puc; | ||
| 223 | #endif | ||
| 224 | unsigned long pc; | ||
| 225 | int is_write; | ||
| 226 | @@ -316,7 +316,7 @@ int cpu_signal_handler(int host_signum, void *pinfo, | ||
| 227 | void *puc) | ||
| 228 | { | ||
| 229 | siginfo_t *info = pinfo; | ||
| 230 | - struct ucontext *uc = puc; | ||
| 231 | + ucontext_t *uc = puc; | ||
| 232 | uint32_t *pc = uc->uc_mcontext.sc_pc; | ||
| 233 | uint32_t insn = *pc; | ||
| 234 | int is_write = 0; | ||
| 235 | @@ -414,7 +414,7 @@ int cpu_signal_handler(int host_signum, void *pinfo, | ||
| 236 | #if defined(__NetBSD__) | ||
| 237 | ucontext_t *uc = puc; | ||
| 238 | #else | ||
| 239 | - struct ucontext *uc = puc; | ||
| 240 | + ucontext_t *uc = puc; | ||
| 241 | #endif | ||
| 242 | unsigned long pc; | ||
| 243 | int is_write; | ||
| 244 | @@ -441,7 +441,7 @@ int cpu_signal_handler(int host_signum, void *pinfo, | ||
| 245 | int cpu_signal_handler(int host_signum, void *pinfo, void *puc) | ||
| 246 | { | ||
| 247 | siginfo_t *info = pinfo; | ||
| 248 | - struct ucontext *uc = puc; | ||
| 249 | + ucontext_t *uc = puc; | ||
| 250 | uintptr_t pc = uc->uc_mcontext.pc; | ||
| 251 | uint32_t insn = *(uint32_t *)pc; | ||
| 252 | bool is_write; | ||
| 253 | @@ -474,7 +474,7 @@ int cpu_signal_handler(int host_signum, void *pinfo, void *puc) | ||
| 254 | int cpu_signal_handler(int host_signum, void *pinfo, void *puc) | ||
| 255 | { | ||
| 256 | siginfo_t *info = pinfo; | ||
| 257 | - struct ucontext *uc = puc; | ||
| 258 | + ucontext_t *uc = puc; | ||
| 259 | unsigned long ip; | ||
| 260 | int is_write = 0; | ||
| 261 | |||
| 262 | @@ -505,7 +505,7 @@ int cpu_signal_handler(int host_signum, void *pinfo, | ||
| 263 | void *puc) | ||
| 264 | { | ||
| 265 | siginfo_t *info = pinfo; | ||
| 266 | - struct ucontext *uc = puc; | ||
| 267 | + ucontext_t *uc = puc; | ||
| 268 | unsigned long pc; | ||
| 269 | uint16_t *pinsn; | ||
| 270 | int is_write = 0; | ||
| 271 | @@ -558,7 +558,7 @@ int cpu_signal_handler(int host_signum, void *pinfo, | ||
| 272 | void *puc) | ||
| 273 | { | ||
| 274 | siginfo_t *info = pinfo; | ||
| 275 | - struct ucontext *uc = puc; | ||
| 276 | + ucontext_t *uc = puc; | ||
| 277 | greg_t pc = uc->uc_mcontext.pc; | ||
| 278 | int is_write; | ||
| 279 | |||
| 280 | -- | ||
| 281 | 1.8.3.1 | ||
| 282 | |||
diff --git a/meta/recipes-devtools/qemu/qemu_2.7.0.bb b/meta/recipes-devtools/qemu/qemu_2.7.0.bb index cef181dcea..85aadecf09 100644 --- a/meta/recipes-devtools/qemu/qemu_2.7.0.bb +++ b/meta/recipes-devtools/qemu/qemu_2.7.0.bb | |||
| @@ -13,6 +13,7 @@ SRC_URI += "file://configure-fix-Darwin-target-detection.patch \ | |||
| 13 | file://0002-fix-CVE-2016-7423.patch \ | 13 | file://0002-fix-CVE-2016-7423.patch \ |
| 14 | file://0003-fix-CVE-2016-7908.patch \ | 14 | file://0003-fix-CVE-2016-7908.patch \ |
| 15 | file://0004-fix-CVE-2016-7909.patch \ | 15 | file://0004-fix-CVE-2016-7909.patch \ |
| 16 | file://04b33e21866412689f18b7ad6daf0a54d8f959a7.patch \ | ||
| 16 | " | 17 | " |
| 17 | 18 | ||
| 18 | SRC_URI_prepend = "http://wiki.qemu-project.org/download/${BP}.tar.bz2" | 19 | SRC_URI_prepend = "http://wiki.qemu-project.org/download/${BP}.tar.bz2" |
