Gentoo Archives: gentoo-commits

From: Matthias Maier <tamiko@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: app-emulation/qemu/files/, app-emulation/qemu/
Date: Mon, 05 Sep 2016 16:45:56
Message-Id: 1473093942.fd20fa64ab7026533a5e4c554697cc4bcab9e7ef.tamiko@gentoo
1 commit: fd20fa64ab7026533a5e4c554697cc4bcab9e7ef
2 Author: Matthias Maier <tamiko <AT> gentoo <DOT> org>
3 AuthorDate: Mon Sep 5 16:42:22 2016 +0000
4 Commit: Matthias Maier <tamiko <AT> gentoo <DOT> org>
5 CommitDate: Mon Sep 5 16:45:42 2016 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=fd20fa64
7
8 app-emulation/qemu: drop vulnerable 2.5.1, bug #592430, and 19 others
9
10 Package-Manager: portage-2.2.28
11
12 .../qemu/files/qemu-2.5.0-CVE-2015-8558.patch | 50 --
13 .../qemu/files/qemu-2.5.0-CVE-2016-2198.patch | 46 --
14 .../files/qemu-2.5.0-rng-stack-corrupt-0.patch | 98 ---
15 .../files/qemu-2.5.0-rng-stack-corrupt-1.patch | 135 ----
16 .../files/qemu-2.5.0-rng-stack-corrupt-2.patch | 155 -----
17 .../files/qemu-2.5.0-rng-stack-corrupt-3.patch | 179 ------
18 .../qemu/files/qemu-2.5.1-CVE-2015-8558.patch | 107 ----
19 .../qemu/files/qemu-2.5.1-CVE-2016-4020.patch | 16 -
20 .../files/qemu-2.5.1-stellaris_enet-overflow.patch | 47 --
21 .../qemu/files/qemu-2.5.1-xfs-linux-headers.patch | 82 ---
22 app-emulation/qemu/qemu-2.5.1.ebuild | 693 ---------------------
23 11 files changed, 1608 deletions(-)
24
25 diff --git a/app-emulation/qemu/files/qemu-2.5.0-CVE-2015-8558.patch b/app-emulation/qemu/files/qemu-2.5.0-CVE-2015-8558.patch
26 deleted file mode 100644
27 index fbc6a0a..00000000
28 --- a/app-emulation/qemu/files/qemu-2.5.0-CVE-2015-8558.patch
29 +++ /dev/null
30 @@ -1,50 +0,0 @@
31 -https://bugs.gentoo.org/568246
32 -
33 -From 156a2e4dbffa85997636a7a39ef12da6f1b40254 Mon Sep 17 00:00:00 2001
34 -From: Gerd Hoffmann <kraxel@××××××.com>
35 -Date: Mon, 14 Dec 2015 09:21:23 +0100
36 -Subject: [PATCH] ehci: make idt processing more robust
37 -
38 -Make ehci_process_itd return an error in case we didn't do any actual
39 -iso transfer because we've found no active transaction. That'll avoid
40 -ehci happily run in circles forever if the guest builds a loop out of
41 -idts.
42 -
43 -This is CVE-2015-8558.
44 -
45 -Cc: qemu-stable@××××××.org
46 -Reported-by: Qinghao Tang <luodalongde@×××××.com>
47 -Tested-by: P J P <ppandit@××××××.com>
48 -Signed-off-by: Gerd Hoffmann <kraxel@××××××.com>
49 ----
50 - hw/usb/hcd-ehci.c | 5 +++--
51 - 1 file changed, 3 insertions(+), 2 deletions(-)
52 -
53 -diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c
54 -index 4e2161b..d07f228 100644
55 ---- a/hw/usb/hcd-ehci.c
56 -+++ b/hw/usb/hcd-ehci.c
57 -@@ -1389,7 +1389,7 @@ static int ehci_process_itd(EHCIState *ehci,
58 - {
59 - USBDevice *dev;
60 - USBEndpoint *ep;
61 -- uint32_t i, len, pid, dir, devaddr, endp;
62 -+ uint32_t i, len, pid, dir, devaddr, endp, xfers = 0;
63 - uint32_t pg, off, ptr1, ptr2, max, mult;
64 -
65 - ehci->periodic_sched_active = PERIODIC_ACTIVE;
66 -@@ -1479,9 +1479,10 @@ static int ehci_process_itd(EHCIState *ehci,
67 - ehci_raise_irq(ehci, USBSTS_INT);
68 - }
69 - itd->transact[i] &= ~ITD_XACT_ACTIVE;
70 -+ xfers++;
71 - }
72 - }
73 -- return 0;
74 -+ return xfers ? 0 : -1;
75 - }
76 -
77 -
78 ---
79 -2.6.2
80 -
81
82 diff --git a/app-emulation/qemu/files/qemu-2.5.0-CVE-2016-2198.patch b/app-emulation/qemu/files/qemu-2.5.0-CVE-2016-2198.patch
83 deleted file mode 100644
84 index d179c33..00000000
85 --- a/app-emulation/qemu/files/qemu-2.5.0-CVE-2016-2198.patch
86 +++ /dev/null
87 @@ -1,46 +0,0 @@
88 -From dff0367cf66f489aa772320fa2937a8cac1ca30d Mon Sep 17 00:00:00 2001
89 -From: Prasad J Pandit <pjp@×××××××××××××.org>
90 -Date: Fri, 29 Jan 2016 18:30:34 +0530
91 -Subject: [PATCH] usb: ehci: add capability mmio write function
92 -
93 -USB Ehci emulation supports host controller capability registers.
94 -But its mmio '.write' function was missing, which lead to a null
95 -pointer dereference issue. Add a do nothing 'ehci_caps_write'
96 -definition to avoid it; Do nothing because capability registers
97 -are Read Only(RO).
98 -
99 -Reported-by: Zuozhi Fzz <zuozhi.fzz@×××××××××××.com>
100 -Signed-off-by: Prasad J Pandit <pjp@×××××××××××××.org>
101 -Message-id: 1454072434-16045-1-git-send-email-ppandit@××××××.com
102 -Signed-off-by: Gerd Hoffmann <kraxel@××××××.com>
103 ----
104 - hw/usb/hcd-ehci.c | 6 ++++++
105 - 1 file changed, 6 insertions(+)
106 -
107 -diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c
108 -index 1b50601..0f95d0d 100644
109 ---- a/hw/usb/hcd-ehci.c
110 -+++ b/hw/usb/hcd-ehci.c
111 -@@ -895,6 +895,11 @@ static uint64_t ehci_caps_read(void *ptr, hwaddr addr,
112 - return s->caps[addr];
113 - }
114 -
115 -+static void ehci_caps_write(void *ptr, hwaddr addr,
116 -+ uint64_t val, unsigned size)
117 -+{
118 -+}
119 -+
120 - static uint64_t ehci_opreg_read(void *ptr, hwaddr addr,
121 - unsigned size)
122 - {
123 -@@ -2315,6 +2320,7 @@ static void ehci_frame_timer(void *opaque)
124 -
125 - static const MemoryRegionOps ehci_mmio_caps_ops = {
126 - .read = ehci_caps_read,
127 -+ .write = ehci_caps_write,
128 - .valid.min_access_size = 1,
129 - .valid.max_access_size = 4,
130 - .impl.min_access_size = 1,
131 ---
132 -2.7.4
133 -
134
135 diff --git a/app-emulation/qemu/files/qemu-2.5.0-rng-stack-corrupt-0.patch b/app-emulation/qemu/files/qemu-2.5.0-rng-stack-corrupt-0.patch
136 deleted file mode 100644
137 index 684f6ad..00000000
138 --- a/app-emulation/qemu/files/qemu-2.5.0-rng-stack-corrupt-0.patch
139 +++ /dev/null
140 @@ -1,98 +0,0 @@
141 -From 3c52ddcdc548e7fbe65112d8a7bdc9cd105b4750 Mon Sep 17 00:00:00 2001
142 -From: Ladi Prosek <lprosek@××××××.com>
143 -Date: Thu, 3 Mar 2016 09:37:15 +0100
144 -Subject: [PATCH] rng: remove the unused request cancellation code
145 -
146 -rng_backend_cancel_requests had no callers and none of the code
147 -deleted in this commit ever ran.
148 -
149 -Signed-off-by: Ladi Prosek <lprosek@××××××.com>
150 -Reviewed-by: Amit Shah <amit.shah@××××××.com>
151 -Message-Id: <1456994238-9585-2-git-send-email-lprosek@××××××.com>
152 -Signed-off-by: Amit Shah <amit.shah@××××××.com>
153 ----
154 - backends/rng-egd.c | 12 ------------
155 - backends/rng.c | 9 ---------
156 - include/sysemu/rng.h | 11 -----------
157 - 3 files changed, 32 deletions(-)
158 -
159 -diff --git a/backends/rng-egd.c b/backends/rng-egd.c
160 -index 2de5cd5..0b2976a 100644
161 ---- a/backends/rng-egd.c
162 -+++ b/backends/rng-egd.c
163 -@@ -125,17 +125,6 @@ static void rng_egd_free_requests(RngEgd *s)
164 - s->requests = NULL;
165 - }
166 -
167 --static void rng_egd_cancel_requests(RngBackend *b)
168 --{
169 -- RngEgd *s = RNG_EGD(b);
170 --
171 -- /* We simply delete the list of pending requests. If there is data in the
172 -- * queue waiting to be read, this is okay, because there will always be
173 -- * more data than we requested originally
174 -- */
175 -- rng_egd_free_requests(s);
176 --}
177 --
178 - static void rng_egd_opened(RngBackend *b, Error **errp)
179 - {
180 - RngEgd *s = RNG_EGD(b);
181 -@@ -213,7 +202,6 @@ static void rng_egd_class_init(ObjectClass *klass, void *data)
182 - RngBackendClass *rbc = RNG_BACKEND_CLASS(klass);
183 -
184 - rbc->request_entropy = rng_egd_request_entropy;
185 -- rbc->cancel_requests = rng_egd_cancel_requests;
186 - rbc->opened = rng_egd_opened;
187 - }
188 -
189 -diff --git a/backends/rng.c b/backends/rng.c
190 -index b7820ef..2f2f3ee 100644
191 ---- a/backends/rng.c
192 -+++ b/backends/rng.c
193 -@@ -26,15 +26,6 @@ void rng_backend_request_entropy(RngBackend *s, size_t size,
194 - }
195 - }
196 -
197 --void rng_backend_cancel_requests(RngBackend *s)
198 --{
199 -- RngBackendClass *k = RNG_BACKEND_GET_CLASS(s);
200 --
201 -- if (k->cancel_requests) {
202 -- k->cancel_requests(s);
203 -- }
204 --}
205 --
206 - static bool rng_backend_prop_get_opened(Object *obj, Error **errp)
207 - {
208 - RngBackend *s = RNG_BACKEND(obj);
209 -diff --git a/include/sysemu/rng.h b/include/sysemu/rng.h
210 -index 858be8c..87b3ebe 100644
211 ---- a/include/sysemu/rng.h
212 -+++ b/include/sysemu/rng.h
213 -@@ -37,7 +37,6 @@ struct RngBackendClass
214 -
215 - void (*request_entropy)(RngBackend *s, size_t size,
216 - EntropyReceiveFunc *receive_entropy, void *opaque);
217 -- void (*cancel_requests)(RngBackend *s);
218 -
219 - void (*opened)(RngBackend *s, Error **errp);
220 - };
221 -@@ -68,14 +67,4 @@ struct RngBackend
222 - void rng_backend_request_entropy(RngBackend *s, size_t size,
223 - EntropyReceiveFunc *receive_entropy,
224 - void *opaque);
225 --
226 --/**
227 -- * rng_backend_cancel_requests:
228 -- * @s: the backend to cancel all pending requests in
229 -- *
230 -- * Cancels all pending requests submitted by @rng_backend_request_entropy. This
231 -- * should be used by a device during reset or in preparation for live migration
232 -- * to stop tracking any request.
233 -- */
234 --void rng_backend_cancel_requests(RngBackend *s);
235 - #endif
236 ---
237 -2.7.4
238 -
239
240 diff --git a/app-emulation/qemu/files/qemu-2.5.0-rng-stack-corrupt-1.patch b/app-emulation/qemu/files/qemu-2.5.0-rng-stack-corrupt-1.patch
241 deleted file mode 100644
242 index 44ba8a7..00000000
243 --- a/app-emulation/qemu/files/qemu-2.5.0-rng-stack-corrupt-1.patch
244 +++ /dev/null
245 @@ -1,135 +0,0 @@
246 -From 74074e8a7c60592cf1cc6469dbc2550d24aeded3 Mon Sep 17 00:00:00 2001
247 -From: Ladi Prosek <lprosek@××××××.com>
248 -Date: Thu, 3 Mar 2016 09:37:16 +0100
249 -Subject: [PATCH] rng: move request queue from RngEgd to RngBackend
250 -
251 -The 'requests' field now lives in the RngBackend parent class.
252 -There are no functional changes in this commit.
253 -
254 -Signed-off-by: Ladi Prosek <lprosek@××××××.com>
255 -Reviewed-by: Amit Shah <amit.shah@××××××.com>
256 -Message-Id: <1456994238-9585-3-git-send-email-lprosek@××××××.com>
257 -Signed-off-by: Amit Shah <amit.shah@××××××.com>
258 ----
259 - backends/rng-egd.c | 28 +++++++++-------------------
260 - include/sysemu/rng.h | 11 +++++++++++
261 - 2 files changed, 20 insertions(+), 19 deletions(-)
262 -
263 -diff --git a/backends/rng-egd.c b/backends/rng-egd.c
264 -index 0b2976a..b061362 100644
265 ---- a/backends/rng-egd.c
266 -+++ b/backends/rng-egd.c
267 -@@ -25,19 +25,8 @@ typedef struct RngEgd
268 -
269 - CharDriverState *chr;
270 - char *chr_name;
271 --
272 -- GSList *requests;
273 - } RngEgd;
274 -
275 --typedef struct RngRequest
276 --{
277 -- EntropyReceiveFunc *receive_entropy;
278 -- uint8_t *data;
279 -- void *opaque;
280 -- size_t offset;
281 -- size_t size;
282 --} RngRequest;
283 --
284 - static void rng_egd_request_entropy(RngBackend *b, size_t size,
285 - EntropyReceiveFunc *receive_entropy,
286 - void *opaque)
287 -@@ -66,7 +55,7 @@ static void rng_egd_request_entropy(RngBackend *b, size_t size,
288 - size -= len;
289 - }
290 -
291 -- s->requests = g_slist_append(s->requests, req);
292 -+ s->parent.requests = g_slist_append(s->parent.requests, req);
293 - }
294 -
295 - static void rng_egd_free_request(RngRequest *req)
296 -@@ -81,7 +70,7 @@ static int rng_egd_chr_can_read(void *opaque)
297 - GSList *i;
298 - int size = 0;
299 -
300 -- for (i = s->requests; i; i = i->next) {
301 -+ for (i = s->parent.requests; i; i = i->next) {
302 - RngRequest *req = i->data;
303 - size += req->size - req->offset;
304 - }
305 -@@ -94,8 +83,8 @@ static void rng_egd_chr_read(void *opaque, const uint8_t *buf, int size)
306 - RngEgd *s = RNG_EGD(opaque);
307 - size_t buf_offset = 0;
308 -
309 -- while (size > 0 && s->requests) {
310 -- RngRequest *req = s->requests->data;
311 -+ while (size > 0 && s->parent.requests) {
312 -+ RngRequest *req = s->parent.requests->data;
313 - int len = MIN(size, req->size - req->offset);
314 -
315 - memcpy(req->data + req->offset, buf + buf_offset, len);
316 -@@ -104,7 +93,8 @@ static void rng_egd_chr_read(void *opaque, const uint8_t *buf, int size)
317 - size -= len;
318 -
319 - if (req->offset == req->size) {
320 -- s->requests = g_slist_remove_link(s->requests, s->requests);
321 -+ s->parent.requests = g_slist_remove_link(s->parent.requests,
322 -+ s->parent.requests);
323 -
324 - req->receive_entropy(req->opaque, req->data, req->size);
325 -
326 -@@ -117,12 +107,12 @@ static void rng_egd_free_requests(RngEgd *s)
327 - {
328 - GSList *i;
329 -
330 -- for (i = s->requests; i; i = i->next) {
331 -+ for (i = s->parent.requests; i; i = i->next) {
332 - rng_egd_free_request(i->data);
333 - }
334 -
335 -- g_slist_free(s->requests);
336 -- s->requests = NULL;
337 -+ g_slist_free(s->parent.requests);
338 -+ s->parent.requests = NULL;
339 - }
340 -
341 - static void rng_egd_opened(RngBackend *b, Error **errp)
342 -diff --git a/include/sysemu/rng.h b/include/sysemu/rng.h
343 -index 87b3ebe..c744d82 100644
344 ---- a/include/sysemu/rng.h
345 -+++ b/include/sysemu/rng.h
346 -@@ -24,6 +24,7 @@
347 - #define RNG_BACKEND_CLASS(klass) \
348 - OBJECT_CLASS_CHECK(RngBackendClass, (klass), TYPE_RNG_BACKEND)
349 -
350 -+typedef struct RngRequest RngRequest;
351 - typedef struct RngBackendClass RngBackendClass;
352 - typedef struct RngBackend RngBackend;
353 -
354 -@@ -31,6 +32,15 @@ typedef void (EntropyReceiveFunc)(void *opaque,
355 - const void *data,
356 - size_t size);
357 -
358 -+struct RngRequest
359 -+{
360 -+ EntropyReceiveFunc *receive_entropy;
361 -+ uint8_t *data;
362 -+ void *opaque;
363 -+ size_t offset;
364 -+ size_t size;
365 -+};
366 -+
367 - struct RngBackendClass
368 - {
369 - ObjectClass parent_class;
370 -@@ -47,6 +57,7 @@ struct RngBackend
371 -
372 - /*< protected >*/
373 - bool opened;
374 -+ GSList *requests;
375 - };
376 -
377 - /**
378 ---
379 -2.7.4
380 -
381
382 diff --git a/app-emulation/qemu/files/qemu-2.5.0-rng-stack-corrupt-2.patch b/app-emulation/qemu/files/qemu-2.5.0-rng-stack-corrupt-2.patch
383 deleted file mode 100644
384 index 1cffcc5..00000000
385 --- a/app-emulation/qemu/files/qemu-2.5.0-rng-stack-corrupt-2.patch
386 +++ /dev/null
387 @@ -1,155 +0,0 @@
388 -From 9f14b0add1dcdbfa2ee61051d068211fb0a1fcc9 Mon Sep 17 00:00:00 2001
389 -From: Ladi Prosek <lprosek@××××××.com>
390 -Date: Thu, 3 Mar 2016 09:37:17 +0100
391 -Subject: [PATCH] rng: move request queue cleanup from RngEgd to RngBackend
392 -
393 -RngBackend is now in charge of cleaning up the linked list on
394 -instance finalization. It also exposes a function to finalize
395 -individual RngRequest instances, called by its child classes.
396 -
397 -Signed-off-by: Ladi Prosek <lprosek@××××××.com>
398 -Reviewed-by: Amit Shah <amit.shah@××××××.com>
399 -Message-Id: <1456994238-9585-4-git-send-email-lprosek@××××××.com>
400 -Signed-off-by: Amit Shah <amit.shah@××××××.com>
401 ----
402 - backends/rng-egd.c | 25 +------------------------
403 - backends/rng.c | 32 ++++++++++++++++++++++++++++++++
404 - include/sysemu/rng.h | 12 ++++++++++++
405 - 3 files changed, 45 insertions(+), 24 deletions(-)
406 -
407 -diff --git a/backends/rng-egd.c b/backends/rng-egd.c
408 -index b061362..8f2bd16 100644
409 ---- a/backends/rng-egd.c
410 -+++ b/backends/rng-egd.c
411 -@@ -58,12 +58,6 @@ static void rng_egd_request_entropy(RngBackend *b, size_t size,
412 - s->parent.requests = g_slist_append(s->parent.requests, req);
413 - }
414 -
415 --static void rng_egd_free_request(RngRequest *req)
416 --{
417 -- g_free(req->data);
418 -- g_free(req);
419 --}
420 --
421 - static int rng_egd_chr_can_read(void *opaque)
422 - {
423 - RngEgd *s = RNG_EGD(opaque);
424 -@@ -93,28 +87,13 @@ static void rng_egd_chr_read(void *opaque, const uint8_t *buf, int size)
425 - size -= len;
426 -
427 - if (req->offset == req->size) {
428 -- s->parent.requests = g_slist_remove_link(s->parent.requests,
429 -- s->parent.requests);
430 --
431 - req->receive_entropy(req->opaque, req->data, req->size);
432 -
433 -- rng_egd_free_request(req);
434 -+ rng_backend_finalize_request(&s->parent, req);
435 - }
436 - }
437 - }
438 -
439 --static void rng_egd_free_requests(RngEgd *s)
440 --{
441 -- GSList *i;
442 --
443 -- for (i = s->parent.requests; i; i = i->next) {
444 -- rng_egd_free_request(i->data);
445 -- }
446 --
447 -- g_slist_free(s->parent.requests);
448 -- s->parent.requests = NULL;
449 --}
450 --
451 - static void rng_egd_opened(RngBackend *b, Error **errp)
452 - {
453 - RngEgd *s = RNG_EGD(b);
454 -@@ -183,8 +162,6 @@ static void rng_egd_finalize(Object *obj)
455 - }
456 -
457 - g_free(s->chr_name);
458 --
459 -- rng_egd_free_requests(s);
460 - }
461 -
462 - static void rng_egd_class_init(ObjectClass *klass, void *data)
463 -diff --git a/backends/rng.c b/backends/rng.c
464 -index 2f2f3ee..014cb9d 100644
465 ---- a/backends/rng.c
466 -+++ b/backends/rng.c
467 -@@ -64,6 +64,30 @@ static void rng_backend_prop_set_opened(Object *obj, bool value, Error **errp)
468 - s->opened = true;
469 - }
470 -
471 -+static void rng_backend_free_request(RngRequest *req)
472 -+{
473 -+ g_free(req->data);
474 -+ g_free(req);
475 -+}
476 -+
477 -+static void rng_backend_free_requests(RngBackend *s)
478 -+{
479 -+ GSList *i;
480 -+
481 -+ for (i = s->requests; i; i = i->next) {
482 -+ rng_backend_free_request(i->data);
483 -+ }
484 -+
485 -+ g_slist_free(s->requests);
486 -+ s->requests = NULL;
487 -+}
488 -+
489 -+void rng_backend_finalize_request(RngBackend *s, RngRequest *req)
490 -+{
491 -+ s->requests = g_slist_remove(s->requests, req);
492 -+ rng_backend_free_request(req);
493 -+}
494 -+
495 - static void rng_backend_init(Object *obj)
496 - {
497 - object_property_add_bool(obj, "opened",
498 -@@ -72,6 +96,13 @@ static void rng_backend_init(Object *obj)
499 - NULL);
500 - }
501 -
502 -+static void rng_backend_finalize(Object *obj)
503 -+{
504 -+ RngBackend *s = RNG_BACKEND(obj);
505 -+
506 -+ rng_backend_free_requests(s);
507 -+}
508 -+
509 - static void rng_backend_class_init(ObjectClass *oc, void *data)
510 - {
511 - UserCreatableClass *ucc = USER_CREATABLE_CLASS(oc);
512 -@@ -84,6 +115,7 @@ static const TypeInfo rng_backend_info = {
513 - .parent = TYPE_OBJECT,
514 - .instance_size = sizeof(RngBackend),
515 - .instance_init = rng_backend_init,
516 -+ .instance_finalize = rng_backend_finalize,
517 - .class_size = sizeof(RngBackendClass),
518 - .class_init = rng_backend_class_init,
519 - .abstract = true,
520 -diff --git a/include/sysemu/rng.h b/include/sysemu/rng.h
521 -index c744d82..08a2eda 100644
522 ---- a/include/sysemu/rng.h
523 -+++ b/include/sysemu/rng.h
524 -@@ -78,4 +79,15 @@ struct RngBackend
525 - void rng_backend_request_entropy(RngBackend *s, size_t size,
526 - EntropyReceiveFunc *receive_entropy,
527 - void *opaque);
528 -+
529 -+/**
530 -+ * rng_backend_free_request:
531 -+ * @s: the backend that created the request
532 -+ * @req: the request to finalize
533 -+ *
534 -+ * Used by child rng backend classes to finalize requests once they've been
535 -+ * processed. The request is removed from the list of active requests and
536 -+ * deleted.
537 -+ */
538 -+void rng_backend_finalize_request(RngBackend *s, RngRequest *req);
539 - #endif
540 ---
541 -2.7.4
542 -
543
544 diff --git a/app-emulation/qemu/files/qemu-2.5.0-rng-stack-corrupt-3.patch b/app-emulation/qemu/files/qemu-2.5.0-rng-stack-corrupt-3.patch
545 deleted file mode 100644
546 index ca9340a..00000000
547 --- a/app-emulation/qemu/files/qemu-2.5.0-rng-stack-corrupt-3.patch
548 +++ /dev/null
549 @@ -1,179 +0,0 @@
550 -From 60253ed1e6ec6d8e5ef2efe7bf755f475dce9956 Mon Sep 17 00:00:00 2001
551 -From: Ladi Prosek <lprosek@××××××.com>
552 -Date: Thu, 3 Mar 2016 09:37:18 +0100
553 -Subject: [PATCH] rng: add request queue support to rng-random
554 -
555 -Requests are now created in the RngBackend parent class and the
556 -code path is shared by both rng-egd and rng-random.
557 -
558 -This commit fixes the rng-random implementation which processed
559 -only one request at a time and simply discarded all but the most
560 -recent one. In the guest this manifested as delayed completion
561 -of reads from virtio-rng, i.e. a read was completed only after
562 -another read was issued.
563 -
564 -By switching rng-random to use the same request queue as rng-egd,
565 -the unsafe stack-based allocation of the entropy buffer is
566 -eliminated and replaced with g_malloc.
567 -
568 -Signed-off-by: Ladi Prosek <lprosek@××××××.com>
569 -Reviewed-by: Amit Shah <amit.shah@××××××.com>
570 -Message-Id: <1456994238-9585-5-git-send-email-lprosek@××××××.com>
571 -Signed-off-by: Amit Shah <amit.shah@××××××.com>
572 ----
573 - backends/rng-egd.c | 16 ++--------------
574 - backends/rng-random.c | 43 +++++++++++++++++++------------------------
575 - backends/rng.c | 13 ++++++++++++-
576 - include/sysemu/rng.h | 3 +--
577 - 4 files changed, 34 insertions(+), 41 deletions(-)
578 -
579 -diff --git a/backends/rng-egd.c b/backends/rng-egd.c
580 -index 8f2bd16..30332ed 100644
581 ---- a/backends/rng-egd.c
582 -+++ b/backends/rng-egd.c
583 -@@ -27,20 +27,10 @@ typedef struct RngEgd
584 - char *chr_name;
585 - } RngEgd;
586 -
587 --static void rng_egd_request_entropy(RngBackend *b, size_t size,
588 -- EntropyReceiveFunc *receive_entropy,
589 -- void *opaque)
590 -+static void rng_egd_request_entropy(RngBackend *b, RngRequest *req)
591 - {
592 - RngEgd *s = RNG_EGD(b);
593 -- RngRequest *req;
594 --
595 -- req = g_malloc(sizeof(*req));
596 --
597 -- req->offset = 0;
598 -- req->size = size;
599 -- req->receive_entropy = receive_entropy;
600 -- req->opaque = opaque;
601 -- req->data = g_malloc(req->size);
602 -+ size_t size = req->size;
603 -
604 - while (size > 0) {
605 - uint8_t header[2];
606 -@@ -54,8 +44,6 @@ static void rng_egd_request_entropy(RngBackend *b, size_t size,
607 -
608 - size -= len;
609 - }
610 --
611 -- s->parent.requests = g_slist_append(s->parent.requests, req);
612 - }
613 -
614 - static int rng_egd_chr_can_read(void *opaque)
615 -diff --git a/backends/rng-random.c b/backends/rng-random.c
616 -index 8cdad6a..a6cb385 100644
617 ---- a/backends/rng-random.c
618 -+++ b/backends/rng-random.c
619 -@@ -22,10 +22,6 @@ struct RndRandom
620 -
621 - int fd;
622 - char *filename;
623 --
624 -- EntropyReceiveFunc *receive_func;
625 -- void *opaque;
626 -- size_t size;
627 - };
628 -
629 - /**
630 -@@ -38,36 +34,35 @@ struct RndRandom
631 - static void entropy_available(void *opaque)
632 - {
633 - RndRandom *s = RNG_RANDOM(opaque);
634 -- uint8_t buffer[s->size];
635 -- ssize_t len;
636 -
637 -- len = read(s->fd, buffer, s->size);
638 -- if (len < 0 && errno == EAGAIN) {
639 -- return;
640 -- }
641 -- g_assert(len != -1);
642 -+ while (s->parent.requests != NULL) {
643 -+ RngRequest *req = s->parent.requests->data;
644 -+ ssize_t len;
645 -+
646 -+ len = read(s->fd, req->data, req->size);
647 -+ if (len < 0 && errno == EAGAIN) {
648 -+ return;
649 -+ }
650 -+ g_assert(len != -1);
651 -
652 -- s->receive_func(s->opaque, buffer, len);
653 -- s->receive_func = NULL;
654 -+ req->receive_entropy(req->opaque, req->data, len);
655 -
656 -+ rng_backend_finalize_request(&s->parent, req);
657 -+ }
658 -+
659 -+ /* We've drained all requests, the fd handler can be reset. */
660 - qemu_set_fd_handler(s->fd, NULL, NULL, NULL);
661 - }
662 -
663 --static void rng_random_request_entropy(RngBackend *b, size_t size,
664 -- EntropyReceiveFunc *receive_entropy,
665 -- void *opaque)
666 -+static void rng_random_request_entropy(RngBackend *b, RngRequest *req)
667 - {
668 - RndRandom *s = RNG_RANDOM(b);
669 -
670 -- if (s->receive_func) {
671 -- s->receive_func(s->opaque, NULL, 0);
672 -+ if (s->parent.requests == NULL) {
673 -+ /* If there are no pending requests yet, we need to
674 -+ * install our fd handler. */
675 -+ qemu_set_fd_handler(s->fd, entropy_available, NULL, s);
676 - }
677 --
678 -- s->receive_func = receive_entropy;
679 -- s->opaque = opaque;
680 -- s->size = size;
681 --
682 -- qemu_set_fd_handler(s->fd, entropy_available, NULL, s);
683 - }
684 -
685 - static void rng_random_opened(RngBackend *b, Error **errp)
686 -diff --git a/backends/rng.c b/backends/rng.c
687 -index 014cb9d..277a41b 100644
688 ---- a/backends/rng.c
689 -+++ b/backends/rng.c
690 -@@ -20,9 +20,20 @@ void rng_backend_request_entropy(RngBackend *s, size_t size,
691 - void *opaque)
692 - {
693 - RngBackendClass *k = RNG_BACKEND_GET_CLASS(s);
694 -+ RngRequest *req;
695 -
696 - if (k->request_entropy) {
697 -- k->request_entropy(s, size, receive_entropy, opaque);
698 -+ req = g_malloc(sizeof(*req));
699 -+
700 -+ req->offset = 0;
701 -+ req->size = size;
702 -+ req->receive_entropy = receive_entropy;
703 -+ req->opaque = opaque;
704 -+ req->data = g_malloc(req->size);
705 -+
706 -+ k->request_entropy(s, req);
707 -+
708 -+ s->requests = g_slist_append(s->requests, req);
709 - }
710 - }
711 -
712 -diff --git a/include/sysemu/rng.h b/include/sysemu/rng.h
713 -index 08a2eda..4fffd68 100644
714 ---- a/include/sysemu/rng.h
715 -+++ b/include/sysemu/rng.h
716 -@@ -45,8 +45,7 @@ struct RngBackendClass
717 - {
718 - ObjectClass parent_class;
719 -
720 -- void (*request_entropy)(RngBackend *s, size_t size,
721 -- EntropyReceiveFunc *receive_entropy, void *opaque);
722 -+ void (*request_entropy)(RngBackend *s, RngRequest *req);
723 -
724 - void (*opened)(RngBackend *s, Error **errp);
725 - };
726 ---
727 -2.7.4
728 -
729
730 diff --git a/app-emulation/qemu/files/qemu-2.5.1-CVE-2015-8558.patch b/app-emulation/qemu/files/qemu-2.5.1-CVE-2015-8558.patch
731 deleted file mode 100644
732 index cf1a4c3..00000000
733 --- a/app-emulation/qemu/files/qemu-2.5.1-CVE-2015-8558.patch
734 +++ /dev/null
735 @@ -1,107 +0,0 @@
736 -https://bugs.gentoo.org/580426
737 -https://bugs.gentoo.org/568246
738 -
739 -From a49923d2837d20510d645d3758f1ad87c32d0730 Mon Sep 17 00:00:00 2001
740 -From: Gerd Hoffmann <kraxel@××××××.com>
741 -Date: Mon, 18 Apr 2016 09:20:54 +0200
742 -Subject: [PATCH] Revert "ehci: make idt processing more robust"
743 -
744 -This reverts commit 156a2e4dbffa85997636a7a39ef12da6f1b40254.
745 -
746 -Breaks FreeBSD.
747 -
748 -Signed-off-by: Gerd Hoffmann <kraxel@××××××.com>
749 ----
750 - hw/usb/hcd-ehci.c | 5 ++---
751 - 1 file changed, 2 insertions(+), 3 deletions(-)
752 -
753 -diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c
754 -index d5c0e1c..43a8f7a 100644
755 ---- a/hw/usb/hcd-ehci.c
756 -+++ b/hw/usb/hcd-ehci.c
757 -@@ -1397,7 +1397,7 @@ static int ehci_process_itd(EHCIState *ehci,
758 - {
759 - USBDevice *dev;
760 - USBEndpoint *ep;
761 -- uint32_t i, len, pid, dir, devaddr, endp, xfers = 0;
762 -+ uint32_t i, len, pid, dir, devaddr, endp;
763 - uint32_t pg, off, ptr1, ptr2, max, mult;
764 -
765 - ehci->periodic_sched_active = PERIODIC_ACTIVE;
766 -@@ -1489,10 +1489,9 @@ static int ehci_process_itd(EHCIState *ehci,
767 - ehci_raise_irq(ehci, USBSTS_INT);
768 - }
769 - itd->transact[i] &= ~ITD_XACT_ACTIVE;
770 -- xfers++;
771 - }
772 - }
773 -- return xfers ? 0 : -1;
774 -+ return 0;
775 - }
776 -
777 -
778 ---
779 -2.7.4
780 -
781 -From 1ae3f2f178087711f9591350abad133525ba93f2 Mon Sep 17 00:00:00 2001
782 -From: Gerd Hoffmann <kraxel@××××××.com>
783 -Date: Mon, 18 Apr 2016 09:11:38 +0200
784 -Subject: [PATCH] ehci: apply limit to iTD/sidt descriptors
785 -MIME-Version: 1.0
786 -Content-Type: text/plain; charset=UTF-8
787 -Content-Transfer-Encoding: 8bit
788 -
789 -Commit "156a2e4 ehci: make idt processing more robust" tries to avoid a
790 -DoS by the guest (create a circular iTD queue and let qemu ehci
791 -emulation run in circles forever). Unfortunately this has two problems:
792 -First it misses the case of siTDs, and second it reportedly breaks
793 -FreeBSD.
794 -
795 -So lets go for a different approach: just count the number of iTDs and
796 -siTDs we have seen per frame and apply a limit. That should really
797 -catch all cases now.
798 -
799 -Reported-by: 杜少博 <dushaobo@×××.cn>
800 -Signed-off-by: Gerd Hoffmann <kraxel@××××××.com>
801 ----
802 - hw/usb/hcd-ehci.c | 6 +++++-
803 - 1 file changed, 5 insertions(+), 1 deletion(-)
804 -
805 -diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c
806 -index 159f58d..d5c0e1c 100644
807 ---- a/hw/usb/hcd-ehci.c
808 -+++ b/hw/usb/hcd-ehci.c
809 -@@ -2011,6 +2011,7 @@ static int ehci_state_writeback(EHCIQueue *q)
810 - static void ehci_advance_state(EHCIState *ehci, int async)
811 - {
812 - EHCIQueue *q = NULL;
813 -+ int itd_count = 0;
814 - int again;
815 -
816 - do {
817 -@@ -2035,10 +2036,12 @@ static void ehci_advance_state(EHCIState *ehci, int async)
818 -
819 - case EST_FETCHITD:
820 - again = ehci_state_fetchitd(ehci, async);
821 -+ itd_count++;
822 - break;
823 -
824 - case EST_FETCHSITD:
825 - again = ehci_state_fetchsitd(ehci, async);
826 -+ itd_count++;
827 - break;
828 -
829 - case EST_ADVANCEQUEUE:
830 -@@ -2087,7 +2090,8 @@ static void ehci_advance_state(EHCIState *ehci, int async)
831 - break;
832 - }
833 -
834 -- if (again < 0) {
835 -+ if (again < 0 || itd_count > 16) {
836 -+ /* TODO: notify guest (raise HSE irq?) */
837 - fprintf(stderr, "processing error - resetting ehci HC\n");
838 - ehci_reset(ehci);
839 - again = 0;
840 ---
841 -2.7.4
842 -
843
844 diff --git a/app-emulation/qemu/files/qemu-2.5.1-CVE-2016-4020.patch b/app-emulation/qemu/files/qemu-2.5.1-CVE-2016-4020.patch
845 deleted file mode 100644
846 index e3115c1..00000000
847 --- a/app-emulation/qemu/files/qemu-2.5.1-CVE-2016-4020.patch
848 +++ /dev/null
849 @@ -1,16 +0,0 @@
850 -https://lists.gnu.org/archive/html/qemu-devel/2016-04/msg01106.html
851 -https://bugs.gentoo.org/580040
852 -
853 -diff --git a/hw/i386/kvmvapic.c b/hw/i386/kvmvapic.c
854 -index c69f374..ff1e31a 100644
855 ---- a/hw/i386/kvmvapic.c
856 -+++ b/hw/i386/kvmvapic.c
857 -@@ -394,7 +394,7 @@ static void patch_instruction(VAPICROMState *s, X86CPU *cpu, target_ulong ip)
858 - CPUX86State *env = &cpu->env;
859 - VAPICHandlers *handlers;
860 - uint8_t opcode[2];
861 -- uint32_t imm32;
862 -+ uint32_t imm32 = 0;
863 - target_ulong current_pc = 0;
864 - target_ulong current_cs_base = 0;
865 - int current_flags = 0;
866
867 diff --git a/app-emulation/qemu/files/qemu-2.5.1-stellaris_enet-overflow.patch b/app-emulation/qemu/files/qemu-2.5.1-stellaris_enet-overflow.patch
868 deleted file mode 100644
869 index ab7d3f3..00000000
870 --- a/app-emulation/qemu/files/qemu-2.5.1-stellaris_enet-overflow.patch
871 +++ /dev/null
872 @@ -1,47 +0,0 @@
873 -From 3a15cc0e1ee7168db0782133d2607a6bfa422d66 Mon Sep 17 00:00:00 2001
874 -From: Prasad J Pandit <pjp@×××××××××××××.org>
875 -Date: Fri, 8 Apr 2016 11:33:48 +0530
876 -Subject: [PATCH] net: stellaris_enet: check packet length against receive
877 - buffer
878 -
879 -When receiving packets over Stellaris ethernet controller, it
880 -uses receive buffer of size 2048 bytes. In case the controller
881 -accepts large(MTU) packets, it could lead to memory corruption.
882 -Add check to avoid it.
883 -
884 -Reported-by: Oleksandr Bazhaniuk <oleksandr.bazhaniuk@×××××.com>
885 -Signed-off-by: Prasad J Pandit <pjp@×××××××××××××.org>
886 -Message-id: 1460095428-22698-1-git-send-email-ppandit@××××××.com
887 -Reviewed-by: Peter Maydell <peter.maydell@××××××.org>
888 -Signed-off-by: Peter Maydell <peter.maydell@××××××.org>
889 ----
890 - hw/net/stellaris_enet.c | 12 +++++++++++-
891 - 1 file changed, 11 insertions(+), 1 deletion(-)
892 -
893 -diff --git a/hw/net/stellaris_enet.c b/hw/net/stellaris_enet.c
894 -index 84cf60b..6880894 100644
895 ---- a/hw/net/stellaris_enet.c
896 -+++ b/hw/net/stellaris_enet.c
897 -@@ -236,8 +236,18 @@ static ssize_t stellaris_enet_receive(NetClientState *nc, const uint8_t *buf, si
898 - n = s->next_packet + s->np;
899 - if (n >= 31)
900 - n -= 31;
901 -- s->np++;
902 -
903 -+ if (size >= sizeof(s->rx[n].data) - 6) {
904 -+ /* If the packet won't fit into the
905 -+ * emulated 2K RAM, this is reported
906 -+ * as a FIFO overrun error.
907 -+ */
908 -+ s->ris |= SE_INT_FOV;
909 -+ stellaris_enet_update(s);
910 -+ return -1;
911 -+ }
912 -+
913 -+ s->np++;
914 - s->rx[n].len = size + 6;
915 - p = s->rx[n].data;
916 - *(p++) = (size + 6);
917 ---
918 -2.7.4
919 -
920
921 diff --git a/app-emulation/qemu/files/qemu-2.5.1-xfs-linux-headers.patch b/app-emulation/qemu/files/qemu-2.5.1-xfs-linux-headers.patch
922 deleted file mode 100644
923 index 743171b..00000000
924 --- a/app-emulation/qemu/files/qemu-2.5.1-xfs-linux-headers.patch
925 +++ /dev/null
926 @@ -1,82 +0,0 @@
927 -https://bugs.gentoo.org/577810
928 -
929 -From 277abf15a60f7653bfb05ffb513ed74ffdaea1b7 Mon Sep 17 00:00:00 2001
930 -From: Jan Vesely <jano.vesely@×××××.com>
931 -Date: Fri, 29 Apr 2016 13:15:23 -0400
932 -Subject: [PATCH] configure: Check if struct fsxattr is available from linux
933 - header
934 -MIME-Version: 1.0
935 -Content-Type: text/plain; charset=UTF-8
936 -Content-Transfer-Encoding: 8bit
937 -
938 -Fixes build failure with --enable-xfsctl and
939 -new linux headers (>=4.5) and older xfsprogs(<4.5):
940 -In file included from /usr/include/xfs/xfs.h:38:0,
941 - from /var/tmp/portage/app-emulation/qemu-2.5.0-r1/work/qemu-2.5.0/block/raw-posix.c:97:
942 -/usr/include/xfs/xfs_fs.h:42:8: error: redefinition of ‘struct fsxattr’
943 - struct fsxattr {
944 - ^
945 -In file included from /var/tmp/portage/app-emulation/qemu-2.5.0-r1/work/qemu-2.5.0/block/raw-posix.c:60:0:
946 -/usr/include/linux/fs.h:155:8: note: originally defined here
947 - struct fsxattr {
948 -
949 -This is really a bug in the system headers, but we can work around it
950 -by defining HAVE_FSXATTR in the QEMU headers if linux/fs.h provides
951 -the struct, so that xfs_fs.h doesn't try to define it as well.
952 -
953 -CC: qemu-trivial@××××××.org
954 -CC: Markus Armbruster <armbru@××××××.com>
955 -CC: Peter Maydell <peter.maydell@××××××.org>
956 -CC: Stefan Weil <sw@××××××××.de>
957 -Tested-by: Stefan Weil <sw@××××××××.de>
958 -Signed-off-by: Jan Vesely <jano.vesely@×××××.com>
959 -[PMM: adjusted commit message, comments]
960 -Signed-off-by: Peter Maydell <peter.maydell@××××××.org>
961 ----
962 - configure | 23 +++++++++++++++++++++++
963 - 1 file changed, 23 insertions(+)
964 -
965 -diff --git a/configure b/configure
966 -index ab54f3c..c37fc5f 100755
967 ---- a/configure
968 -+++ b/configure
969 -@@ -4494,6 +4494,21 @@ if test "$fortify_source" != "no"; then
970 - fi
971 -
972 - ##########################################
973 -+# check if struct fsxattr is available via linux/fs.h
974 -+
975 -+have_fsxattr=no
976 -+cat > $TMPC << EOF
977 -+#include <linux/fs.h>
978 -+struct fsxattr foo;
979 -+int main(void) {
980 -+ return 0;
981 -+}
982 -+EOF
983 -+if compile_prog "" "" ; then
984 -+ have_fsxattr=yes
985 -+fi
986 -+
987 -+##########################################
988 - # End of CC checks
989 - # After here, no more $cc or $ld runs
990 -
991 -@@ -5160,6 +5175,14 @@ fi
992 - if test "$have_ifaddrs_h" = "yes" ; then
993 - echo "HAVE_IFADDRS_H=y" >> $config_host_mak
994 - fi
995 -+
996 -+# Work around a system header bug with some kernel/XFS header
997 -+# versions where they both try to define 'struct fsxattr':
998 -+# xfs headers will not try to redefine structs from linux headers
999 -+# if this macro is set.
1000 -+if test "$have_fsxattr" = "yes" ; then
1001 -+ echo "HAVE_FSXATTR=y" >> $config_host_mak
1002 -+fi
1003 - if test "$vte" = "yes" ; then
1004 - echo "CONFIG_VTE=y" >> $config_host_mak
1005 - echo "VTE_CFLAGS=$vte_cflags" >> $config_host_mak
1006 ---
1007 -2.8.2
1008 -
1009
1010 diff --git a/app-emulation/qemu/qemu-2.5.1.ebuild b/app-emulation/qemu/qemu-2.5.1.ebuild
1011 deleted file mode 100644
1012 index 6148c72..00000000
1013 --- a/app-emulation/qemu/qemu-2.5.1.ebuild
1014 +++ /dev/null
1015 @@ -1,693 +0,0 @@
1016 -# Copyright 1999-2016 Gentoo Foundation
1017 -# Distributed under the terms of the GNU General Public License v2
1018 -# $Id$
1019 -
1020 -EAPI=5
1021 -
1022 -PYTHON_COMPAT=( python2_7 )
1023 -PYTHON_REQ_USE="ncurses,readline"
1024 -
1025 -PLOCALES="de_DE fr_FR hu it tr zh_CN"
1026 -
1027 -inherit eutils flag-o-matic linux-info toolchain-funcs multilib python-r1 \
1028 - user udev fcaps readme.gentoo pax-utils l10n
1029 -
1030 -BACKPORTS=
1031 -
1032 -if [[ ${PV} = *9999* ]]; then
1033 - EGIT_REPO_URI="git://git.qemu.org/qemu.git"
1034 - inherit git-2
1035 - SRC_URI=""
1036 -else
1037 - SRC_URI="http://wiki.qemu-project.org/download/${P}.tar.bz2
1038 - ${BACKPORTS:+
1039 - https://dev.gentoo.org/~cardoe/distfiles/${P}-${BACKPORTS}.tar.xz}"
1040 - KEYWORDS="amd64 ~arm64 ~ppc ~ppc64 x86 ~x86-fbsd"
1041 -fi
1042 -
1043 -DESCRIPTION="QEMU + Kernel-based Virtual Machine userland tools"
1044 -HOMEPAGE="http://www.qemu.org http://www.linux-kvm.org"
1045 -
1046 -LICENSE="GPL-2 LGPL-2 BSD-2"
1047 -SLOT="0"
1048 -IUSE="accessibility +aio alsa bluetooth bzip2 +caps +curl debug +fdt glusterfs \
1049 -gnutls gtk gtk2 infiniband iscsi +jpeg \
1050 -kernel_linux kernel_FreeBSD lzo ncurses nfs nls numa opengl +pin-upstream-blobs
1051 -+png pulseaudio python \
1052 -rbd sasl +seccomp sdl sdl2 selinux smartcard snappy spice ssh static static-softmmu
1053 -static-user systemtap tci test +threads usb usbredir +uuid vde +vhost-net \
1054 -virgl virtfs +vnc vte xattr xen xfs"
1055 -
1056 -COMMON_TARGETS="aarch64 alpha arm cris i386 m68k microblaze microblazeel mips
1057 -mips64 mips64el mipsel or32 ppc ppc64 s390x sh4 sh4eb sparc sparc64 unicore32
1058 -x86_64"
1059 -IUSE_SOFTMMU_TARGETS="${COMMON_TARGETS} lm32 moxie ppcemb tricore xtensa xtensaeb"
1060 -IUSE_USER_TARGETS="${COMMON_TARGETS} armeb mipsn32 mipsn32el ppc64abi32 ppc64le sparc32plus tilegx"
1061 -
1062 -use_softmmu_targets=$(printf ' qemu_softmmu_targets_%s' ${IUSE_SOFTMMU_TARGETS})
1063 -use_user_targets=$(printf ' qemu_user_targets_%s' ${IUSE_USER_TARGETS})
1064 -IUSE+=" ${use_softmmu_targets} ${use_user_targets}"
1065 -
1066 -# Allow no targets to be built so that people can get a tools-only build.
1067 -# Block USE flag configurations known to not work.
1068 -REQUIRED_USE="${PYTHON_REQUIRED_USE}
1069 - gtk2? ( gtk )
1070 - qemu_softmmu_targets_arm? ( fdt )
1071 - qemu_softmmu_targets_microblaze? ( fdt )
1072 - qemu_softmmu_targets_ppc? ( fdt )
1073 - qemu_softmmu_targets_ppc64? ( fdt )
1074 - sdl2? ( sdl )
1075 - static? ( static-softmmu static-user )
1076 - static-softmmu? ( !alsa !pulseaudio !bluetooth !opengl !gtk !gtk2 )
1077 - virtfs? ( xattr )
1078 - vte? ( gtk )"
1079 -
1080 -# Yep, you need both libcap and libcap-ng since virtfs only uses libcap.
1081 -#
1082 -# The attr lib isn't always linked in (although the USE flag is always
1083 -# respected). This is because qemu supports using the C library's API
1084 -# when available rather than always using the extranl library.
1085 -#
1086 -# Older versions of gnutls are supported, but it's simpler to just require
1087 -# the latest versions. This is also why we require nettle.
1088 -#
1089 -# TODO: Split out tools deps into another var. e.g. bzip2 is only used by
1090 -# system binaries and tools, not user binaries.
1091 -COMMON_LIB_DEPEND=">=dev-libs/glib-2.0[static-libs(+)]
1092 - sys-libs/zlib[static-libs(+)]
1093 - bzip2? ( app-arch/bzip2[static-libs(+)] )
1094 - xattr? ( sys-apps/attr[static-libs(+)] )"
1095 -SOFTMMU_LIB_DEPEND="${COMMON_LIB_DEPEND}
1096 - >=x11-libs/pixman-0.28.0[static-libs(+)]
1097 - accessibility? ( app-accessibility/brltty[static-libs(+)] )
1098 - aio? ( dev-libs/libaio[static-libs(+)] )
1099 - alsa? ( >=media-libs/alsa-lib-1.0.13 )
1100 - bluetooth? ( net-wireless/bluez )
1101 - caps? ( sys-libs/libcap-ng[static-libs(+)] )
1102 - curl? ( >=net-misc/curl-7.15.4[static-libs(+)] )
1103 - fdt? ( >=sys-apps/dtc-1.4.0[static-libs(+)] )
1104 - glusterfs? ( >=sys-cluster/glusterfs-3.4.0[static-libs(+)] )
1105 - gnutls? (
1106 - dev-libs/nettle:=[static-libs(+)]
1107 - >=net-libs/gnutls-3.0:=[static-libs(+)]
1108 - )
1109 - gtk? (
1110 - gtk2? (
1111 - x11-libs/gtk+:2
1112 - vte? ( x11-libs/vte:0 )
1113 - )
1114 - !gtk2? (
1115 - x11-libs/gtk+:3
1116 - vte? ( x11-libs/vte:2.90 )
1117 - )
1118 - )
1119 - infiniband? ( sys-fabric/librdmacm:=[static-libs(+)] )
1120 - iscsi? ( net-libs/libiscsi )
1121 - jpeg? ( virtual/jpeg:0=[static-libs(+)] )
1122 - lzo? ( dev-libs/lzo:2[static-libs(+)] )
1123 - ncurses? ( sys-libs/ncurses:0=[static-libs(+)] )
1124 - nfs? ( >=net-fs/libnfs-1.9.3[static-libs(+)] )
1125 - numa? ( sys-process/numactl[static-libs(+)] )
1126 - opengl? (
1127 - virtual/opengl
1128 - media-libs/libepoxy[static-libs(+)]
1129 - media-libs/mesa[static-libs(+)]
1130 - media-libs/mesa[egl,gles2]
1131 - )
1132 - png? ( media-libs/libpng:0=[static-libs(+)] )
1133 - pulseaudio? ( media-sound/pulseaudio )
1134 - rbd? ( sys-cluster/ceph[static-libs(+)] )
1135 - sasl? ( dev-libs/cyrus-sasl[static-libs(+)] )
1136 - sdl? (
1137 - !sdl2? (
1138 - media-libs/libsdl[X]
1139 - >=media-libs/libsdl-1.2.11[static-libs(+)]
1140 - )
1141 - sdl2? (
1142 - media-libs/libsdl2[X]
1143 - media-libs/libsdl2[static-libs(+)]
1144 - )
1145 - )
1146 - seccomp? ( >=sys-libs/libseccomp-2.1.0[static-libs(+)] )
1147 - smartcard? ( >=app-emulation/libcacard-2.5.0[static-libs(+)] )
1148 - snappy? ( app-arch/snappy[static-libs(+)] )
1149 - spice? (
1150 - >=app-emulation/spice-protocol-0.12.3
1151 - >=app-emulation/spice-0.12.0[static-libs(+)]
1152 - )
1153 - ssh? ( >=net-libs/libssh2-1.2.8[static-libs(+)] )
1154 - usb? ( >=virtual/libusb-1-r2[static-libs(+)] )
1155 - usbredir? ( >=sys-apps/usbredir-0.6[static-libs(+)] )
1156 - uuid? ( >=sys-apps/util-linux-2.16.0[static-libs(+)] )
1157 - vde? ( net-misc/vde[static-libs(+)] )
1158 - virgl? ( media-libs/virglrenderer[static-libs(+)] )
1159 - virtfs? ( sys-libs/libcap )
1160 - xfs? ( sys-fs/xfsprogs[static-libs(+)] )"
1161 -USER_LIB_DEPEND="${COMMON_LIB_DEPEND}"
1162 -X86_FIRMWARE_DEPEND="
1163 - >=sys-firmware/ipxe-1.0.0_p20130624
1164 - pin-upstream-blobs? (
1165 - ~sys-firmware/seabios-1.8.2
1166 - ~sys-firmware/sgabios-0.1_pre8
1167 - ~sys-firmware/vgabios-0.7a
1168 - )
1169 - !pin-upstream-blobs? (
1170 - sys-firmware/seabios
1171 - sys-firmware/sgabios
1172 - sys-firmware/vgabios
1173 - )"
1174 -CDEPEND="
1175 - !static-softmmu? ( $(printf "%s? ( ${SOFTMMU_LIB_DEPEND//\[static-libs(+)]} ) " ${use_softmmu_targets}) )
1176 - !static-user? ( $(printf "%s? ( ${USER_LIB_DEPEND//\[static-libs(+)]} ) " ${use_user_targets}) )
1177 - qemu_softmmu_targets_i386? ( ${X86_FIRMWARE_DEPEND} )
1178 - qemu_softmmu_targets_x86_64? ( ${X86_FIRMWARE_DEPEND} )
1179 - python? ( ${PYTHON_DEPS} )
1180 - systemtap? ( dev-util/systemtap )
1181 - xen? ( app-emulation/xen-tools:= )"
1182 -DEPEND="${CDEPEND}
1183 - dev-lang/perl
1184 - =dev-lang/python-2*
1185 - sys-apps/texinfo
1186 - virtual/pkgconfig
1187 - kernel_linux? ( >=sys-kernel/linux-headers-2.6.35 )
1188 - gtk? ( nls? ( sys-devel/gettext ) )
1189 - static-softmmu? ( $(printf "%s? ( ${SOFTMMU_LIB_DEPEND} ) " ${use_softmmu_targets}) )
1190 - static-user? ( $(printf "%s? ( ${USER_LIB_DEPEND} ) " ${use_user_targets}) )
1191 - test? (
1192 - dev-libs/glib[utils]
1193 - sys-devel/bc
1194 - )"
1195 -RDEPEND="${CDEPEND}
1196 - selinux? ( sec-policy/selinux-qemu )
1197 -"
1198 -
1199 -STRIP_MASK="/usr/share/qemu/palcode-clipper"
1200 -
1201 -QA_PREBUILT="
1202 - usr/share/qemu/openbios-ppc
1203 - usr/share/qemu/openbios-sparc64
1204 - usr/share/qemu/openbios-sparc32
1205 - usr/share/qemu/palcode-clipper
1206 - usr/share/qemu/s390-ccw.img
1207 - usr/share/qemu/u-boot.e500
1208 -"
1209 -
1210 -QA_WX_LOAD="usr/bin/qemu-i386
1211 - usr/bin/qemu-x86_64
1212 - usr/bin/qemu-alpha
1213 - usr/bin/qemu-arm
1214 - usr/bin/qemu-cris
1215 - usr/bin/qemu-m68k
1216 - usr/bin/qemu-microblaze
1217 - usr/bin/qemu-microblazeel
1218 - usr/bin/qemu-mips
1219 - usr/bin/qemu-mipsel
1220 - usr/bin/qemu-or32
1221 - usr/bin/qemu-ppc
1222 - usr/bin/qemu-ppc64
1223 - usr/bin/qemu-ppc64abi32
1224 - usr/bin/qemu-sh4
1225 - usr/bin/qemu-sh4eb
1226 - usr/bin/qemu-sparc
1227 - usr/bin/qemu-sparc64
1228 - usr/bin/qemu-armeb
1229 - usr/bin/qemu-sparc32plus
1230 - usr/bin/qemu-s390x
1231 - usr/bin/qemu-unicore32"
1232 -
1233 -DOC_CONTENTS="If you don't have kvm compiled into the kernel, make sure
1234 -you have the kernel module loaded before running kvm. The easiest way to
1235 -ensure that the kernel module is loaded is to load it on boot.\n
1236 -For AMD CPUs the module is called 'kvm-amd'.\n
1237 -For Intel CPUs the module is called 'kvm-intel'.\n
1238 -Please review /etc/conf.d/modules for how to load these.\n\n
1239 -Make sure your user is in the 'kvm' group\n
1240 -Just run 'gpasswd -a <USER> kvm', then have <USER> re-login.\n\n
1241 -For brand new installs, the default permissions on /dev/kvm might not let you
1242 -access it. You can tell udev to reset ownership/perms:\n
1243 -udevadm trigger -c add /dev/kvm"
1244 -
1245 -qemu_support_kvm() {
1246 - if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386 \
1247 - use qemu_softmmu_targets_ppc || use qemu_softmmu_targets_ppc64 \
1248 - use qemu_softmmu_targets_s390x; then
1249 - return 0
1250 - fi
1251 -
1252 - return 1
1253 -}
1254 -
1255 -pkg_pretend() {
1256 - if use kernel_linux && kernel_is lt 2 6 25; then
1257 - eerror "This version of KVM requres a host kernel of 2.6.25 or higher."
1258 - elif use kernel_linux; then
1259 - if ! linux_config_exists; then
1260 - eerror "Unable to check your kernel for KVM support"
1261 - else
1262 - CONFIG_CHECK="~KVM ~TUN ~BRIDGE"
1263 - ERROR_KVM="You must enable KVM in your kernel to continue"
1264 - ERROR_KVM_AMD="If you have an AMD CPU, you must enable KVM_AMD in"
1265 - ERROR_KVM_AMD+=" your kernel configuration."
1266 - ERROR_KVM_INTEL="If you have an Intel CPU, you must enable"
1267 - ERROR_KVM_INTEL+=" KVM_INTEL in your kernel configuration."
1268 - ERROR_TUN="You will need the Universal TUN/TAP driver compiled"
1269 - ERROR_TUN+=" into your kernel or loaded as a module to use the"
1270 - ERROR_TUN+=" virtual network device if using -net tap."
1271 - ERROR_BRIDGE="You will also need support for 802.1d"
1272 - ERROR_BRIDGE+=" Ethernet Bridging for some network configurations."
1273 - use vhost-net && CONFIG_CHECK+=" ~VHOST_NET"
1274 - ERROR_VHOST_NET="You must enable VHOST_NET to have vhost-net"
1275 - ERROR_VHOST_NET+=" support"
1276 -
1277 - if use amd64 || use x86 || use amd64-linux || use x86-linux; then
1278 - CONFIG_CHECK+=" ~KVM_AMD ~KVM_INTEL"
1279 - fi
1280 -
1281 - use python && CONFIG_CHECK+=" ~DEBUG_FS"
1282 - ERROR_DEBUG_FS="debugFS support required for kvm_stat"
1283 -
1284 - # Now do the actual checks setup above
1285 - check_extra_config
1286 - fi
1287 - fi
1288 -
1289 - if grep -qs '/usr/bin/qemu-kvm' "${EROOT}"/etc/libvirt/qemu/*.xml; then
1290 - eerror "The kvm/qemu-kvm wrappers no longer exist, but your libvirt"
1291 - eerror "instances are still pointing to it. Please update your"
1292 - eerror "configs in /etc/libvirt/qemu/ to use the -enable-kvm flag"
1293 - eerror "and the right system binary (e.g. qemu-system-x86_64)."
1294 - die "update your virt configs to not use qemu-kvm"
1295 - fi
1296 -}
1297 -
1298 -pkg_setup() {
1299 - enewgroup kvm 78
1300 -}
1301 -
1302 -# Sanity check to make sure target lists are kept up-to-date.
1303 -check_targets() {
1304 - local var=$1 mak=$2
1305 - local detected sorted
1306 -
1307 - pushd "${S}"/default-configs >/dev/null || die
1308 -
1309 - # Force C locale until glibc is updated. #564936
1310 - detected=$(echo $(printf '%s\n' *-${mak}.mak | sed "s:-${mak}.mak::" | LC_COLLATE=C sort -u))
1311 - sorted=$(echo $(printf '%s\n' ${!var} | LC_COLLATE=C sort -u))
1312 - if [[ ${sorted} != "${detected}" ]] ; then
1313 - eerror "The ebuild needs to be kept in sync."
1314 - eerror "${var}: ${sorted}"
1315 - eerror "$(printf '%-*s' ${#var} configure): ${detected}"
1316 - die "sync ${var} to the list of targets"
1317 - fi
1318 -
1319 - popd >/dev/null
1320 -}
1321 -
1322 -handle_locales() {
1323 - # Make sure locale list is kept up-to-date.
1324 - local detected sorted
1325 - detected=$(echo $(cd po && printf '%s\n' *.po | grep -v messages.po | sed 's:.po$::' | sort -u))
1326 - sorted=$(echo $(printf '%s\n' ${PLOCALES} | sort -u))
1327 - if [[ ${sorted} != "${detected}" ]] ; then
1328 - eerror "The ebuild needs to be kept in sync."
1329 - eerror "PLOCALES: ${sorted}"
1330 - eerror " po/*.po: ${detected}"
1331 - die "sync PLOCALES"
1332 - fi
1333 -
1334 - # Deal with selective install of locales.
1335 - if use nls ; then
1336 - # Delete locales the user does not want. #577814
1337 - rm_loc() { rm po/$1.po || die; }
1338 - l10n_for_each_disabled_locale_do rm_loc
1339 - else
1340 - # Cheap hack to disable gettext .mo generation.
1341 - rm -f po/*.po
1342 - fi
1343 -}
1344 -
1345 -src_prepare() {
1346 - check_targets IUSE_SOFTMMU_TARGETS softmmu
1347 - check_targets IUSE_USER_TARGETS linux-user
1348 -
1349 - # Alter target makefiles to accept CFLAGS set via flag-o
1350 - sed -i -r \
1351 - -e 's/^(C|OP_C|HELPER_C)FLAGS=/\1FLAGS+=/' \
1352 - Makefile Makefile.target || die
1353 -
1354 - epatch "${FILESDIR}"/qemu-2.5.0-cflags.patch
1355 - [[ -n ${BACKPORTS} ]] && \
1356 - EPATCH_FORCE=yes EPATCH_SUFFIX="patch" EPATCH_SOURCE="${S}/patches" \
1357 - epatch
1358 -
1359 - epatch "${FILESDIR}"/${PN}-2.5.0-CVE-2016-2198.patch #573314
1360 - epatch "${FILESDIR}"/${PN}-2.5.0-rng-stack-corrupt-{0,1,2,3}.patch #576420
1361 - epatch "${FILESDIR}"/${PN}-2.5.1-stellaris_enet-overflow.patch #579614
1362 - epatch "${FILESDIR}"/${PN}-2.5.1-CVE-2016-4020.patch #580040
1363 - epatch "${FILESDIR}"/${PN}-2.5.1-CVE-2015-8558.patch #568246 #580426
1364 - epatch "${FILESDIR}"/${PN}-2.5.0-sysmacros.patch
1365 - epatch "${FILESDIR}"/${PN}-2.5.1-xfs-linux-headers.patch #577810
1366 -
1367 - # Fix ld and objcopy being called directly
1368 - tc-export AR LD OBJCOPY
1369 -
1370 - # Verbose builds
1371 - MAKEOPTS+=" V=1"
1372 -
1373 - epatch_user
1374 -
1375 - # Run after we've applied all patches.
1376 - handle_locales
1377 -}
1378 -
1379 -##
1380 -# configures qemu based on the build directory and the build type
1381 -# we are using.
1382 -#
1383 -qemu_src_configure() {
1384 - debug-print-function ${FUNCNAME} "$@"
1385 -
1386 - local buildtype=$1
1387 - local builddir="${S}/${buildtype}-build"
1388 - local static_flag="static-${buildtype}"
1389 -
1390 - mkdir "${builddir}"
1391 -
1392 - local conf_opts=(
1393 - --prefix=/usr
1394 - --sysconfdir=/etc
1395 - --libdir=/usr/$(get_libdir)
1396 - --docdir=/usr/share/doc/${PF}/html
1397 - --disable-bsd-user
1398 - --disable-guest-agent
1399 - --disable-strip
1400 - --disable-werror
1401 - # We support gnutls/nettle for crypto operations. It is possible
1402 - # to use gcrypt when gnutls/nettle are disabled (but not when they
1403 - # are enabled), but it's not really worth the hassle. Disable it
1404 - # all the time to avoid automatically detecting it. #568856
1405 - --disable-gcrypt
1406 - --python="${PYTHON}"
1407 - --cc="$(tc-getCC)"
1408 - --cxx="$(tc-getCXX)"
1409 - --host-cc="$(tc-getBUILD_CC)"
1410 - $(use_enable debug debug-info)
1411 - $(use_enable debug debug-tcg)
1412 - --enable-docs
1413 - $(use_enable tci tcg-interpreter)
1414 - $(use_enable xattr attr)
1415 - )
1416 -
1417 - # Disable options not used by user targets as the default configure
1418 - # options will autoprobe and try to link in a bunch of unused junk.
1419 - conf_softmmu() {
1420 - if [[ ${buildtype} == "user" ]] ; then
1421 - echo "--disable-${2:-$1}"
1422 - else
1423 - use_enable "$@"
1424 - fi
1425 - }
1426 - conf_opts+=(
1427 - $(conf_softmmu accessibility brlapi)
1428 - $(conf_softmmu aio linux-aio)
1429 - $(conf_softmmu bzip2)
1430 - $(conf_softmmu bluetooth bluez)
1431 - $(conf_softmmu caps cap-ng)
1432 - $(conf_softmmu curl)
1433 - $(conf_softmmu fdt)
1434 - $(conf_softmmu glusterfs)
1435 - $(conf_softmmu gnutls)
1436 - $(conf_softmmu gnutls nettle)
1437 - $(conf_softmmu gtk)
1438 - $(conf_softmmu infiniband rdma)
1439 - $(conf_softmmu iscsi libiscsi)
1440 - $(conf_softmmu jpeg vnc-jpeg)
1441 - $(conf_softmmu kernel_linux kvm)
1442 - $(conf_softmmu lzo)
1443 - $(conf_softmmu ncurses curses)
1444 - $(conf_softmmu nfs libnfs)
1445 - $(conf_softmmu numa)
1446 - $(conf_softmmu opengl)
1447 - $(conf_softmmu png vnc-png)
1448 - $(conf_softmmu rbd)
1449 - $(conf_softmmu sasl vnc-sasl)
1450 - $(conf_softmmu sdl)
1451 - $(conf_softmmu seccomp)
1452 - $(conf_softmmu smartcard)
1453 - $(conf_softmmu snappy)
1454 - $(conf_softmmu spice)
1455 - $(conf_softmmu ssh libssh2)
1456 - $(conf_softmmu usb libusb)
1457 - $(conf_softmmu usbredir usb-redir)
1458 - $(conf_softmmu uuid)
1459 - $(conf_softmmu vde)
1460 - $(conf_softmmu vhost-net)
1461 - $(conf_softmmu virgl virglrenderer)
1462 - $(conf_softmmu virtfs)
1463 - $(conf_softmmu vnc)
1464 - $(conf_softmmu vte)
1465 - $(conf_softmmu xen)
1466 - $(conf_softmmu xen xen-pci-passthrough)
1467 - $(conf_softmmu xfs xfsctl)
1468 - )
1469 -
1470 - case ${buildtype} in
1471 - user)
1472 - conf_opts+=(
1473 - --enable-linux-user
1474 - --disable-system
1475 - --disable-blobs
1476 - --disable-tools
1477 - )
1478 - ;;
1479 - softmmu)
1480 - # audio options
1481 - local audio_opts="oss"
1482 - use alsa && audio_opts="alsa,${audio_opts}"
1483 - use sdl && audio_opts="sdl,${audio_opts}"
1484 - use pulseaudio && audio_opts="pa,${audio_opts}"
1485 -
1486 - conf_opts+=(
1487 - --disable-linux-user
1488 - --enable-system
1489 - --with-system-pixman
1490 - --audio-drv-list="${audio_opts}"
1491 - )
1492 - use gtk && conf_opts+=( --with-gtkabi=$(usex gtk2 2.0 3.0) )
1493 - use sdl && conf_opts+=( --with-sdlabi=$(usex sdl2 2.0 1.2) )
1494 - ;;
1495 - tools)
1496 - conf_opts+=(
1497 - --disable-linux-user
1498 - --disable-system
1499 - --disable-blobs
1500 - $(use_enable bzip2)
1501 - )
1502 - static_flag="static"
1503 - ;;
1504 - esac
1505 -
1506 - local targets="${buildtype}_targets"
1507 - [[ -n ${targets} ]] && conf_opts+=( --target-list="${!targets}" )
1508 -
1509 - # Add support for SystemTAP
1510 - use systemtap && conf_opts+=( --enable-trace-backend=dtrace )
1511 -
1512 - # We always want to attempt to build with PIE support as it results
1513 - # in a more secure binary. But it doesn't work with static or if
1514 - # the current GCC doesn't have PIE support.
1515 - if use ${static_flag}; then
1516 - conf_opts+=( --static --disable-pie )
1517 - else
1518 - gcc-specs-pie && conf_opts+=( --enable-pie )
1519 - fi
1520 -
1521 - echo "../configure ${conf_opts[*]}"
1522 - cd "${builddir}"
1523 - ../configure "${conf_opts[@]}" || die "configure failed"
1524 -
1525 - # FreeBSD's kernel does not support QEMU assigning/grabbing
1526 - # host USB devices yet
1527 - use kernel_FreeBSD && \
1528 - sed -i -E -e "s|^(HOST_USB=)bsd|\1stub|" "${S}"/config-host.mak
1529 -}
1530 -
1531 -src_configure() {
1532 - local target
1533 -
1534 - python_setup
1535 -
1536 - softmmu_targets= softmmu_bins=()
1537 - user_targets= user_bins=()
1538 -
1539 - for target in ${IUSE_SOFTMMU_TARGETS} ; do
1540 - if use "qemu_softmmu_targets_${target}"; then
1541 - softmmu_targets+=",${target}-softmmu"
1542 - softmmu_bins+=( "qemu-system-${target}" )
1543 - fi
1544 - done
1545 -
1546 - for target in ${IUSE_USER_TARGETS} ; do
1547 - if use "qemu_user_targets_${target}"; then
1548 - user_targets+=",${target}-linux-user"
1549 - user_bins+=( "qemu-${target}" )
1550 - fi
1551 - done
1552 -
1553 - softmmu_targets=${softmmu_targets#,}
1554 - user_targets=${user_targets#,}
1555 -
1556 - [[ -n ${softmmu_targets} ]] && qemu_src_configure "softmmu"
1557 - [[ -n ${user_targets} ]] && qemu_src_configure "user"
1558 - [[ -z ${softmmu_targets}${user_targets} ]] && qemu_src_configure "tools"
1559 -}
1560 -
1561 -src_compile() {
1562 - if [[ -n ${user_targets} ]]; then
1563 - cd "${S}/user-build"
1564 - default
1565 - fi
1566 -
1567 - if [[ -n ${softmmu_targets} ]]; then
1568 - cd "${S}/softmmu-build"
1569 - default
1570 - fi
1571 -
1572 - if [[ -z ${softmmu_targets}${user_targets} ]]; then
1573 - cd "${S}/tools-build"
1574 - default
1575 - fi
1576 -}
1577 -
1578 -src_test() {
1579 - if [[ -n ${softmmu_targets} ]]; then
1580 - cd "${S}/softmmu-build"
1581 - pax-mark m */qemu-system-* #515550
1582 - emake -j1 check
1583 - emake -j1 check-report.html
1584 - fi
1585 -}
1586 -
1587 -qemu_python_install() {
1588 - python_domodule "${S}/scripts/qmp/qmp.py"
1589 -
1590 - python_doscript "${S}/scripts/kvm/kvm_stat"
1591 - python_doscript "${S}/scripts/kvm/vmxcap"
1592 - python_doscript "${S}/scripts/qmp/qmp-shell"
1593 - python_doscript "${S}/scripts/qmp/qemu-ga-client"
1594 -}
1595 -
1596 -src_install() {
1597 - if [[ -n ${user_targets} ]]; then
1598 - cd "${S}/user-build"
1599 - emake DESTDIR="${ED}" install
1600 -
1601 - # Install binfmt handler init script for user targets
1602 - newinitd "${FILESDIR}/qemu-binfmt.initd-r1" qemu-binfmt
1603 - fi
1604 -
1605 - if [[ -n ${softmmu_targets} ]]; then
1606 - cd "${S}/softmmu-build"
1607 - emake DESTDIR="${ED}" install
1608 -
1609 - # This might not exist if the test failed. #512010
1610 - [[ -e check-report.html ]] && dohtml check-report.html
1611 -
1612 - if use kernel_linux; then
1613 - udev_dorules "${FILESDIR}"/65-kvm.rules
1614 - fi
1615 -
1616 - if use python; then
1617 - python_foreach_impl qemu_python_install
1618 - fi
1619 - fi
1620 -
1621 - if [[ -z ${softmmu_targets}${user_targets} ]]; then
1622 - cd "${S}/tools-build"
1623 - emake DESTDIR="${ED}" install
1624 - fi
1625 -
1626 - # Disable mprotect on the qemu binaries as they use JITs to be fast #459348
1627 - pushd "${ED}"/usr/bin >/dev/null
1628 - pax-mark m "${softmmu_bins[@]}" "${user_bins[@]}"
1629 - popd >/dev/null
1630 -
1631 - # Install config file example for qemu-bridge-helper
1632 - insinto "/etc/qemu"
1633 - doins "${FILESDIR}/bridge.conf"
1634 -
1635 - # Remove the docdir placed qmp-commands.txt
1636 - mv "${ED}/usr/share/doc/${PF}/html/qmp-commands.txt" "${S}/docs/" || die
1637 -
1638 - cd "${S}"
1639 - dodoc Changelog MAINTAINERS docs/specs/pci-ids.txt
1640 - newdoc pc-bios/README README.pc-bios
1641 - dodoc docs/qmp-*.txt
1642 -
1643 - if [[ -n ${softmmu_targets} ]]; then
1644 - # Remove SeaBIOS since we're using the SeaBIOS packaged one
1645 - rm "${ED}/usr/share/qemu/bios.bin"
1646 - if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
1647 - dosym ../seabios/bios.bin /usr/share/qemu/bios.bin
1648 - fi
1649 -
1650 - # Remove vgabios since we're using the vgabios packaged one
1651 - rm "${ED}/usr/share/qemu/vgabios.bin"
1652 - rm "${ED}/usr/share/qemu/vgabios-cirrus.bin"
1653 - rm "${ED}/usr/share/qemu/vgabios-qxl.bin"
1654 - rm "${ED}/usr/share/qemu/vgabios-stdvga.bin"
1655 - rm "${ED}/usr/share/qemu/vgabios-vmware.bin"
1656 - if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
1657 - dosym ../vgabios/vgabios.bin /usr/share/qemu/vgabios.bin
1658 - dosym ../vgabios/vgabios-cirrus.bin /usr/share/qemu/vgabios-cirrus.bin
1659 - dosym ../vgabios/vgabios-qxl.bin /usr/share/qemu/vgabios-qxl.bin
1660 - dosym ../vgabios/vgabios-stdvga.bin /usr/share/qemu/vgabios-stdvga.bin
1661 - dosym ../vgabios/vgabios-vmware.bin /usr/share/qemu/vgabios-vmware.bin
1662 - fi
1663 -
1664 - # Remove sgabios since we're using the sgabios packaged one
1665 - rm "${ED}/usr/share/qemu/sgabios.bin"
1666 - if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
1667 - dosym ../sgabios/sgabios.bin /usr/share/qemu/sgabios.bin
1668 - fi
1669 -
1670 - # Remove iPXE since we're using the iPXE packaged one
1671 - rm "${ED}"/usr/share/qemu/pxe-*.rom
1672 - if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
1673 - dosym ../ipxe/8086100e.rom /usr/share/qemu/pxe-e1000.rom
1674 - dosym ../ipxe/80861209.rom /usr/share/qemu/pxe-eepro100.rom
1675 - dosym ../ipxe/10500940.rom /usr/share/qemu/pxe-ne2k_pci.rom
1676 - dosym ../ipxe/10222000.rom /usr/share/qemu/pxe-pcnet.rom
1677 - dosym ../ipxe/10ec8139.rom /usr/share/qemu/pxe-rtl8139.rom
1678 - dosym ../ipxe/1af41000.rom /usr/share/qemu/pxe-virtio.rom
1679 - fi
1680 - fi
1681 -
1682 - qemu_support_kvm && readme.gentoo_create_doc
1683 -}
1684 -
1685 -pkg_postinst() {
1686 - if qemu_support_kvm; then
1687 - readme.gentoo_print_elog
1688 - fi
1689 -
1690 - if [[ -n ${softmmu_targets} ]] && use kernel_linux; then
1691 - udev_reload
1692 - fi
1693 -
1694 - fcaps cap_net_admin /usr/libexec/qemu-bridge-helper
1695 -}
1696 -
1697 -pkg_info() {
1698 - echo "Using:"
1699 - echo " $(best_version app-emulation/spice-protocol)"
1700 - echo " $(best_version sys-firmware/ipxe)"
1701 - echo " $(best_version sys-firmware/seabios)"
1702 - if has_version 'sys-firmware/seabios[binary]'; then
1703 - echo " USE=binary"
1704 - else
1705 - echo " USE=''"
1706 - fi
1707 - echo " $(best_version sys-firmware/vgabios)"
1708 -}