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/, app-emulation/qemu/files/
Date: Mon, 13 Feb 2017 04:58:18
Message-Id: 1486958898.cd0007ee8270ccd2773604782ddcc4b67fa3a103.tamiko@gentoo
1 commit: cd0007ee8270ccd2773604782ddcc4b67fa3a103
2 Author: Matthias Maier <tamiko <AT> gentoo <DOT> org>
3 AuthorDate: Mon Feb 13 04:08:18 2017 +0000
4 Commit: Matthias Maier <tamiko <AT> gentoo <DOT> org>
5 CommitDate: Mon Feb 13 04:08:18 2017 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=cd0007ee
7
8 app-emulation/qemu: drop old versions 2.7.0, 2.7.1
9
10 Package-Manager: Portage-2.3.3, Repoman-2.3.1
11
12 app-emulation/qemu/Manifest | 2 -
13 .../qemu/files/qemu-2.7.0-CVE-2016-6836.patch | 27 -
14 .../qemu/files/qemu-2.7.0-CVE-2016-7155.patch | 81 ---
15 .../qemu/files/qemu-2.7.0-CVE-2016-7156.patch | 62 --
16 .../qemu/files/qemu-2.7.0-CVE-2016-7157-1.patch | 28 -
17 .../qemu/files/qemu-2.7.0-CVE-2016-7157-2.patch | 27 -
18 .../qemu/files/qemu-2.7.0-CVE-2016-7170.patch | 40 --
19 .../qemu/files/qemu-2.7.0-CVE-2016-7421.patch | 34 -
20 .../qemu/files/qemu-2.7.0-CVE-2016-7422.patch | 37 --
21 .../qemu/files/qemu-2.7.0-CVE-2016-7423.patch | 31 -
22 .../qemu/files/qemu-2.7.0-CVE-2016-7466.patch | 26 -
23 .../qemu/files/qemu-2.7.0-CVE-2016-7907.patch | 45 --
24 .../qemu/files/qemu-2.7.0-CVE-2016-7908.patch | 52 --
25 .../qemu/files/qemu-2.7.0-CVE-2016-7909.patch | 32 -
26 .../qemu/files/qemu-2.7.0-CVE-2016-7994-1.patch | 25 -
27 .../qemu/files/qemu-2.7.0-CVE-2016-7994-2.patch | 26 -
28 .../qemu/files/qemu-2.7.0-CVE-2016-8576.patch | 61 --
29 .../qemu/files/qemu-2.7.0-CVE-2016-8577.patch | 34 -
30 .../qemu/files/qemu-2.7.0-CVE-2016-8578.patch | 58 --
31 .../qemu/files/qemu-2.7.0-CVE-2016-8668.patch | 30 -
32 .../qemu/files/qemu-2.7.0-CVE-2016-8669-2.patch | 34 -
33 .../qemu/files/qemu-2.7.0-CVE-2016-8909.patch | 31 -
34 .../qemu/files/qemu-2.7.0-CVE-2016-8910.patch | 29 -
35 .../qemu/files/qemu-2.7.0-CVE-2016-9102.patch | 21 -
36 .../qemu/files/qemu-2.7.0-CVE-2016-9103.patch | 27 -
37 .../qemu/files/qemu-2.7.0-CVE-2016-9104.patch | 92 ---
38 .../qemu/files/qemu-2.7.0-CVE-2016-9105.patch | 25 -
39 .../qemu/files/qemu-2.7.0-CVE-2016-9106.patch | 27 -
40 app-emulation/qemu/qemu-2.7.0-r7.ebuild | 707 ---------------------
41 app-emulation/qemu/qemu-2.7.1.ebuild | 699 --------------------
42 30 files changed, 2450 deletions(-)
43
44 diff --git a/app-emulation/qemu/Manifest b/app-emulation/qemu/Manifest
45 index 46537bc26f..36a9241809 100644
46 --- a/app-emulation/qemu/Manifest
47 +++ b/app-emulation/qemu/Manifest
48 @@ -1,3 +1 @@
49 -DIST qemu-2.7.0.tar.bz2 26867760 SHA256 326e739506ba690daf69fc17bd3913a6c313d9928d743bd8eddb82f403f81e53 SHA512 654acaa7b3724a288e5d7e2a26ab780d9c9ed9f647fba00a906cbaffbe9d58fd666f2d962514aa2c5b391b4c53811ac3170d2eb51727f090bd19dfe45ca9a9db WHIRLPOOL dcb3e5f7da89dd8e14d636d7ebd476e076e0043880bb9ea3fb1c03cb4bcd4e5c7d3c4719da26c3ce521e3a3db5ae671e86f198ac1bc3474e774d75504fef8b8d
50 -DIST qemu-2.7.1.tar.bz2 26868403 SHA256 68636788eb69bcb0b44ba220b32b50495d6bd5712a934c282217831c4822958f SHA512 16a83946e9064733254c82c961749bf9c56a0a2a8ee46145b4a78e1452ac0e2548d888963d18c80e28f65202890fd643b0011951b5b1c66ef16234767ed91898 WHIRLPOOL ae3d3c2b2a3700613733659847de6187755631cb09e8c3548ea30cd994357c9ff128646edce88dfe4dce53e6c1c0f37f8de3688ee7e22262033b40f3fc706efa
51 DIST qemu-2.8.0.tar.bz2 28368517 SHA256 dafd5d7f649907b6b617b822692f4c82e60cf29bc0fc58bc2036219b591e5e62 SHA512 50f2988d822388ba9fd1bf5dbe68359033ed7432d7f0f9790299f32f63faa6dc72979256b5632ba572d47ee3e74ed40e3e8e331dc6303ec1599f1b4367cb78c2 WHIRLPOOL 0ce4e0539657eb832e4039819e7360c792b6aa41c718f0e0d762f4933217f0d370af94b1d6d9776853575b4a6811d8c85db069bf09d21bd15399ac8b50440ff5
52
53 diff --git a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-6836.patch b/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-6836.patch
54 deleted file mode 100644
55 index 56f7435df5..0000000000
56 --- a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-6836.patch
57 +++ /dev/null
58 @@ -1,27 +0,0 @@
59 -From: Li Qiang <address@hidden>
60 -
61 -In Vmxnet3 device emulator while processing transmit(tx) queue,
62 -when it reaches end of packet, it calls vmxnet3_complete_packet.
63 -In that local 'txcq_descr' object is not initialised, which could
64 -leak host memory bytes a guest.
65 -
66 -Reported-by: Li Qiang <address@hidden>
67 -Signed-off-by: Prasad J Pandit <address@hidden>
68 ----
69 - hw/net/vmxnet3.c | 1 +
70 - 1 file changed, 1 insertion(+)
71 -
72 -diff --git a/hw/net/vmxnet3.c b/hw/net/vmxnet3.c
73 -index 90f6943..92f6af9 100644
74 ---- a/hw/net/vmxnet3.c
75 -+++ b/hw/net/vmxnet3.c
76 -@@ -531,6 +531,7 @@ static void vmxnet3_complete_packet(VMXNET3State *s, int qidx, uint32_t tx_ridx)
77 -
78 - VMXNET3_RING_DUMP(VMW_RIPRN, "TXC", qidx, &s->txq_descr[qidx].comp_ring);
79 -
80 -+ memset(&txcq_descr, 0, sizeof(txcq_descr));
81 - txcq_descr.txdIdx = tx_ridx;
82 - txcq_descr.gen = vmxnet3_ring_curr_gen(&s->txq_descr[qidx].comp_ring);
83 -
84 ---
85 -2.5.5
86
87 diff --git a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7155.patch b/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7155.patch
88 deleted file mode 100644
89 index 495faf2f1c..0000000000
90 --- a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7155.patch
91 +++ /dev/null
92 @@ -1,81 +0,0 @@
93 -From: Prasad J Pandit <address@hidden>
94 -
95 -Vmware Paravirtual SCSI emulation uses command descriptors to
96 -process SCSI commands. These descriptors come with their ring
97 -buffers. A guest could set the page count for these rings to
98 -an arbitrary value, leading to infinite loop or OOB access.
99 -Add check to avoid it.
100 -
101 -Reported-by: Tom Victor <address@hidden>
102 -Reported-by: Li Qiang <address@hidden>
103 -Signed-off-by: Prasad J Pandit <address@hidden>
104 ----
105 - hw/scsi/vmw_pvscsi.c | 21 ++++++++++-----------
106 - 1 file changed, 10 insertions(+), 11 deletions(-)
107 -
108 -Update per review
109 - -> https://lists.gnu.org/archive/html/qemu-devel/2016-09/msg00019.html
110 -
111 -diff --git a/hw/scsi/vmw_pvscsi.c b/hw/scsi/vmw_pvscsi.c
112 -index 5116f4a..4245c15 100644
113 ---- a/hw/scsi/vmw_pvscsi.c
114 -+++ b/hw/scsi/vmw_pvscsi.c
115 -@@ -152,7 +152,7 @@ pvscsi_log2(uint32_t input)
116 - return log;
117 - }
118 -
119 --static int
120 -+static void
121 - pvscsi_ring_init_data(PVSCSIRingInfo *m, PVSCSICmdDescSetupRings *ri)
122 - {
123 - int i;
124 -@@ -160,10 +160,6 @@ pvscsi_ring_init_data(PVSCSIRingInfo *m, PVSCSICmdDescSetupRings *ri)
125 - uint32_t req_ring_size, cmp_ring_size;
126 - m->rs_pa = ri->ringsStatePPN << VMW_PAGE_SHIFT;
127 -
128 -- if ((ri->reqRingNumPages > PVSCSI_SETUP_RINGS_MAX_NUM_PAGES)
129 -- || (ri->cmpRingNumPages > PVSCSI_SETUP_RINGS_MAX_NUM_PAGES)) {
130 -- return -1;
131 -- }
132 - req_ring_size = ri->reqRingNumPages * PVSCSI_MAX_NUM_REQ_ENTRIES_PER_PAGE;
133 - cmp_ring_size = ri->cmpRingNumPages * PVSCSI_MAX_NUM_CMP_ENTRIES_PER_PAGE;
134 - txr_len_log2 = pvscsi_log2(req_ring_size - 1);
135 -@@ -195,8 +191,6 @@ pvscsi_ring_init_data(PVSCSIRingInfo *m, PVSCSICmdDescSetupRings *ri)
136 -
137 - /* Flush ring state page changes */
138 - smp_wmb();
139 --
140 -- return 0;
141 - }
142 -
143 - static int
144 -@@ -746,7 +740,7 @@ pvscsi_dbg_dump_tx_rings_config(PVSCSICmdDescSetupRings *rc)
145 -
146 - trace_pvscsi_tx_rings_num_pages("Confirm Ring", rc->cmpRingNumPages);
147 - for (i = 0; i < rc->cmpRingNumPages; i++) {
148 -- trace_pvscsi_tx_rings_ppn("Confirm Ring", rc->reqRingPPNs[i]);
149 -+ trace_pvscsi_tx_rings_ppn("Confirm Ring", rc->cmpRingPPNs[i]);
150 - }
151 - }
152 -
153 -@@ -779,10 +773,15 @@ pvscsi_on_cmd_setup_rings(PVSCSIState *s)
154 -
155 - trace_pvscsi_on_cmd_arrived("PVSCSI_CMD_SETUP_RINGS");
156 -
157 -+ if (!rc->reqRingNumPages
158 -+ || rc->reqRingNumPages > PVSCSI_SETUP_RINGS_MAX_NUM_PAGES
159 -+ || !rc->cmpRingNumPages
160 -+ || rc->cmpRingNumPages > PVSCSI_SETUP_RINGS_MAX_NUM_PAGES) {
161 -+ return PVSCSI_COMMAND_PROCESSING_FAILED;
162 -+ }
163 -+
164 - pvscsi_dbg_dump_tx_rings_config(rc);
165 -- if (pvscsi_ring_init_data(&s->rings, rc) < 0) {
166 -- return PVSCSI_COMMAND_PROCESSING_FAILED;
167 -- }
168 -+ pvscsi_ring_init_data(&s->rings, rc);
169 -
170 - s->rings_info_valid = TRUE;
171 - return PVSCSI_COMMAND_PROCESSING_SUCCEEDED;
172 ---
173 -2.5.5
174
175 diff --git a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7156.patch b/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7156.patch
176 deleted file mode 100644
177 index 9c21a6759a..0000000000
178 --- a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7156.patch
179 +++ /dev/null
180 @@ -1,62 +0,0 @@
181 -From: Prasad J Pandit <address@hidden>
182 -
183 -In PVSCSI paravirtual SCSI bus, pvscsi_convert_sglist can take a very
184 -long time or go into an infinite loop due to two different bugs:
185 -
186 -1) the request descriptor data length is defined to be 64 bit. While
187 -building SG list from a request descriptor, it gets truncated to 32bit
188 -in routine 'pvscsi_convert_sglist'. This could lead to an infinite loop
189 -situation for large 'dataLen' values, when data_length is cast to uint32_t
190 -and chunk_size becomes always zero. Fix this by removing the incorrect
191 -cast.
192 -
193 -2) pvscsi_get_next_sg_elem can be called arbitrarily many times if the
194 -element has a zero length. Get out of the loop early when this happens,
195 -by introducing an upper limit on the number of SG list elements.
196 -
197 -Reported-by: Li Qiang <address@hidden>
198 -Signed-off-by: Prasad J Pandit <address@hidden>
199 ----
200 - hw/scsi/vmw_pvscsi.c | 11 ++++++-----
201 - 1 file changed, 6 insertions(+), 5 deletions(-)
202 -
203 -Update as per:
204 - -> https://lists.gnu.org/archive/html/qemu-devel/2016-09/msg01172.html
205 -
206 -diff --git a/hw/scsi/vmw_pvscsi.c b/hw/scsi/vmw_pvscsi.c
207 -index 4245c15..babac5a 100644
208 ---- a/hw/scsi/vmw_pvscsi.c
209 -+++ b/hw/scsi/vmw_pvscsi.c
210 -@@ -40,6 +40,8 @@
211 - #define PVSCSI_MAX_DEVS (64)
212 - #define PVSCSI_MSIX_NUM_VECTORS (1)
213 -
214 -+#define PVSCSI_MAX_SG_ELEM 2048
215 -+
216 - #define PVSCSI_MAX_CMD_DATA_WORDS \
217 - (sizeof(PVSCSICmdDescSetupRings)/sizeof(uint32_t))
218 -
219 -@@ -628,17 +630,16 @@ pvscsi_queue_pending_descriptor(PVSCSIState *s, SCSIDevice **d,
220 - static void
221 - pvscsi_convert_sglist(PVSCSIRequest *r)
222 - {
223 -- int chunk_size;
224 -+ uint32_t chunk_size, elmcnt = 0;
225 - uint64_t data_length = r->req.dataLen;
226 - PVSCSISGState sg = r->sg;
227 -- while (data_length) {
228 -- while (!sg.resid) {
229 -+ while (data_length && elmcnt < PVSCSI_MAX_SG_ELEM) {
230 -+ while (!sg.resid && elmcnt++ < PVSCSI_MAX_SG_ELEM) {
231 - pvscsi_get_next_sg_elem(&sg);
232 - trace_pvscsi_convert_sglist(r->req.context, r->sg.dataAddr,
233 - r->sg.resid);
234 - }
235 -- assert(data_length > 0);
236 -- chunk_size = MIN((unsigned) data_length, sg.resid);
237 -+ chunk_size = MIN(data_length, sg.resid);
238 - if (chunk_size) {
239 - qemu_sglist_add(&r->sgl, sg.dataAddr, chunk_size);
240 - }
241 ---
242 -2.5.5
243
244 diff --git a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7157-1.patch b/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7157-1.patch
245 deleted file mode 100644
246 index 480de308e0..0000000000
247 --- a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7157-1.patch
248 +++ /dev/null
249 @@ -1,28 +0,0 @@
250 -From: Prasad J Pandit <address@hidden>
251 -
252 -When LSI SAS1068 Host Bus emulator builds configuration page
253 -headers, the format string used in 'mptsas_config_manufacturing_1'
254 -was wrong. It could lead to an invalid memory access.
255 -
256 -Reported-by: Tom Victor <address@hidden>
257 -Fix-suggested-by: Paolo Bonzini <address@hidden>
258 -Signed-off-by: Prasad J Pandit <address@hidden>
259 ----
260 - hw/scsi/mptconfig.c | 2 +-
261 - 1 file changed, 1 insertion(+), 1 deletion(-)
262 -
263 -diff --git a/hw/scsi/mptconfig.c b/hw/scsi/mptconfig.c
264 -index 7071854..1ec895b 100644
265 ---- a/hw/scsi/mptconfig.c
266 -+++ b/hw/scsi/mptconfig.c
267 -@@ -203,7 +203,7 @@ size_t mptsas_config_manufacturing_1(MPTSASState *s, uint8_t **data, int address
268 - {
269 - /* VPD - all zeros */
270 - return MPTSAS_CONFIG_PACK(1, MPI_CONFIG_PAGETYPE_MANUFACTURING, 0x00,
271 -- "s256");
272 -+ "*s256");
273 - }
274 -
275 - static
276 ---
277 -2.5.5
278
279 diff --git a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7157-2.patch b/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7157-2.patch
280 deleted file mode 100644
281 index 5e796086ae..0000000000
282 --- a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7157-2.patch
283 +++ /dev/null
284 @@ -1,27 +0,0 @@
285 -From: Prasad J Pandit <address@hidden>
286 -
287 -When LSI SAS1068 Host Bus emulator builds configuration page
288 -headers, mptsas_config_pack() asserts to check returned size
289 -value is within limit of 256 bytes. Fix that assert expression.
290 -
291 -Suggested-by: Paolo Bonzini <address@hidden>
292 -Signed-off-by: Prasad J Pandit <address@hidden>
293 ----
294 - hw/scsi/mptconfig.c | 2 +-
295 - 1 file changed, 1 insertion(+), 1 deletion(-)
296 -
297 -diff --git a/hw/scsi/mptconfig.c b/hw/scsi/mptconfig.c
298 -index 1ec895b..531947f 100644
299 ---- a/hw/scsi/mptconfig.c
300 -+++ b/hw/scsi/mptconfig.c
301 -@@ -158,7 +158,7 @@ static size_t mptsas_config_pack(uint8_t **data, const char *fmt, ...)
302 - va_end(ap);
303 -
304 - if (data) {
305 -- assert(ret < 256 && (ret % 4) == 0);
306 -+ assert(ret / 4 < 256);
307 - stb_p(*data + 1, ret / 4);
308 - }
309 - return ret;
310 ---
311 -2.5.5
312
313 diff --git a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7170.patch b/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7170.patch
314 deleted file mode 100644
315 index 7eb5f76dd1..0000000000
316 --- a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7170.patch
317 +++ /dev/null
318 @@ -1,40 +0,0 @@
319 -From: Prasad J Pandit <address@hidden>
320 -
321 -When processing svga command DEFINE_CURSOR in vmsvga_fifo_run,
322 -the computed BITMAP and PIXMAP size are checked against the
323 -'cursor.mask[]' and 'cursor.image[]' array sizes in bytes.
324 -Correct these checks to avoid OOB memory access.
325 -
326 -Reported-by: Qinghao Tang <address@hidden>
327 -Reported-by: Li Qiang <address@hidden>
328 -Signed-off-by: Prasad J Pandit <address@hidden>
329 ----
330 - hw/display/vmware_vga.c | 12 +++++++-----
331 - 1 file changed, 7 insertions(+), 5 deletions(-)
332 -
333 -diff --git a/hw/display/vmware_vga.c b/hw/display/vmware_vga.c
334 -index e51a05e..6599cf0 100644
335 ---- a/hw/display/vmware_vga.c
336 -+++ b/hw/display/vmware_vga.c
337 -@@ -676,11 +676,13 @@ static void vmsvga_fifo_run(struct vmsvga_state_s *s)
338 - cursor.bpp = vmsvga_fifo_read(s);
339 -
340 - args = SVGA_BITMAP_SIZE(x, y) + SVGA_PIXMAP_SIZE(x, y, cursor.bpp);
341 -- if (cursor.width > 256 ||
342 -- cursor.height > 256 ||
343 -- cursor.bpp > 32 ||
344 -- SVGA_BITMAP_SIZE(x, y) > sizeof cursor.mask ||
345 -- SVGA_PIXMAP_SIZE(x, y, cursor.bpp) > sizeof cursor.image) {
346 -+ if (cursor.width > 256
347 -+ || cursor.height > 256
348 -+ || cursor.bpp > 32
349 -+ || SVGA_BITMAP_SIZE(x, y)
350 -+ > sizeof(cursor.mask) / sizeof(cursor.mask[0])
351 -+ || SVGA_PIXMAP_SIZE(x, y, cursor.bpp)
352 -+ > sizeof(cursor.image) / sizeof(cursor.image[0])) {
353 - goto badcmd;
354 - }
355 -
356 ---
357 -2.5.5
358 -
359
360 diff --git a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7421.patch b/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7421.patch
361 deleted file mode 100644
362 index b9f354537a..0000000000
363 --- a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7421.patch
364 +++ /dev/null
365 @@ -1,34 +0,0 @@
366 -From: Prasad J Pandit <address@hidden>
367 -
368 -Vmware Paravirtual SCSI emulator while processing IO requests
369 -could run into an infinite loop if 'pvscsi_ring_pop_req_descr'
370 -always returned positive value. Limit IO loop to the ring size.
371 -
372 -Cc: address@hidden
373 -Reported-by: Li Qiang <address@hidden>
374 -Signed-off-by: Prasad J Pandit <address@hidden>
375 -Message-Id: <address@hidden>
376 -Signed-off-by: Paolo Bonzini <address@hidden>
377 ----
378 - hw/scsi/vmw_pvscsi.c | 5 ++++-
379 - 1 file changed, 4 insertions(+), 1 deletion(-)
380 -
381 -diff --git a/hw/scsi/vmw_pvscsi.c b/hw/scsi/vmw_pvscsi.c
382 -index babac5a..a5ce7de 100644
383 ---- a/hw/scsi/vmw_pvscsi.c
384 -+++ b/hw/scsi/vmw_pvscsi.c
385 -@@ -247,8 +247,11 @@ static hwaddr
386 - pvscsi_ring_pop_req_descr(PVSCSIRingInfo *mgr)
387 - {
388 - uint32_t ready_ptr = RS_GET_FIELD(mgr, reqProdIdx);
389 -+ uint32_t ring_size = PVSCSI_MAX_NUM_PAGES_REQ_RING
390 -+ * PVSCSI_MAX_NUM_REQ_ENTRIES_PER_PAGE;
391 -
392 -- if (ready_ptr != mgr->consumed_ptr) {
393 -+ if (ready_ptr != mgr->consumed_ptr
394 -+ && ready_ptr - mgr->consumed_ptr < ring_size) {
395 - uint32_t next_ready_ptr =
396 - mgr->consumed_ptr++ & mgr->txr_len_mask;
397 - uint32_t next_ready_page =
398 ---
399 -1.8.3.1
400
401 diff --git a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7422.patch b/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7422.patch
402 deleted file mode 100644
403 index cc60581086..0000000000
404 --- a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7422.patch
405 +++ /dev/null
406 @@ -1,37 +0,0 @@
407 -From 973e7170dddefb491a48df5cba33b2ae151013a0 Mon Sep 17 00:00:00 2001
408 -From: Prasad J Pandit <pjp@×××××××××××××.org>
409 -Date: Mon, 19 Sep 2016 23:55:45 +0530
410 -Subject: [PATCH] virtio: add check for descriptor's mapped address
411 -
412 -virtio back end uses set of buffers to facilitate I/O operations.
413 -If its size is too large, 'cpu_physical_memory_map' could return
414 -a null address. This would result in a null dereference while
415 -un-mapping descriptors. Add check to avoid it.
416 -
417 -Reported-by: Qinghao Tang <luodalongde@×××××.com>
418 -Signed-off-by: Prasad J Pandit <pjp@×××××××××××××.org>
419 -Reviewed-by: Michael S. Tsirkin <mst@××××××.com>
420 -Signed-off-by: Michael S. Tsirkin <mst@××××××.com>
421 -Reviewed-by: Laszlo Ersek <lersek@××××××.com>
422 ----
423 - hw/virtio/virtio.c | 5 +++++
424 - 1 file changed, 5 insertions(+)
425 -
426 -diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
427 -index fcf3358d6c0d..bb656b1ccff0 100644
428 ---- a/hw/virtio/virtio.c
429 -+++ b/hw/virtio/virtio.c
430 -@@ -495,6 +495,11 @@ static void virtqueue_map_desc(unsigned int *p_num_sg, hwaddr *addr, struct iove
431 - }
432 -
433 - iov[num_sg].iov_base = cpu_physical_memory_map(pa, &len, is_write);
434 -+ if (!iov[num_sg].iov_base) {
435 -+ error_report("virtio: bogus descriptor or out of resources");
436 -+ exit(1);
437 -+ }
438 -+
439 - iov[num_sg].iov_len = len;
440 - addr[num_sg] = pa;
441 -
442 ---
443 -2.11.0
444
445 diff --git a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7423.patch b/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7423.patch
446 deleted file mode 100644
447 index fdd871b162..0000000000
448 --- a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7423.patch
449 +++ /dev/null
450 @@ -1,31 +0,0 @@
451 -From: Li Qiang <address@hidden>
452 -
453 -When processing IO request in mptsas, it uses g_new to allocate
454 -a 'req' object. If an error occurs before 'req->sreq' is
455 -allocated, It could lead to an OOB write in mptsas_free_request
456 -function. Use g_new0 to avoid it.
457 -
458 -Reported-by: Li Qiang <address@hidden>
459 -Signed-off-by: Prasad J Pandit <address@hidden>
460 -Message-Id: <address@hidden>
461 -Cc: address@hidden
462 -Signed-off-by: Paolo Bonzini <address@hidden>
463 ----
464 - hw/scsi/mptsas.c | 2 +-
465 - 1 file changed, 1 insertion(+), 1 deletion(-)
466 -
467 -diff --git a/hw/scsi/mptsas.c b/hw/scsi/mptsas.c
468 -index 0e0a22f..eaae1bb 100644
469 ---- a/hw/scsi/mptsas.c
470 -+++ b/hw/scsi/mptsas.c
471 -@@ -304,7 +304,7 @@ static int mptsas_process_scsi_io_request(MPTSASState *s,
472 - goto bad;
473 - }
474 -
475 -- req = g_new(MPTSASRequest, 1);
476 -+ req = g_new0(MPTSASRequest, 1);
477 - QTAILQ_INSERT_TAIL(&s->pending, req, next);
478 - req->scsi_io = *scsi_io;
479 - req->dev = s;
480 ---
481 -1.8.3.1
482
483 diff --git a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7466.patch b/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7466.patch
484 deleted file mode 100644
485 index d5028bb168..0000000000
486 --- a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7466.patch
487 +++ /dev/null
488 @@ -1,26 +0,0 @@
489 -From: Li Qiang <address@hidden>
490 -
491 -If the xhci uses msix, it doesn't free the corresponding
492 -memory, thus leading a memory leak. This patch avoid this.
493 -
494 -Signed-off-by: Li Qiang <address@hidden>
495 ----
496 - hw/usb/hcd-xhci.c | 3 +--
497 - 1 file changed, 1 insertion(+), 2 deletions(-)
498 -
499 -diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c
500 -index 188f954..281a2a5 100644
501 ---- a/hw/usb/hcd-xhci.c
502 -+++ b/hw/usb/hcd-xhci.c
503 -@@ -3709,8 +3709,7 @@ static void usb_xhci_exit(PCIDevice *dev)
504 - /* destroy msix memory region */
505 - if (dev->msix_table && dev->msix_pba
506 - && dev->msix_entry_used) {
507 -- memory_region_del_subregion(&xhci->mem, &dev->msix_table_mmio);
508 -- memory_region_del_subregion(&xhci->mem, &dev->msix_pba_mmio);
509 -+ msix_uninit(dev, &xhci->mem, &xhci->mem);
510 - }
511 -
512 - usb_bus_release(&xhci->bus);
513 ---
514 -1.8.3.1
515
516 diff --git a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7907.patch b/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7907.patch
517 deleted file mode 100644
518 index 34b095a513..0000000000
519 --- a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7907.patch
520 +++ /dev/null
521 @@ -1,45 +0,0 @@
522 -From: Prasad J Pandit <address@hidden>
523 -
524 -i.MX Fast Ethernet Controller uses buffer descriptors to manage
525 -data flow to/fro receive & transmit queues. While transmitting
526 -packets, it could continue to read buffer descriptors if a buffer
527 -descriptor has length of zero and has crafted values in bd.flags.
528 -Set an upper limit to number of buffer descriptors.
529 -
530 -Reported-by: Li Qiang <address@hidden>
531 -Signed-off-by: Prasad J Pandit <address@hidden>
532 ----
533 - hw/net/imx_fec.c | 6 ++++--
534 - 1 file changed, 4 insertions(+), 2 deletions(-)
535 -
536 -Update per
537 - -> https://lists.gnu.org/archive/html/qemu-devel/2016-09/msg05284.html
538 -
539 -diff --git a/hw/net/imx_fec.c b/hw/net/imx_fec.c
540 -index 1c415ab..1d74827 100644
541 ---- a/hw/net/imx_fec.c
542 -+++ b/hw/net/imx_fec.c
543 -@@ -220,6 +220,8 @@ static const VMStateDescription vmstate_imx_eth = {
544 - #define PHY_INT_PARFAULT (1 << 2)
545 - #define PHY_INT_AUTONEG_PAGE (1 << 1)
546 -
547 -+#define IMX_MAX_DESC 1024
548 -+
549 - static void imx_eth_update(IMXFECState *s);
550 -
551 - /*
552 -@@ -402,12 +404,12 @@ static void imx_eth_update(IMXFECState *s)
553 -
554 - static void imx_fec_do_tx(IMXFECState *s)
555 - {
556 -- int frame_size = 0;
557 -+ int frame_size = 0, descnt = 0;
558 - uint8_t frame[ENET_MAX_FRAME_SIZE];
559 - uint8_t *ptr = frame;
560 - uint32_t addr = s->tx_descriptor;
561 -
562 -- while (1) {
563 -+ while (descnt++ < IMX_MAX_DESC) {
564 - IMXFECBufDesc bd;
565 - int len;
566 -
567
568 diff --git a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7908.patch b/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7908.patch
569 deleted file mode 100644
570 index 16d072fe79..0000000000
571 --- a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7908.patch
572 +++ /dev/null
573 @@ -1,52 +0,0 @@
574 -From 070c4b92b8cd5390889716677a0b92444d6e087a Mon Sep 17 00:00:00 2001
575 -From: Prasad J Pandit <pjp@×××××××××××××.org>
576 -Date: Thu, 22 Sep 2016 16:02:37 +0530
577 -Subject: [PATCH] net: mcf: limit buffer descriptor count
578 -
579 -ColdFire Fast Ethernet Controller uses buffer descriptors to manage
580 -data flow to/fro receive & transmit queues. While transmitting
581 -packets, it could continue to read buffer descriptors if a buffer
582 -descriptor has length of zero and has crafted values in bd.flags.
583 -Set upper limit to number of buffer descriptors.
584 -
585 -Reported-by: Li Qiang <liqiang6-s@×××.cn>
586 -Signed-off-by: Prasad J Pandit <pjp@×××××××××××××.org>
587 -Reviewed-by: Paolo Bonzini <pbonzini@××××××.com>
588 -Signed-off-by: Jason Wang <jasowang@××××××.com>
589 ----
590 - hw/net/mcf_fec.c | 5 +++--
591 - 1 files changed, 3 insertions(+), 2 deletions(-)
592 -
593 -diff --git a/hw/net/mcf_fec.c b/hw/net/mcf_fec.c
594 -index 0ee8ad9..d31fea1 100644
595 ---- a/hw/net/mcf_fec.c
596 -+++ b/hw/net/mcf_fec.c
597 -@@ -23,6 +23,7 @@ do { printf("mcf_fec: " fmt , ## __VA_ARGS__); } while (0)
598 - #define DPRINTF(fmt, ...) do {} while(0)
599 - #endif
600 -
601 -+#define FEC_MAX_DESC 1024
602 - #define FEC_MAX_FRAME_SIZE 2032
603 -
604 - typedef struct {
605 -@@ -149,7 +150,7 @@ static void mcf_fec_do_tx(mcf_fec_state *s)
606 - uint32_t addr;
607 - mcf_fec_bd bd;
608 - int frame_size;
609 -- int len;
610 -+ int len, descnt = 0;
611 - uint8_t frame[FEC_MAX_FRAME_SIZE];
612 - uint8_t *ptr;
613 -
614 -@@ -157,7 +158,7 @@ static void mcf_fec_do_tx(mcf_fec_state *s)
615 - ptr = frame;
616 - frame_size = 0;
617 - addr = s->tx_descriptor;
618 -- while (1) {
619 -+ while (descnt++ < FEC_MAX_DESC) {
620 - mcf_fec_read_bd(&bd, addr);
621 - DPRINTF("tx_bd %x flags %04x len %d data %08x\n",
622 - addr, bd.flags, bd.length, bd.data);
623 ---
624 -1.7.0.4
625 -
626
627 diff --git a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7909.patch b/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7909.patch
628 deleted file mode 100644
629 index 8e6ecff892..0000000000
630 --- a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7909.patch
631 +++ /dev/null
632 @@ -1,32 +0,0 @@
633 -From: Prasad J Pandit <address@hidden>
634 -
635 -The AMD PC-Net II emulator has set of control and status(CSR)
636 -registers. Of these, CSR76 and CSR78 hold receive and transmit
637 -descriptor ring length respectively. This ring length could range
638 -from 1 to 65535. Setting ring length to zero leads to an infinite
639 -loop in pcnet_rdra_addr. Add check to avoid it.
640 -
641 -Reported-by: Li Qiang <address@hidden>
642 -Signed-off-by: Prasad J Pandit <address@hidden>
643 ----
644 - hw/net/pcnet.c | 3 +++
645 - 1 file changed, 3 insertions(+)
646 -
647 -diff --git a/hw/net/pcnet.c b/hw/net/pcnet.c
648 -index 198a01f..3078de8 100644
649 ---- a/hw/net/pcnet.c
650 -+++ b/hw/net/pcnet.c
651 -@@ -1429,8 +1429,11 @@ static void pcnet_csr_writew(PCNetState *s, uint32_t rap, uint32_t new_value)
652 - case 47: /* POLLINT */
653 - case 72:
654 - case 74:
655 -+ break;
656 - case 76: /* RCVRL */
657 - case 78: /* XMTRL */
658 -+ val = (val > 0) ? val : 512;
659 -+ break;
660 - case 112:
661 - if (CSR_STOP(s) || CSR_SPND(s))
662 - break;
663 ---
664 -2.5.5
665
666 diff --git a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7994-1.patch b/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7994-1.patch
667 deleted file mode 100644
668 index 6fe77f367d..0000000000
669 --- a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7994-1.patch
670 +++ /dev/null
671 @@ -1,25 +0,0 @@
672 -From: Li Qiang <address@hidden>
673 -
674 -In virtio gpu resource create dispatch, if the pixman format is zero
675 -it doesn't free the resource object allocated previously. Thus leading
676 -a host memory leak issue. This patch avoid this.
677 -
678 -Signed-off-by: Li Qiang <address@hidden>
679 ----
680 - hw/display/virtio-gpu.c | 1 +
681 - 1 file changed, 1 insertion(+)
682 -
683 -diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c
684 -index 7fe6ed8..5b6d17b 100644
685 ---- a/hw/display/virtio-gpu.c
686 -+++ b/hw/display/virtio-gpu.c
687 -@@ -333,6 +333,7 @@ static void virtio_gpu_resource_create_2d(VirtIOGPU *g,
688 - qemu_log_mask(LOG_GUEST_ERROR,
689 - "%s: host couldn't handle guest format %d\n",
690 - __func__, c2d.format);
691 -+ g_free(res);
692 - cmd->error = VIRTIO_GPU_RESP_ERR_INVALID_PARAMETER;
693 - return;
694 - }
695 ---
696 -1.8.3.1
697
698 diff --git a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7994-2.patch b/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7994-2.patch
699 deleted file mode 100644
700 index dce1b2b2a3..0000000000
701 --- a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7994-2.patch
702 +++ /dev/null
703 @@ -1,26 +0,0 @@
704 -From: Li Qiang <address@hidden>
705 -
706 -While processing isochronous transfer descriptors(iTD), if the page
707 -select(PG) field value is out of bands it will return. In this
708 -situation the ehci's sg list doesn't be freed thus leading a memory
709 -leak issue. This patch avoid this.
710 -
711 -Signed-off-by: Li Qiang <address@hidden>
712 ----
713 - hw/usb/hcd-ehci.c | 1 +
714 - 1 file changed, 1 insertion(+)
715 -
716 -diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c
717 -index b093db7..f4ece9a 100644
718 ---- a/hw/usb/hcd-ehci.c
719 -+++ b/hw/usb/hcd-ehci.c
720 -@@ -1426,6 +1426,7 @@ static int ehci_process_itd(EHCIState *ehci,
721 - if (off + len > 4096) {
722 - /* transfer crosses page border */
723 - if (pg == 6) {
724 -+ qemu_sglist_destroy(&ehci->isgl);
725 - return -1; /* avoid page pg + 1 */
726 - }
727 - ptr2 = (itd->bufptr[pg + 1] & ITD_BUFPTR_MASK);
728 ---
729 -1.8.3.1
730
731 diff --git a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-8576.patch b/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-8576.patch
732 deleted file mode 100644
733 index 9617cd5dc8..0000000000
734 --- a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-8576.patch
735 +++ /dev/null
736 @@ -1,61 +0,0 @@
737 -From 20009bdaf95d10bf748fa69b104672d3cfaceddf Mon Sep 17 00:00:00 2001
738 -From: Gerd Hoffmann <address@hidden>
739 -Date: Fri, 7 Oct 2016 10:15:29 +0200
740 -Subject: [PATCH] xhci: limit the number of link trbs we are willing to process
741 -
742 -Signed-off-by: Gerd Hoffmann <address@hidden>
743 ----
744 - hw/usb/hcd-xhci.c | 10 ++++++++++
745 - 1 file changed, 10 insertions(+)
746 -
747 -diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c
748 -index 726435c..ee4fa48 100644
749 ---- a/hw/usb/hcd-xhci.c
750 -+++ b/hw/usb/hcd-xhci.c
751 -@@ -54,6 +54,8 @@
752 - * to the specs when it gets them */
753 - #define ER_FULL_HACK
754 -
755 -+#define TRB_LINK_LIMIT 4
756 -+
757 - #define LEN_CAP 0x40
758 - #define LEN_OPER (0x400 + 0x10 * MAXPORTS)
759 - #define LEN_RUNTIME ((MAXINTRS + 1) * 0x20)
760 -@@ -1000,6 +1002,7 @@ static TRBType xhci_ring_fetch(XHCIState *xhci, XHCIRing *ring, XHCITRB *trb,
761 - dma_addr_t *addr)
762 - {
763 - PCIDevice *pci_dev = PCI_DEVICE(xhci);
764 -+ uint32_t link_cnt = 0;
765 -
766 - while (1) {
767 - TRBType type;
768 -@@ -1026,6 +1029,9 @@ static TRBType xhci_ring_fetch(XHCIState *xhci, XHCIRing *ring, XHCITRB *trb,
769 - ring->dequeue += TRB_SIZE;
770 - return type;
771 - } else {
772 -+ if (++link_cnt > TRB_LINK_LIMIT) {
773 -+ return 0;
774 -+ }
775 - ring->dequeue = xhci_mask64(trb->parameter);
776 - if (trb->control & TRB_LK_TC) {
777 - ring->ccs = !ring->ccs;
778 -@@ -1043,6 +1049,7 @@ static int xhci_ring_chain_length(XHCIState *xhci, const XHCIRing *ring)
779 - bool ccs = ring->ccs;
780 - /* hack to bundle together the two/three TDs that make a setup transfer */
781 - bool control_td_set = 0;
782 -+ uint32_t link_cnt = 0;
783 -
784 - while (1) {
785 - TRBType type;
786 -@@ -1058,6 +1065,9 @@ static int xhci_ring_chain_length(XHCIState *xhci, const XHCIRing *ring)
787 - type = TRB_TYPE(trb);
788 -
789 - if (type == TR_LINK) {
790 -+ if (++link_cnt > TRB_LINK_LIMIT) {
791 -+ return -length;
792 -+ }
793 - dequeue = xhci_mask64(trb.parameter);
794 - if (trb.control & TRB_LK_TC) {
795 - ccs = !ccs;
796 ---
797 -1.8.3.1
798
799 diff --git a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-8577.patch b/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-8577.patch
800 deleted file mode 100644
801 index 8c295802c8..0000000000
802 --- a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-8577.patch
803 +++ /dev/null
804 @@ -1,34 +0,0 @@
805 -From: Li Qiang <address@hidden>
806 -
807 -In 9pfs read dispatch function, it doesn't free two QEMUIOVector
808 -object thus causing potential memory leak. This patch avoid this.
809 -
810 -Signed-off-by: Li Qiang <address@hidden>
811 ----
812 - hw/9pfs/9p.c | 5 +++--
813 - 1 file changed, 3 insertions(+), 2 deletions(-)
814 -
815 -diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c
816 -index 119ee58..543a791 100644
817 ---- a/hw/9pfs/9p.c
818 -+++ b/hw/9pfs/9p.c
819 -@@ -1826,14 +1826,15 @@ static void v9fs_read(void *opaque)
820 - if (len < 0) {
821 - /* IO error return the error */
822 - err = len;
823 -- goto out;
824 -+ goto out_free_iovec;
825 - }
826 - } while (count < max_count && len > 0);
827 - err = pdu_marshal(pdu, offset, "d", count);
828 - if (err < 0) {
829 -- goto out;
830 -+ goto out_free_iovec;
831 - }
832 - err += offset + count;
833 -+out_free_iovec:
834 - qemu_iovec_destroy(&qiov);
835 - qemu_iovec_destroy(&qiov_full);
836 - } else if (fidp->fid_type == P9_FID_XATTR) {
837 ---
838 -1.8.3.1
839
840 diff --git a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-8578.patch b/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-8578.patch
841 deleted file mode 100644
842 index 74eee7e4d9..0000000000
843 --- a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-8578.patch
844 +++ /dev/null
845 @@ -1,58 +0,0 @@
846 -From ba42ebb863ab7d40adc79298422ed9596df8f73a Mon Sep 17 00:00:00 2001
847 -From: Li Qiang <liqiang6-s@×××.cn>
848 -Date: Mon, 17 Oct 2016 14:13:58 +0200
849 -Subject: [PATCH] 9pfs: allocate space for guest originated empty strings
850 -
851 -If a guest sends an empty string paramater to any 9P operation, the current
852 -code unmarshals it into a V9fsString equal to { .size = 0, .data = NULL }.
853 -
854 -This is unfortunate because it can cause NULL pointer dereference to happen
855 -at various locations in the 9pfs code. And we don't want to check str->data
856 -everywhere we pass it to strcmp() or any other function which expects a
857 -dereferenceable pointer.
858 -
859 -This patch enforces the allocation of genuine C empty strings instead, so
860 -callers don't have to bother.
861 -
862 -Out of all v9fs_iov_vunmarshal() users, only v9fs_xattrwalk() checks if
863 -the returned string is empty. It now uses v9fs_string_size() since
864 -name.data cannot be NULL anymore.
865 -
866 -Signed-off-by: Li Qiang <liqiang6-s@×××.cn>
867 -[groug, rewritten title and changelog,
868 - fix empty string check in v9fs_xattrwalk()]
869 -Signed-off-by: Greg Kurz <groug@××××.org>
870 ----
871 - fsdev/9p-iov-marshal.c | 2 +-
872 - hw/9pfs/9p.c | 2 +-
873 - 2 files changed, 2 insertions(+), 2 deletions(-)
874 -
875 -diff --git a/fsdev/9p-iov-marshal.c b/fsdev/9p-iov-marshal.c
876 -index 663cad5..1d16f8d 100644
877 ---- a/fsdev/9p-iov-marshal.c
878 -+++ b/fsdev/9p-iov-marshal.c
879 -@@ -125,7 +125,7 @@ ssize_t v9fs_iov_vunmarshal(struct iovec *out_sg, int out_num, size_t offset,
880 - str->data = g_malloc(str->size + 1);
881 - copied = v9fs_unpack(str->data, out_sg, out_num, offset,
882 - str->size);
883 -- if (copied > 0) {
884 -+ if (copied >= 0) {
885 - str->data[str->size] = 0;
886 - } else {
887 - v9fs_string_free(str);
888 -diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c
889 -index 119ee58..39a7e1d 100644
890 ---- a/hw/9pfs/9p.c
891 -+++ b/hw/9pfs/9p.c
892 -@@ -3174,7 +3174,7 @@ static void v9fs_xattrwalk(void *opaque)
893 - goto out;
894 - }
895 - v9fs_path_copy(&xattr_fidp->path, &file_fidp->path);
896 -- if (name.data == NULL) {
897 -+ if (!v9fs_string_size(&name)) {
898 - /*
899 - * listxattr request. Get the size first
900 - */
901 ---
902 -2.7.3
903 -
904
905 diff --git a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-8668.patch b/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-8668.patch
906 deleted file mode 100644
907 index a27d3a6fb1..0000000000
908 --- a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-8668.patch
909 +++ /dev/null
910 @@ -1,30 +0,0 @@
911 -From: Prasad J Pandit <address@hidden>
912 -
913 -Rocker network switch emulator has test registers to help debug
914 -DMA operations. While testing host DMA access, a buffer address
915 -is written to register 'TEST_DMA_ADDR' and its size is written to
916 -register 'TEST_DMA_SIZE'. When performing TEST_DMA_CTRL_INVERT
917 -test, if DMA buffer size was greater than 'INT_MAX', it leads to
918 -an invalid buffer access. Limit the DMA buffer size to avoid it.
919 -
920 -Reported-by: Huawei PSIRT <address@hidden>
921 -Signed-off-by: Prasad J Pandit <address@hidden>
922 ----
923 - hw/net/rocker/rocker.c | 2 +-
924 - 1 file changed, 1 insertion(+), 1 deletion(-)
925 -
926 -diff --git a/hw/net/rocker/rocker.c b/hw/net/rocker/rocker.c
927 -index 30f2ce4..e9d215a 100644
928 ---- a/hw/net/rocker/rocker.c
929 -+++ b/hw/net/rocker/rocker.c
930 -@@ -860,7 +860,7 @@ static void rocker_io_writel(void *opaque, hwaddr addr, uint32_t val)
931 - rocker_msix_irq(r, val);
932 - break;
933 - case ROCKER_TEST_DMA_SIZE:
934 -- r->test_dma_size = val;
935 -+ r->test_dma_size = val & 0xFFFF;
936 - break;
937 - case ROCKER_TEST_DMA_ADDR + 4:
938 - r->test_dma_addr = ((uint64_t)val) << 32 | r->lower32;
939 ---
940 -2.5.5
941
942 diff --git a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-8669-2.patch b/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-8669-2.patch
943 deleted file mode 100644
944 index 23393b7d59..0000000000
945 --- a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-8669-2.patch
946 +++ /dev/null
947 @@ -1,34 +0,0 @@
948 -From: Prasad J Pandit <address@hidden>
949 -
950 -16550A UART device uses an oscillator to generate frequencies
951 -(baud base), which decide communication speed. This speed could
952 -be changed by dividing it by a divider. If the divider is
953 -greater than the baud base, speed is set to zero, leading to a
954 -divide by zero error. Add check to avoid it.
955 -
956 -Reported-by: Huawei PSIRT <address@hidden>
957 -Signed-off-by: Prasad J Pandit <address@hidden>
958 ----
959 - hw/char/serial.c | 3 ++-
960 - 1 file changed, 2 insertions(+), 1 deletion(-)
961 -
962 -Update per
963 - -> https://lists.gnu.org/archive/html/qemu-devel/2016-10/msg02400.html
964 -
965 -diff --git a/hw/char/serial.c b/hw/char/serial.c
966 -index 3442f47..eec72b7 100644
967 ---- a/hw/char/serial.c
968 -+++ b/hw/char/serial.c
969 -@@ -153,8 +153,9 @@ static void serial_update_parameters(SerialState *s)
970 - int speed, parity, data_bits, stop_bits, frame_size;
971 - QEMUSerialSetParams ssp;
972 -
973 -- if (s->divider == 0)
974 -+ if (s->divider == 0 || s->divider > s->baudbase) {
975 - return;
976 -+ }
977 -
978 - /* Start bit. */
979 - frame_size = 1;
980 ---
981 -2.5.5
982
983 diff --git a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-8909.patch b/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-8909.patch
984 deleted file mode 100644
985 index ed6613f896..0000000000
986 --- a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-8909.patch
987 +++ /dev/null
988 @@ -1,31 +0,0 @@
989 -From: Prasad J Pandit <address@hidden>
990 -
991 -Intel HDA emulator uses stream of buffers during DMA data
992 -transfers. Each entry has buffer length and buffer pointer
993 -position, which are used to derive bytes to 'copy'. If this
994 -length and buffer pointer were to be same, 'copy' could be
995 -set to zero(0), leading to an infinite loop. Add check to
996 -avoid it.
997 -
998 -Reported-by: Huawei PSIRT <address@hidden>
999 -Signed-off-by: Prasad J Pandit <address@hidden>
1000 ----
1001 - hw/audio/intel-hda.c | 3 ++-
1002 - 1 file changed, 2 insertions(+), 1 deletion(-)
1003 -
1004 -diff --git a/hw/audio/intel-hda.c b/hw/audio/intel-hda.c
1005 -index cd95340..537face 100644
1006 ---- a/hw/audio/intel-hda.c
1007 -+++ b/hw/audio/intel-hda.c
1008 -@@ -416,7 +416,8 @@ static bool intel_hda_xfer(HDACodecDevice *dev, uint32_t stnr, bool output,
1009 - }
1010 -
1011 - left = len;
1012 -- while (left > 0) {
1013 -+ s = st->bentries;
1014 -+ while (left > 0 && s-- > 0) {
1015 - copy = left;
1016 - if (copy > st->bsize - st->lpib)
1017 - copy = st->bsize - st->lpib;
1018 ---
1019 -2.7.4
1020
1021 diff --git a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-8910.patch b/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-8910.patch
1022 deleted file mode 100644
1023 index c93f79631f..0000000000
1024 --- a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-8910.patch
1025 +++ /dev/null
1026 @@ -1,29 +0,0 @@
1027 -From: Prasad J Pandit <address@hidden>
1028 -
1029 -RTL8139 ethernet controller in C+ mode supports multiple
1030 -descriptor rings, each with maximum of 64 descriptors. While
1031 -processing transmit descriptor ring in 'rtl8139_cplus_transmit',
1032 -it does not limit the descriptor count and runs forever. Add
1033 -check to avoid it.
1034 -
1035 -Reported-by: Andrew Henderson <address@hidden>
1036 -Signed-off-by: Prasad J Pandit <address@hidden>
1037 ----
1038 - hw/net/rtl8139.c | 2 +-
1039 - 1 file changed, 1 insertion(+), 1 deletion(-)
1040 -
1041 -diff --git a/hw/net/rtl8139.c b/hw/net/rtl8139.c
1042 -index 3345bc6..f05e59c 100644
1043 ---- a/hw/net/rtl8139.c
1044 -+++ b/hw/net/rtl8139.c
1045 -@@ -2350,7 +2350,7 @@ static void rtl8139_cplus_transmit(RTL8139State *s)
1046 - {
1047 - int txcount = 0;
1048 -
1049 -- while (rtl8139_cplus_transmit_one(s))
1050 -+ while (txcount < 64 && rtl8139_cplus_transmit_one(s))
1051 - {
1052 - ++txcount;
1053 - }
1054 ---
1055 -2.7.4
1056
1057 diff --git a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-9102.patch b/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-9102.patch
1058 deleted file mode 100644
1059 index 963eca97f4..0000000000
1060 --- a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-9102.patch
1061 +++ /dev/null
1062 @@ -1,21 +0,0 @@
1063 -From: Li Qiang <address@hidden>
1064 -
1065 -The 'fs.xattr.value' field in V9fsFidState object doesn't consider the
1066 -situation that this field has been allocated previously. Every time, it
1067 -will be allocated directly. This leads a host memory leak issue. This
1068 -patch fix this.
1069 -
1070 ---
1071 -1.8.3.1
1072 -diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c
1073 -index 75ba5f1..a4c7109 100644
1074 ---- a/hw/9pfs/9p.c
1075 -+++ b/hw/9pfs/9p.c
1076 -@@ -3269,6 +3269,7 @@ static void v9fs_xattrcreate(void *opaque)
1077 - xattr_fidp->fs.xattr.flags = flags;
1078 - v9fs_string_init(&xattr_fidp->fs.xattr.name);
1079 - v9fs_string_copy(&xattr_fidp->fs.xattr.name, &name);
1080 -+ g_free(xattr_fidp->fs.xattr.value);
1081 - xattr_fidp->fs.xattr.value = g_malloc(size);
1082 - err = offset;
1083 - put_fid(pdu, file_fidp);
1084
1085 diff --git a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-9103.patch b/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-9103.patch
1086 deleted file mode 100644
1087 index 7520863a7d..0000000000
1088 --- a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-9103.patch
1089 +++ /dev/null
1090 @@ -1,27 +0,0 @@
1091 -Author: Li Qiang <liqiang6-s@×××.cn>
1092 -Date: Mon Oct 17 14:13:58 2016 +0200
1093 -
1094 - 9pfs: fix information leak in xattr read
1095 -
1096 - 9pfs uses g_malloc() to allocate the xattr memory space, if the guest
1097 - reads this memory before writing to it, this will leak host heap memory
1098 - to the guest. This patch avoid this.
1099 -
1100 - Signed-off-by: Li Qiang <liqiang6-s@×××.cn>
1101 - Reviewed-by: Greg Kurz <groug@××××.org>
1102 - Signed-off-by: Greg Kurz <groug@××××.org>
1103 -
1104 -diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c
1105 -index 26aa7d5..bf23b01 100644
1106 ---- a/hw/9pfs/9p.c
1107 -+++ b/hw/9pfs/9p.c
1108 -@@ -3269,8 +3269,8 @@ static void coroutine_fn v9fs_xattrcreate(void *opaque)
1109 - xattr_fidp->fs.xattr.flags = flags;
1110 - v9fs_string_init(&xattr_fidp->fs.xattr.name);
1111 - v9fs_string_copy(&xattr_fidp->fs.xattr.name, &name);
1112 - g_free(xattr_fidp->fs.xattr.value);
1113 -- xattr_fidp->fs.xattr.value = g_malloc(size);
1114 -+ xattr_fidp->fs.xattr.value = g_malloc0(size);
1115 - err = offset;
1116 - put_fid(pdu, file_fidp);
1117 - out_nofid:
1118
1119 diff --git a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-9104.patch b/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-9104.patch
1120 deleted file mode 100644
1121 index f1aec55c22..0000000000
1122 --- a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-9104.patch
1123 +++ /dev/null
1124 @@ -1,92 +0,0 @@
1125 -From 7e55d65c56a03dcd2c5d7c49d37c5a74b55d4bd6 Mon Sep 17 00:00:00 2001
1126 -From: Li Qiang <liqiang6-s@×××.cn>
1127 -Date: Tue, 1 Nov 2016 12:00:40 +0100
1128 -Subject: [PATCH] 9pfs: fix integer overflow issue in xattr read/write
1129 -MIME-Version: 1.0
1130 -Content-Type: text/plain; charset=UTF-8
1131 -Content-Transfer-Encoding: 8bit
1132 -
1133 -The v9fs_xattr_read() and v9fs_xattr_write() are passed a guest
1134 -originated offset: they must ensure this offset does not go beyond
1135 -the size of the extended attribute that was set in v9fs_xattrcreate().
1136 -Unfortunately, the current code implement these checks with unsafe
1137 -calculations on 32 and 64 bit values, which may allow a malicious
1138 -guest to cause OOB access anyway.
1139 -
1140 -Fix this by comparing the offset and the xattr size, which are
1141 -both uint64_t, before trying to compute the effective number of bytes
1142 -to read or write.
1143 -
1144 -Suggested-by: Greg Kurz <groug@××××.org>
1145 -Signed-off-by: Li Qiang <liqiang6-s@×××.cn>
1146 -Reviewed-by: Greg Kurz <groug@××××.org>
1147 -Reviewed-By: Guido Günther <agx@×××××××.org>
1148 -Signed-off-by: Greg Kurz <groug@××××.org>
1149 ----
1150 - hw/9pfs/9p.c | 32 ++++++++++++--------------------
1151 - 1 file changed, 12 insertions(+), 20 deletions(-)
1152 -
1153 -diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c
1154 -index ab18ef2..7705ead 100644
1155 ---- a/hw/9pfs/9p.c
1156 -+++ b/hw/9pfs/9p.c
1157 -@@ -1637,20 +1637,17 @@ static int v9fs_xattr_read(V9fsState *s, V9fsPDU *pdu, V9fsFidState *fidp,
1158 - {
1159 - ssize_t err;
1160 - size_t offset = 7;
1161 -- int read_count;
1162 -- int64_t xattr_len;
1163 -+ uint64_t read_count;
1164 - V9fsVirtioState *v = container_of(s, V9fsVirtioState, state);
1165 - VirtQueueElement *elem = v->elems[pdu->idx];
1166 -
1167 -- xattr_len = fidp->fs.xattr.len;
1168 -- read_count = xattr_len - off;
1169 -+ if (fidp->fs.xattr.len < off) {
1170 -+ read_count = 0;
1171 -+ } else {
1172 -+ read_count = fidp->fs.xattr.len - off;
1173 -+ }
1174 - if (read_count > max_count) {
1175 - read_count = max_count;
1176 -- } else if (read_count < 0) {
1177 -- /*
1178 -- * read beyond XATTR value
1179 -- */
1180 -- read_count = 0;
1181 - }
1182 - err = pdu_marshal(pdu, offset, "d", read_count);
1183 - if (err < 0) {
1184 -@@ -1979,23 +1976,18 @@ static int v9fs_xattr_write(V9fsState *s, V9fsPDU *pdu, V9fsFidState *fidp,
1185 - {
1186 - int i, to_copy;
1187 - ssize_t err = 0;
1188 -- int write_count;
1189 -- int64_t xattr_len;
1190 -+ uint64_t write_count;
1191 - size_t offset = 7;
1192 -
1193 -
1194 -- xattr_len = fidp->fs.xattr.len;
1195 -- write_count = xattr_len - off;
1196 -- if (write_count > count) {
1197 -- write_count = count;
1198 -- } else if (write_count < 0) {
1199 -- /*
1200 -- * write beyond XATTR value len specified in
1201 -- * xattrcreate
1202 -- */
1203 -+ if (fidp->fs.xattr.len < off) {
1204 - err = -ENOSPC;
1205 - goto out;
1206 - }
1207 -+ write_count = fidp->fs.xattr.len - off;
1208 -+ if (write_count > count) {
1209 -+ write_count = count;
1210 -+ }
1211 - err = pdu_marshal(pdu, offset, "d", write_count);
1212 - if (err < 0) {
1213 - return err;
1214 ---
1215 -2.7.3
1216 -
1217
1218 diff --git a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-9105.patch b/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-9105.patch
1219 deleted file mode 100644
1220 index cddff97f70..0000000000
1221 --- a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-9105.patch
1222 +++ /dev/null
1223 @@ -1,25 +0,0 @@
1224 -From: Li Qiang <address@hidden>
1225 -
1226 -In v9fs_link dispatch function, it doesn't put the 'oldfidp'
1227 -fid object, this will make the 'oldfidp->ref' never reach to 0,
1228 -thus leading a memory leak issue. This patch fix this.
1229 -
1230 -Signed-off-by: Li Qiang <address@hidden>
1231 ----
1232 - hw/9pfs/9p.c | 1 +
1233 - 1 file changed, 1 insertion(+)
1234 -
1235 -diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c
1236 -index 8b50bfb..29f8b7a 100644
1237 ---- a/hw/9pfs/9p.c
1238 -+++ b/hw/9pfs/9p.c
1239 -@@ -2413,6 +2413,7 @@ static void v9fs_link(void *opaque)
1240 - if (!err) {
1241 - err = offset;
1242 - }
1243 -+ put_fid(pdu, oldfidp);
1244 - out:
1245 - put_fid(pdu, dfidp);
1246 - out_nofid:
1247 ---
1248 -1.8.3.1
1249
1250 diff --git a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-9106.patch b/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-9106.patch
1251 deleted file mode 100644
1252 index 137272d6b8..0000000000
1253 --- a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-9106.patch
1254 +++ /dev/null
1255 @@ -1,27 +0,0 @@
1256 -Author: Li Qiang <liqiang6-s@×××.cn>
1257 -Date: Mon Oct 17 14:13:58 2016 +0200
1258 -
1259 - 9pfs: fix memory leak in v9fs_write
1260 -
1261 - If an error occurs when marshalling the transfer length to the guest, the
1262 - v9fs_write() function doesn't free an IO vector, thus leading to a memory
1263 - leak. This patch fixes the issue.
1264 -
1265 - Signed-off-by: Li Qiang <liqiang6-s@×××.cn>
1266 - Reviewed-by: Greg Kurz <groug@××××.org>
1267 - [groug, rephrased the changelog]
1268 - Signed-off-by: Greg Kurz <groug@××××.org>
1269 -
1270 -diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c
1271 -index d43a552..e88cf25 100644
1272 ---- a/hw/9pfs/9p.c
1273 -+++ b/hw/9pfs/9p.c
1274 -@@ -2090,7 +2090,7 @@ static void coroutine_fn v9fs_write(void *opaque)
1275 - offset = 7;
1276 - err = pdu_marshal(pdu, offset, "d", total);
1277 - if (err < 0) {
1278 -- goto out;
1279 -+ goto out_qiov;
1280 - }
1281 - err += offset;
1282 -
1283
1284 diff --git a/app-emulation/qemu/qemu-2.7.0-r7.ebuild b/app-emulation/qemu/qemu-2.7.0-r7.ebuild
1285 deleted file mode 100644
1286 index 2f0c6ad6c2..0000000000
1287 --- a/app-emulation/qemu/qemu-2.7.0-r7.ebuild
1288 +++ /dev/null
1289 @@ -1,707 +0,0 @@
1290 -# Copyright 1999-2016 Gentoo Foundation
1291 -# Distributed under the terms of the GNU General Public License v2
1292 -# $Id$
1293 -
1294 -EAPI="5"
1295 -
1296 -PYTHON_COMPAT=( python2_7 )
1297 -PYTHON_REQ_USE="ncurses,readline"
1298 -
1299 -PLOCALES="bg de_DE fr_FR hu it tr zh_CN"
1300 -
1301 -inherit eutils flag-o-matic linux-info toolchain-funcs multilib python-r1 \
1302 - user udev fcaps readme.gentoo-r1 pax-utils l10n
1303 -
1304 -if [[ ${PV} = *9999* ]]; then
1305 - EGIT_REPO_URI="git://git.qemu.org/qemu.git"
1306 - inherit git-2
1307 - SRC_URI=""
1308 -else
1309 - SRC_URI="http://wiki.qemu-project.org/download/${P}.tar.bz2"
1310 - KEYWORDS="amd64 ~arm64 ~ppc ~ppc64 x86 ~x86-fbsd"
1311 -fi
1312 -
1313 -DESCRIPTION="QEMU + Kernel-based Virtual Machine userland tools"
1314 -HOMEPAGE="http://www.qemu.org http://www.linux-kvm.org"
1315 -
1316 -LICENSE="GPL-2 LGPL-2 BSD-2"
1317 -SLOT="0"
1318 -IUSE="accessibility +aio alsa bluetooth bzip2 +caps +curl debug +fdt glusterfs \
1319 -gnutls gtk gtk2 infiniband iscsi +jpeg \
1320 -kernel_linux kernel_FreeBSD lzo ncurses nfs nls numa opengl +pin-upstream-blobs
1321 -+png pulseaudio python \
1322 -rbd sasl +seccomp sdl sdl2 selinux smartcard snappy spice ssh static static-softmmu
1323 -static-user systemtap tci test +threads usb usbredir +uuid vde +vhost-net \
1324 -virgl virtfs +vnc vte xattr xen xfs"
1325 -
1326 -COMMON_TARGETS="aarch64 alpha arm cris i386 m68k microblaze microblazeel mips
1327 -mips64 mips64el mipsel or32 ppc ppc64 s390x sh4 sh4eb sparc sparc64 unicore32
1328 -x86_64"
1329 -IUSE_SOFTMMU_TARGETS="${COMMON_TARGETS} lm32 moxie ppcemb tricore xtensa xtensaeb"
1330 -IUSE_USER_TARGETS="${COMMON_TARGETS} armeb mipsn32 mipsn32el ppc64abi32 ppc64le sparc32plus tilegx"
1331 -
1332 -use_softmmu_targets=$(printf ' qemu_softmmu_targets_%s' ${IUSE_SOFTMMU_TARGETS})
1333 -use_user_targets=$(printf ' qemu_user_targets_%s' ${IUSE_USER_TARGETS})
1334 -IUSE+=" ${use_softmmu_targets} ${use_user_targets}"
1335 -
1336 -# Allow no targets to be built so that people can get a tools-only build.
1337 -# Block USE flag configurations known to not work.
1338 -REQUIRED_USE="${PYTHON_REQUIRED_USE}
1339 - gtk2? ( gtk )
1340 - qemu_softmmu_targets_arm? ( fdt )
1341 - qemu_softmmu_targets_microblaze? ( fdt )
1342 - qemu_softmmu_targets_ppc? ( fdt )
1343 - qemu_softmmu_targets_ppc64? ( fdt )
1344 - sdl2? ( sdl )
1345 - static? ( static-softmmu static-user )
1346 - static-softmmu? ( !alsa !pulseaudio !bluetooth !opengl !gtk !gtk2 )
1347 - virtfs? ( xattr )
1348 - vte? ( gtk )"
1349 -
1350 -# Yep, you need both libcap and libcap-ng since virtfs only uses libcap.
1351 -#
1352 -# The attr lib isn't always linked in (although the USE flag is always
1353 -# respected). This is because qemu supports using the C library's API
1354 -# when available rather than always using the extranl library.
1355 -#
1356 -# Older versions of gnutls are supported, but it's simpler to just require
1357 -# the latest versions. This is also why we require nettle.
1358 -#
1359 -# TODO: Split out tools deps into another var. e.g. bzip2 is only used by
1360 -# system binaries and tools, not user binaries.
1361 -COMMON_LIB_DEPEND=">=dev-libs/glib-2.0[static-libs(+)]
1362 - sys-libs/zlib[static-libs(+)]
1363 - bzip2? ( app-arch/bzip2[static-libs(+)] )
1364 - xattr? ( sys-apps/attr[static-libs(+)] )"
1365 -SOFTMMU_LIB_DEPEND="${COMMON_LIB_DEPEND}
1366 - >=x11-libs/pixman-0.28.0[static-libs(+)]
1367 - accessibility? ( app-accessibility/brltty[static-libs(+)] )
1368 - aio? ( dev-libs/libaio[static-libs(+)] )
1369 - alsa? ( >=media-libs/alsa-lib-1.0.13 )
1370 - bluetooth? ( net-wireless/bluez )
1371 - caps? ( sys-libs/libcap-ng[static-libs(+)] )
1372 - curl? ( >=net-misc/curl-7.15.4[static-libs(+)] )
1373 - fdt? ( >=sys-apps/dtc-1.4.0[static-libs(+)] )
1374 - glusterfs? ( >=sys-cluster/glusterfs-3.4.0[static-libs(+)] )
1375 - gnutls? (
1376 - dev-libs/nettle:=[static-libs(+)]
1377 - >=net-libs/gnutls-3.0:=[static-libs(+)]
1378 - )
1379 - gtk? (
1380 - gtk2? (
1381 - x11-libs/gtk+:2
1382 - vte? ( x11-libs/vte:0 )
1383 - )
1384 - !gtk2? (
1385 - x11-libs/gtk+:3
1386 - vte? ( x11-libs/vte:2.91 )
1387 - )
1388 - )
1389 - infiniband? ( sys-fabric/librdmacm:=[static-libs(+)] )
1390 - iscsi? ( net-libs/libiscsi )
1391 - jpeg? ( virtual/jpeg:0=[static-libs(+)] )
1392 - lzo? ( dev-libs/lzo:2[static-libs(+)] )
1393 - ncurses? ( sys-libs/ncurses:0=[static-libs(+)] )
1394 - nfs? ( >=net-fs/libnfs-1.9.3[static-libs(+)] )
1395 - numa? ( sys-process/numactl[static-libs(+)] )
1396 - opengl? (
1397 - virtual/opengl
1398 - media-libs/libepoxy[static-libs(+)]
1399 - media-libs/mesa[static-libs(+)]
1400 - media-libs/mesa[egl,gbm]
1401 - )
1402 - png? ( media-libs/libpng:0=[static-libs(+)] )
1403 - pulseaudio? ( media-sound/pulseaudio )
1404 - rbd? ( sys-cluster/ceph[static-libs(+)] )
1405 - sasl? ( dev-libs/cyrus-sasl[static-libs(+)] )
1406 - sdl? (
1407 - !sdl2? (
1408 - media-libs/libsdl[X]
1409 - >=media-libs/libsdl-1.2.11[static-libs(+)]
1410 - )
1411 - sdl2? (
1412 - media-libs/libsdl2[X]
1413 - media-libs/libsdl2[static-libs(+)]
1414 - )
1415 - )
1416 - seccomp? ( >=sys-libs/libseccomp-2.1.0[static-libs(+)] )
1417 - smartcard? ( >=app-emulation/libcacard-2.5.0[static-libs(+)] )
1418 - snappy? ( app-arch/snappy[static-libs(+)] )
1419 - spice? (
1420 - >=app-emulation/spice-protocol-0.12.3
1421 - >=app-emulation/spice-0.12.0[static-libs(+)]
1422 - )
1423 - ssh? ( >=net-libs/libssh2-1.2.8[static-libs(+)] )
1424 - usb? ( >=virtual/libusb-1-r2[static-libs(+)] )
1425 - usbredir? ( >=sys-apps/usbredir-0.6[static-libs(+)] )
1426 - uuid? ( >=sys-apps/util-linux-2.16.0[static-libs(+)] )
1427 - vde? ( net-misc/vde[static-libs(+)] )
1428 - virgl? ( media-libs/virglrenderer[static-libs(+)] )
1429 - virtfs? ( sys-libs/libcap )
1430 - xfs? ( sys-fs/xfsprogs[static-libs(+)] )"
1431 -USER_LIB_DEPEND="${COMMON_LIB_DEPEND}"
1432 -X86_FIRMWARE_DEPEND="
1433 - >=sys-firmware/ipxe-1.0.0_p20130624
1434 - pin-upstream-blobs? (
1435 - ~sys-firmware/seabios-1.8.2
1436 - ~sys-firmware/sgabios-0.1_pre8
1437 - ~sys-firmware/vgabios-0.7a
1438 - )
1439 - !pin-upstream-blobs? (
1440 - sys-firmware/seabios
1441 - sys-firmware/sgabios
1442 - sys-firmware/vgabios
1443 - )"
1444 -CDEPEND="
1445 - !static-softmmu? ( $(printf "%s? ( ${SOFTMMU_LIB_DEPEND//\[static-libs(+)]} ) " ${use_softmmu_targets}) )
1446 - !static-user? ( $(printf "%s? ( ${USER_LIB_DEPEND//\[static-libs(+)]} ) " ${use_user_targets}) )
1447 - qemu_softmmu_targets_i386? ( ${X86_FIRMWARE_DEPEND} )
1448 - qemu_softmmu_targets_x86_64? ( ${X86_FIRMWARE_DEPEND} )
1449 - python? ( ${PYTHON_DEPS} )
1450 - systemtap? ( dev-util/systemtap )
1451 - xen? ( app-emulation/xen-tools:= )"
1452 -DEPEND="${CDEPEND}
1453 - dev-lang/perl
1454 - =dev-lang/python-2*
1455 - sys-apps/texinfo
1456 - virtual/pkgconfig
1457 - kernel_linux? ( >=sys-kernel/linux-headers-2.6.35 )
1458 - gtk? ( nls? ( sys-devel/gettext ) )
1459 - static-softmmu? ( $(printf "%s? ( ${SOFTMMU_LIB_DEPEND} ) " ${use_softmmu_targets}) )
1460 - static-user? ( $(printf "%s? ( ${USER_LIB_DEPEND} ) " ${use_user_targets}) )
1461 - test? (
1462 - dev-libs/glib[utils]
1463 - sys-devel/bc
1464 - )"
1465 -RDEPEND="${CDEPEND}
1466 - selinux? ( sec-policy/selinux-qemu )
1467 -"
1468 -
1469 -STRIP_MASK="/usr/share/qemu/palcode-clipper"
1470 -
1471 -QA_PREBUILT="
1472 - usr/share/qemu/openbios-ppc
1473 - usr/share/qemu/openbios-sparc64
1474 - usr/share/qemu/openbios-sparc32
1475 - usr/share/qemu/palcode-clipper
1476 - usr/share/qemu/s390-ccw.img
1477 - usr/share/qemu/u-boot.e500
1478 -"
1479 -
1480 -QA_WX_LOAD="usr/bin/qemu-i386
1481 - usr/bin/qemu-x86_64
1482 - usr/bin/qemu-alpha
1483 - usr/bin/qemu-arm
1484 - usr/bin/qemu-cris
1485 - usr/bin/qemu-m68k
1486 - usr/bin/qemu-microblaze
1487 - usr/bin/qemu-microblazeel
1488 - usr/bin/qemu-mips
1489 - usr/bin/qemu-mipsel
1490 - usr/bin/qemu-or32
1491 - usr/bin/qemu-ppc
1492 - usr/bin/qemu-ppc64
1493 - usr/bin/qemu-ppc64abi32
1494 - usr/bin/qemu-sh4
1495 - usr/bin/qemu-sh4eb
1496 - usr/bin/qemu-sparc
1497 - usr/bin/qemu-sparc64
1498 - usr/bin/qemu-armeb
1499 - usr/bin/qemu-sparc32plus
1500 - usr/bin/qemu-s390x
1501 - usr/bin/qemu-unicore32"
1502 -
1503 -DOC_CONTENTS="If you don't have kvm compiled into the kernel, make sure
1504 -you have the kernel module loaded before running kvm. The easiest way to
1505 -ensure that the kernel module is loaded is to load it on boot.\n
1506 -For AMD CPUs the module is called 'kvm-amd'.\n
1507 -For Intel CPUs the module is called 'kvm-intel'.\n
1508 -Please review /etc/conf.d/modules for how to load these.\n\n
1509 -Make sure your user is in the 'kvm' group\n
1510 -Just run 'gpasswd -a <USER> kvm', then have <USER> re-login.\n\n
1511 -For brand new installs, the default permissions on /dev/kvm might not let you
1512 -access it. You can tell udev to reset ownership/perms:\n
1513 -udevadm trigger -c add /dev/kvm"
1514 -
1515 -qemu_support_kvm() {
1516 - if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386 \
1517 - use qemu_softmmu_targets_ppc || use qemu_softmmu_targets_ppc64 \
1518 - use qemu_softmmu_targets_s390x; then
1519 - return 0
1520 - fi
1521 -
1522 - return 1
1523 -}
1524 -
1525 -pkg_pretend() {
1526 - if use kernel_linux && kernel_is lt 2 6 25; then
1527 - eerror "This version of KVM requres a host kernel of 2.6.25 or higher."
1528 - elif use kernel_linux; then
1529 - if ! linux_config_exists; then
1530 - eerror "Unable to check your kernel for KVM support"
1531 - else
1532 - CONFIG_CHECK="~KVM ~TUN ~BRIDGE"
1533 - ERROR_KVM="You must enable KVM in your kernel to continue"
1534 - ERROR_KVM_AMD="If you have an AMD CPU, you must enable KVM_AMD in"
1535 - ERROR_KVM_AMD+=" your kernel configuration."
1536 - ERROR_KVM_INTEL="If you have an Intel CPU, you must enable"
1537 - ERROR_KVM_INTEL+=" KVM_INTEL in your kernel configuration."
1538 - ERROR_TUN="You will need the Universal TUN/TAP driver compiled"
1539 - ERROR_TUN+=" into your kernel or loaded as a module to use the"
1540 - ERROR_TUN+=" virtual network device if using -net tap."
1541 - ERROR_BRIDGE="You will also need support for 802.1d"
1542 - ERROR_BRIDGE+=" Ethernet Bridging for some network configurations."
1543 - use vhost-net && CONFIG_CHECK+=" ~VHOST_NET"
1544 - ERROR_VHOST_NET="You must enable VHOST_NET to have vhost-net"
1545 - ERROR_VHOST_NET+=" support"
1546 -
1547 - if use amd64 || use x86 || use amd64-linux || use x86-linux; then
1548 - CONFIG_CHECK+=" ~KVM_AMD ~KVM_INTEL"
1549 - fi
1550 -
1551 - use python && CONFIG_CHECK+=" ~DEBUG_FS"
1552 - ERROR_DEBUG_FS="debugFS support required for kvm_stat"
1553 -
1554 - # Now do the actual checks setup above
1555 - check_extra_config
1556 - fi
1557 - fi
1558 -
1559 - if grep -qs '/usr/bin/qemu-kvm' "${EROOT}"/etc/libvirt/qemu/*.xml; then
1560 - eerror "The kvm/qemu-kvm wrappers no longer exist, but your libvirt"
1561 - eerror "instances are still pointing to it. Please update your"
1562 - eerror "configs in /etc/libvirt/qemu/ to use the -enable-kvm flag"
1563 - eerror "and the right system binary (e.g. qemu-system-x86_64)."
1564 - die "update your virt configs to not use qemu-kvm"
1565 - fi
1566 -}
1567 -
1568 -pkg_setup() {
1569 - enewgroup kvm 78
1570 -}
1571 -
1572 -# Sanity check to make sure target lists are kept up-to-date.
1573 -check_targets() {
1574 - local var=$1 mak=$2
1575 - local detected sorted
1576 -
1577 - pushd "${S}"/default-configs >/dev/null || die
1578 -
1579 - # Force C locale until glibc is updated. #564936
1580 - detected=$(echo $(printf '%s\n' *-${mak}.mak | sed "s:-${mak}.mak::" | LC_COLLATE=C sort -u))
1581 - sorted=$(echo $(printf '%s\n' ${!var} | LC_COLLATE=C sort -u))
1582 - if [[ ${sorted} != "${detected}" ]] ; then
1583 - eerror "The ebuild needs to be kept in sync."
1584 - eerror "${var}: ${sorted}"
1585 - eerror "$(printf '%-*s' ${#var} configure): ${detected}"
1586 - die "sync ${var} to the list of targets"
1587 - fi
1588 -
1589 - popd >/dev/null
1590 -}
1591 -
1592 -handle_locales() {
1593 - # Make sure locale list is kept up-to-date.
1594 - local detected sorted
1595 - detected=$(echo $(cd po && printf '%s\n' *.po | grep -v messages.po | sed 's:.po$::' | sort -u))
1596 - sorted=$(echo $(printf '%s\n' ${PLOCALES} | sort -u))
1597 - if [[ ${sorted} != "${detected}" ]] ; then
1598 - eerror "The ebuild needs to be kept in sync."
1599 - eerror "PLOCALES: ${sorted}"
1600 - eerror " po/*.po: ${detected}"
1601 - die "sync PLOCALES"
1602 - fi
1603 -
1604 - # Deal with selective install of locales.
1605 - if use nls ; then
1606 - # Delete locales the user does not want. #577814
1607 - rm_loc() { rm po/$1.po || die; }
1608 - l10n_for_each_disabled_locale_do rm_loc
1609 - else
1610 - # Cheap hack to disable gettext .mo generation.
1611 - rm -f po/*.po
1612 - fi
1613 -}
1614 -
1615 -src_prepare() {
1616 - check_targets IUSE_SOFTMMU_TARGETS softmmu
1617 - check_targets IUSE_USER_TARGETS linux-user
1618 -
1619 - # Alter target makefiles to accept CFLAGS set via flag-o
1620 - sed -i -r \
1621 - -e 's/^(C|OP_C|HELPER_C)FLAGS=/\1FLAGS+=/' \
1622 - Makefile Makefile.target || die
1623 -
1624 - epatch "${FILESDIR}"/${PN}-2.5.0-cflags.patch
1625 - epatch "${FILESDIR}"/${PN}-2.5.0-sysmacros.patch
1626 -
1627 - epatch "${FILESDIR}"/${P}-CVE-2016-6836.patch # bug 591242
1628 - epatch "${FILESDIR}"/${P}-CVE-2016-7155.patch # bug 593034
1629 - epatch "${FILESDIR}"/${P}-CVE-2016-7156.patch # bug 593036
1630 - epatch "${FILESDIR}"/${P}-CVE-2016-7157-1.patch # bug 593038
1631 - epatch "${FILESDIR}"/${P}-CVE-2016-7157-2.patch # bug 593038
1632 - epatch "${FILESDIR}"/${P}-CVE-2016-7170.patch # bug 593284
1633 - epatch "${FILESDIR}"/${P}-CVE-2016-7421.patch # bug 593950
1634 - epatch "${FILESDIR}"/${P}-CVE-2016-7422.patch # bug 593956
1635 - epatch "${FILESDIR}"/${P}-CVE-2016-7423.patch # bug 594368
1636 - epatch "${FILESDIR}"/${P}-CVE-2016-7466.patch # bug 594520
1637 - epatch "${FILESDIR}"/${P}-CVE-2016-7907.patch # bug 596048
1638 - epatch "${FILESDIR}"/${P}-CVE-2016-7908.patch # bug 596049
1639 - epatch "${FILESDIR}"/${P}-CVE-2016-7909.patch # bug 596048
1640 - epatch "${FILESDIR}"/${P}-CVE-2016-7994-1.patch # bug 596738
1641 - epatch "${FILESDIR}"/${P}-CVE-2016-7994-2.patch # bug 596738
1642 - epatch "${FILESDIR}"/${P}-CVE-2016-8576.patch # bug 596752
1643 - epatch "${FILESDIR}"/${P}-CVE-2016-8577.patch # bug 596776
1644 - epatch "${FILESDIR}"/${P}-CVE-2016-8578.patch # bug 596774
1645 - epatch "${FILESDIR}"/${P}-CVE-2016-8668.patch # bug 597110
1646 - epatch "${FILESDIR}"/${P}-CVE-2016-8669-1.patch # bug 597108
1647 - epatch "${FILESDIR}"/${P}-CVE-2016-8669-2.patch # bug 597108
1648 - epatch "${FILESDIR}"/${P}-CVE-2016-8909.patch # bug 598044
1649 - epatch "${FILESDIR}"/${P}-CVE-2016-8910.patch # bug 598046
1650 - epatch "${FILESDIR}"/${P}-CVE-2016-9102.patch # bug 598328
1651 - epatch "${FILESDIR}"/${P}-CVE-2016-9103.patch # bug 598328
1652 - epatch "${FILESDIR}"/${P}-CVE-2016-9104.patch # bug 598328
1653 - epatch "${FILESDIR}"/${P}-CVE-2016-9105.patch # bug 598328
1654 - epatch "${FILESDIR}"/${P}-CVE-2016-9106.patch # bug 598772
1655 -
1656 - # Fix ld and objcopy being called directly
1657 - tc-export AR LD OBJCOPY
1658 -
1659 - # Verbose builds
1660 - MAKEOPTS+=" V=1"
1661 -
1662 - epatch_user
1663 -
1664 - # Run after we've applied all patches.
1665 - handle_locales
1666 -}
1667 -
1668 -##
1669 -# configures qemu based on the build directory and the build type
1670 -# we are using.
1671 -#
1672 -qemu_src_configure() {
1673 - debug-print-function ${FUNCNAME} "$@"
1674 -
1675 - local buildtype=$1
1676 - local builddir="${S}/${buildtype}-build"
1677 - local static_flag="static-${buildtype}"
1678 -
1679 - mkdir "${builddir}"
1680 -
1681 - local conf_opts=(
1682 - --prefix=/usr
1683 - --sysconfdir=/etc
1684 - --libdir=/usr/$(get_libdir)
1685 - --docdir=/usr/share/doc/${PF}/html
1686 - --disable-bsd-user
1687 - --disable-guest-agent
1688 - --disable-strip
1689 - --disable-werror
1690 - # We support gnutls/nettle for crypto operations. It is possible
1691 - # to use gcrypt when gnutls/nettle are disabled (but not when they
1692 - # are enabled), but it's not really worth the hassle. Disable it
1693 - # all the time to avoid automatically detecting it. #568856
1694 - --disable-gcrypt
1695 - --python="${PYTHON}"
1696 - --cc="$(tc-getCC)"
1697 - --cxx="$(tc-getCXX)"
1698 - --host-cc="$(tc-getBUILD_CC)"
1699 - $(use_enable debug debug-info)
1700 - $(use_enable debug debug-tcg)
1701 - --enable-docs
1702 - $(use_enable tci tcg-interpreter)
1703 - $(use_enable xattr attr)
1704 - )
1705 -
1706 - # Disable options not used by user targets as the default configure
1707 - # options will autoprobe and try to link in a bunch of unused junk.
1708 - conf_softmmu() {
1709 - if [[ ${buildtype} == "user" ]] ; then
1710 - echo "--disable-${2:-$1}"
1711 - else
1712 - use_enable "$@"
1713 - fi
1714 - }
1715 - conf_opts+=(
1716 - $(conf_softmmu accessibility brlapi)
1717 - $(conf_softmmu aio linux-aio)
1718 - $(conf_softmmu bzip2)
1719 - $(conf_softmmu bluetooth bluez)
1720 - $(conf_softmmu caps cap-ng)
1721 - $(conf_softmmu curl)
1722 - $(conf_softmmu fdt)
1723 - $(conf_softmmu glusterfs)
1724 - $(conf_softmmu gnutls)
1725 - $(conf_softmmu gnutls nettle)
1726 - $(conf_softmmu gtk)
1727 - $(conf_softmmu infiniband rdma)
1728 - $(conf_softmmu iscsi libiscsi)
1729 - $(conf_softmmu jpeg vnc-jpeg)
1730 - $(conf_softmmu kernel_linux kvm)
1731 - $(conf_softmmu lzo)
1732 - $(conf_softmmu ncurses curses)
1733 - $(conf_softmmu nfs libnfs)
1734 - $(conf_softmmu numa)
1735 - $(conf_softmmu opengl)
1736 - $(conf_softmmu png vnc-png)
1737 - $(conf_softmmu rbd)
1738 - $(conf_softmmu sasl vnc-sasl)
1739 - $(conf_softmmu sdl)
1740 - $(conf_softmmu seccomp)
1741 - $(conf_softmmu smartcard)
1742 - $(conf_softmmu snappy)
1743 - $(conf_softmmu spice)
1744 - $(conf_softmmu ssh libssh2)
1745 - $(conf_softmmu usb libusb)
1746 - $(conf_softmmu usbredir usb-redir)
1747 - $(conf_softmmu uuid)
1748 - $(conf_softmmu vde)
1749 - $(conf_softmmu vhost-net)
1750 - $(conf_softmmu virgl virglrenderer)
1751 - $(conf_softmmu virtfs)
1752 - $(conf_softmmu vnc)
1753 - $(conf_softmmu vte)
1754 - $(conf_softmmu xen)
1755 - $(conf_softmmu xen xen-pci-passthrough)
1756 - $(conf_softmmu xfs xfsctl)
1757 - )
1758 -
1759 - case ${buildtype} in
1760 - user)
1761 - conf_opts+=(
1762 - --enable-linux-user
1763 - --disable-system
1764 - --disable-blobs
1765 - --disable-tools
1766 - )
1767 - ;;
1768 - softmmu)
1769 - # audio options
1770 - local audio_opts="oss"
1771 - use alsa && audio_opts="alsa,${audio_opts}"
1772 - use sdl && audio_opts="sdl,${audio_opts}"
1773 - use pulseaudio && audio_opts="pa,${audio_opts}"
1774 -
1775 - conf_opts+=(
1776 - --disable-linux-user
1777 - --enable-system
1778 - --with-system-pixman
1779 - --audio-drv-list="${audio_opts}"
1780 - )
1781 - use gtk && conf_opts+=( --with-gtkabi=$(usex gtk2 2.0 3.0) )
1782 - use sdl && conf_opts+=( --with-sdlabi=$(usex sdl2 2.0 1.2) )
1783 - ;;
1784 - tools)
1785 - conf_opts+=(
1786 - --disable-linux-user
1787 - --disable-system
1788 - --disable-blobs
1789 - $(use_enable bzip2)
1790 - )
1791 - static_flag="static"
1792 - ;;
1793 - esac
1794 -
1795 - local targets="${buildtype}_targets"
1796 - [[ -n ${targets} ]] && conf_opts+=( --target-list="${!targets}" )
1797 -
1798 - # Add support for SystemTAP
1799 - use systemtap && conf_opts+=( --enable-trace-backend=dtrace )
1800 -
1801 - # We always want to attempt to build with PIE support as it results
1802 - # in a more secure binary. But it doesn't work with static or if
1803 - # the current GCC doesn't have PIE support.
1804 - if use ${static_flag}; then
1805 - conf_opts+=( --static --disable-pie )
1806 - else
1807 - gcc-specs-pie && conf_opts+=( --enable-pie )
1808 - fi
1809 -
1810 - echo "../configure ${conf_opts[*]}"
1811 - cd "${builddir}"
1812 - ../configure "${conf_opts[@]}" || die "configure failed"
1813 -
1814 - # FreeBSD's kernel does not support QEMU assigning/grabbing
1815 - # host USB devices yet
1816 - use kernel_FreeBSD && \
1817 - sed -i -E -e "s|^(HOST_USB=)bsd|\1stub|" "${S}"/config-host.mak
1818 -}
1819 -
1820 -src_configure() {
1821 - local target
1822 -
1823 - python_setup
1824 -
1825 - softmmu_targets= softmmu_bins=()
1826 - user_targets= user_bins=()
1827 -
1828 - for target in ${IUSE_SOFTMMU_TARGETS} ; do
1829 - if use "qemu_softmmu_targets_${target}"; then
1830 - softmmu_targets+=",${target}-softmmu"
1831 - softmmu_bins+=( "qemu-system-${target}" )
1832 - fi
1833 - done
1834 -
1835 - for target in ${IUSE_USER_TARGETS} ; do
1836 - if use "qemu_user_targets_${target}"; then
1837 - user_targets+=",${target}-linux-user"
1838 - user_bins+=( "qemu-${target}" )
1839 - fi
1840 - done
1841 -
1842 - softmmu_targets=${softmmu_targets#,}
1843 - user_targets=${user_targets#,}
1844 -
1845 - [[ -n ${softmmu_targets} ]] && qemu_src_configure "softmmu"
1846 - [[ -n ${user_targets} ]] && qemu_src_configure "user"
1847 - [[ -z ${softmmu_targets}${user_targets} ]] && qemu_src_configure "tools"
1848 -}
1849 -
1850 -src_compile() {
1851 - if [[ -n ${user_targets} ]]; then
1852 - cd "${S}/user-build"
1853 - default
1854 - fi
1855 -
1856 - if [[ -n ${softmmu_targets} ]]; then
1857 - cd "${S}/softmmu-build"
1858 - default
1859 - fi
1860 -
1861 - if [[ -z ${softmmu_targets}${user_targets} ]]; then
1862 - cd "${S}/tools-build"
1863 - default
1864 - fi
1865 -}
1866 -
1867 -src_test() {
1868 - if [[ -n ${softmmu_targets} ]]; then
1869 - cd "${S}/softmmu-build"
1870 - pax-mark m */qemu-system-* #515550
1871 - emake -j1 check
1872 - emake -j1 check-report.html
1873 - fi
1874 -}
1875 -
1876 -qemu_python_install() {
1877 - python_domodule "${S}/scripts/qmp/qmp.py"
1878 -
1879 - python_doscript "${S}/scripts/kvm/vmxcap"
1880 - python_doscript "${S}/scripts/qmp/qmp-shell"
1881 - python_doscript "${S}/scripts/qmp/qemu-ga-client"
1882 -}
1883 -
1884 -src_install() {
1885 - if [[ -n ${user_targets} ]]; then
1886 - cd "${S}/user-build"
1887 - emake DESTDIR="${ED}" install
1888 -
1889 - # Install binfmt handler init script for user targets
1890 - newinitd "${FILESDIR}/qemu-binfmt.initd-r1" qemu-binfmt
1891 - fi
1892 -
1893 - if [[ -n ${softmmu_targets} ]]; then
1894 - cd "${S}/softmmu-build"
1895 - emake DESTDIR="${ED}" install
1896 -
1897 - # This might not exist if the test failed. #512010
1898 - [[ -e check-report.html ]] && dohtml check-report.html
1899 -
1900 - if use kernel_linux; then
1901 - udev_dorules "${FILESDIR}"/65-kvm.rules
1902 - fi
1903 -
1904 - if use python; then
1905 - python_foreach_impl qemu_python_install
1906 - fi
1907 - fi
1908 -
1909 - if [[ -z ${softmmu_targets}${user_targets} ]]; then
1910 - cd "${S}/tools-build"
1911 - emake DESTDIR="${ED}" install
1912 - fi
1913 -
1914 - # Disable mprotect on the qemu binaries as they use JITs to be fast #459348
1915 - pushd "${ED}"/usr/bin >/dev/null
1916 - pax-mark m "${softmmu_bins[@]}" "${user_bins[@]}"
1917 - popd >/dev/null
1918 -
1919 - # Install config file example for qemu-bridge-helper
1920 - insinto "/etc/qemu"
1921 - doins "${FILESDIR}/bridge.conf"
1922 -
1923 - # Remove the docdir placed qmp-commands.txt
1924 - mv "${ED}/usr/share/doc/${PF}/html/qmp-commands.txt" "${S}/docs/" || die
1925 -
1926 - cd "${S}"
1927 - dodoc Changelog MAINTAINERS docs/specs/pci-ids.txt
1928 - newdoc pc-bios/README README.pc-bios
1929 - dodoc docs/qmp-*.txt
1930 -
1931 - if [[ -n ${softmmu_targets} ]]; then
1932 - # Remove SeaBIOS since we're using the SeaBIOS packaged one
1933 - rm "${ED}/usr/share/qemu/bios.bin"
1934 - if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
1935 - dosym ../seabios/bios.bin /usr/share/qemu/bios.bin
1936 - fi
1937 -
1938 - # Remove vgabios since we're using the vgabios packaged one
1939 - rm "${ED}/usr/share/qemu/vgabios.bin"
1940 - rm "${ED}/usr/share/qemu/vgabios-cirrus.bin"
1941 - rm "${ED}/usr/share/qemu/vgabios-qxl.bin"
1942 - rm "${ED}/usr/share/qemu/vgabios-stdvga.bin"
1943 - rm "${ED}/usr/share/qemu/vgabios-vmware.bin"
1944 - if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
1945 - dosym ../vgabios/vgabios.bin /usr/share/qemu/vgabios.bin
1946 - dosym ../vgabios/vgabios-cirrus.bin /usr/share/qemu/vgabios-cirrus.bin
1947 - dosym ../vgabios/vgabios-qxl.bin /usr/share/qemu/vgabios-qxl.bin
1948 - dosym ../vgabios/vgabios-stdvga.bin /usr/share/qemu/vgabios-stdvga.bin
1949 - dosym ../vgabios/vgabios-vmware.bin /usr/share/qemu/vgabios-vmware.bin
1950 - fi
1951 -
1952 - # Remove sgabios since we're using the sgabios packaged one
1953 - rm "${ED}/usr/share/qemu/sgabios.bin"
1954 - if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
1955 - dosym ../sgabios/sgabios.bin /usr/share/qemu/sgabios.bin
1956 - fi
1957 -
1958 - # Remove iPXE since we're using the iPXE packaged one
1959 - rm "${ED}"/usr/share/qemu/pxe-*.rom
1960 - if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
1961 - dosym ../ipxe/8086100e.rom /usr/share/qemu/pxe-e1000.rom
1962 - dosym ../ipxe/80861209.rom /usr/share/qemu/pxe-eepro100.rom
1963 - dosym ../ipxe/10500940.rom /usr/share/qemu/pxe-ne2k_pci.rom
1964 - dosym ../ipxe/10222000.rom /usr/share/qemu/pxe-pcnet.rom
1965 - dosym ../ipxe/10ec8139.rom /usr/share/qemu/pxe-rtl8139.rom
1966 - dosym ../ipxe/1af41000.rom /usr/share/qemu/pxe-virtio.rom
1967 - fi
1968 - fi
1969 -
1970 - qemu_support_kvm && readme.gentoo_create_doc
1971 -}
1972 -
1973 -pkg_postinst() {
1974 - if qemu_support_kvm; then
1975 - readme.gentoo_print_elog
1976 - fi
1977 -
1978 - if [[ -n ${softmmu_targets} ]] && use kernel_linux; then
1979 - udev_reload
1980 - fi
1981 -
1982 - fcaps cap_net_admin /usr/libexec/qemu-bridge-helper
1983 -}
1984 -
1985 -pkg_info() {
1986 - echo "Using:"
1987 - echo " $(best_version app-emulation/spice-protocol)"
1988 - echo " $(best_version sys-firmware/ipxe)"
1989 - echo " $(best_version sys-firmware/seabios)"
1990 - if has_version 'sys-firmware/seabios[binary]'; then
1991 - echo " USE=binary"
1992 - else
1993 - echo " USE=''"
1994 - fi
1995 - echo " $(best_version sys-firmware/vgabios)"
1996 -}
1997
1998 diff --git a/app-emulation/qemu/qemu-2.7.1.ebuild b/app-emulation/qemu/qemu-2.7.1.ebuild
1999 deleted file mode 100644
2000 index ce6d3090c5..0000000000
2001 --- a/app-emulation/qemu/qemu-2.7.1.ebuild
2002 +++ /dev/null
2003 @@ -1,699 +0,0 @@
2004 -# Copyright 1999-2016 Gentoo Foundation
2005 -# Distributed under the terms of the GNU General Public License v2
2006 -
2007 -EAPI="5"
2008 -
2009 -PYTHON_COMPAT=( python2_7 )
2010 -PYTHON_REQ_USE="ncurses,readline"
2011 -
2012 -PLOCALES="bg de_DE fr_FR hu it tr zh_CN"
2013 -
2014 -inherit eutils flag-o-matic linux-info toolchain-funcs multilib python-r1 \
2015 - user udev fcaps readme.gentoo-r1 pax-utils l10n
2016 -
2017 -if [[ ${PV} = *9999* ]]; then
2018 - EGIT_REPO_URI="git://git.qemu.org/qemu.git"
2019 - inherit git-2
2020 - SRC_URI=""
2021 -else
2022 - SRC_URI="http://wiki.qemu-project.org/download/${P}.tar.bz2"
2023 - KEYWORDS="~amd64 ~arm64 ~ppc ~ppc64 ~x86 ~x86-fbsd"
2024 -fi
2025 -
2026 -DESCRIPTION="QEMU + Kernel-based Virtual Machine userland tools"
2027 -HOMEPAGE="http://www.qemu.org http://www.linux-kvm.org"
2028 -
2029 -LICENSE="GPL-2 LGPL-2 BSD-2"
2030 -SLOT="0"
2031 -IUSE="accessibility +aio alsa bluetooth bzip2 +caps +curl debug +fdt glusterfs \
2032 -gnutls gtk gtk2 infiniband iscsi +jpeg \
2033 -kernel_linux kernel_FreeBSD lzo ncurses nfs nls numa opengl +pin-upstream-blobs
2034 -+png pulseaudio python \
2035 -rbd sasl +seccomp sdl sdl2 selinux smartcard snappy spice ssh static static-softmmu
2036 -static-user systemtap tci test +threads usb usbredir +uuid vde +vhost-net \
2037 -virgl virtfs +vnc vte xattr xen xfs"
2038 -
2039 -COMMON_TARGETS="aarch64 alpha arm cris i386 m68k microblaze microblazeel mips
2040 -mips64 mips64el mipsel or32 ppc ppc64 s390x sh4 sh4eb sparc sparc64 unicore32
2041 -x86_64"
2042 -IUSE_SOFTMMU_TARGETS="${COMMON_TARGETS} lm32 moxie ppcemb tricore xtensa xtensaeb"
2043 -IUSE_USER_TARGETS="${COMMON_TARGETS} armeb mipsn32 mipsn32el ppc64abi32 ppc64le sparc32plus tilegx"
2044 -
2045 -use_softmmu_targets=$(printf ' qemu_softmmu_targets_%s' ${IUSE_SOFTMMU_TARGETS})
2046 -use_user_targets=$(printf ' qemu_user_targets_%s' ${IUSE_USER_TARGETS})
2047 -IUSE+=" ${use_softmmu_targets} ${use_user_targets}"
2048 -
2049 -# Allow no targets to be built so that people can get a tools-only build.
2050 -# Block USE flag configurations known to not work.
2051 -REQUIRED_USE="${PYTHON_REQUIRED_USE}
2052 - gtk2? ( gtk )
2053 - qemu_softmmu_targets_arm? ( fdt )
2054 - qemu_softmmu_targets_microblaze? ( fdt )
2055 - qemu_softmmu_targets_ppc? ( fdt )
2056 - qemu_softmmu_targets_ppc64? ( fdt )
2057 - sdl2? ( sdl )
2058 - static? ( static-softmmu static-user )
2059 - static-softmmu? ( !alsa !pulseaudio !bluetooth !opengl !gtk !gtk2 )
2060 - virtfs? ( xattr )
2061 - vte? ( gtk )"
2062 -
2063 -# Yep, you need both libcap and libcap-ng since virtfs only uses libcap.
2064 -#
2065 -# The attr lib isn't always linked in (although the USE flag is always
2066 -# respected). This is because qemu supports using the C library's API
2067 -# when available rather than always using the extranl library.
2068 -#
2069 -# Older versions of gnutls are supported, but it's simpler to just require
2070 -# the latest versions. This is also why we require nettle.
2071 -#
2072 -# TODO: Split out tools deps into another var. e.g. bzip2 is only used by
2073 -# system binaries and tools, not user binaries.
2074 -COMMON_LIB_DEPEND=">=dev-libs/glib-2.0[static-libs(+)]
2075 - sys-libs/zlib[static-libs(+)]
2076 - bzip2? ( app-arch/bzip2[static-libs(+)] )
2077 - xattr? ( sys-apps/attr[static-libs(+)] )"
2078 -SOFTMMU_LIB_DEPEND="${COMMON_LIB_DEPEND}
2079 - >=x11-libs/pixman-0.28.0[static-libs(+)]
2080 - accessibility? ( app-accessibility/brltty[static-libs(+)] )
2081 - aio? ( dev-libs/libaio[static-libs(+)] )
2082 - alsa? ( >=media-libs/alsa-lib-1.0.13 )
2083 - bluetooth? ( net-wireless/bluez )
2084 - caps? ( sys-libs/libcap-ng[static-libs(+)] )
2085 - curl? ( >=net-misc/curl-7.15.4[static-libs(+)] )
2086 - fdt? ( >=sys-apps/dtc-1.4.0[static-libs(+)] )
2087 - glusterfs? ( >=sys-cluster/glusterfs-3.4.0[static-libs(+)] )
2088 - gnutls? (
2089 - dev-libs/nettle:=[static-libs(+)]
2090 - >=net-libs/gnutls-3.0:=[static-libs(+)]
2091 - )
2092 - gtk? (
2093 - gtk2? (
2094 - x11-libs/gtk+:2
2095 - vte? ( x11-libs/vte:0 )
2096 - )
2097 - !gtk2? (
2098 - x11-libs/gtk+:3
2099 - vte? ( x11-libs/vte:2.91 )
2100 - )
2101 - )
2102 - infiniband? ( sys-fabric/librdmacm:=[static-libs(+)] )
2103 - iscsi? ( net-libs/libiscsi )
2104 - jpeg? ( virtual/jpeg:0=[static-libs(+)] )
2105 - lzo? ( dev-libs/lzo:2[static-libs(+)] )
2106 - ncurses? ( sys-libs/ncurses:0=[static-libs(+)] )
2107 - nfs? ( >=net-fs/libnfs-1.9.3[static-libs(+)] )
2108 - numa? ( sys-process/numactl[static-libs(+)] )
2109 - opengl? (
2110 - virtual/opengl
2111 - media-libs/libepoxy[static-libs(+)]
2112 - media-libs/mesa[static-libs(+)]
2113 - media-libs/mesa[egl,gbm]
2114 - )
2115 - png? ( media-libs/libpng:0=[static-libs(+)] )
2116 - pulseaudio? ( media-sound/pulseaudio )
2117 - rbd? ( sys-cluster/ceph[static-libs(+)] )
2118 - sasl? ( dev-libs/cyrus-sasl[static-libs(+)] )
2119 - sdl? (
2120 - !sdl2? (
2121 - media-libs/libsdl[X]
2122 - >=media-libs/libsdl-1.2.11[static-libs(+)]
2123 - )
2124 - sdl2? (
2125 - media-libs/libsdl2[X]
2126 - media-libs/libsdl2[static-libs(+)]
2127 - )
2128 - )
2129 - seccomp? ( >=sys-libs/libseccomp-2.1.0[static-libs(+)] )
2130 - smartcard? ( >=app-emulation/libcacard-2.5.0[static-libs(+)] )
2131 - snappy? ( app-arch/snappy[static-libs(+)] )
2132 - spice? (
2133 - >=app-emulation/spice-protocol-0.12.3
2134 - >=app-emulation/spice-0.12.0[static-libs(+)]
2135 - )
2136 - ssh? ( >=net-libs/libssh2-1.2.8[static-libs(+)] )
2137 - usb? ( >=virtual/libusb-1-r2[static-libs(+)] )
2138 - usbredir? ( >=sys-apps/usbredir-0.6[static-libs(+)] )
2139 - uuid? ( >=sys-apps/util-linux-2.16.0[static-libs(+)] )
2140 - vde? ( net-misc/vde[static-libs(+)] )
2141 - virgl? ( media-libs/virglrenderer[static-libs(+)] )
2142 - virtfs? ( sys-libs/libcap )
2143 - xfs? ( sys-fs/xfsprogs[static-libs(+)] )"
2144 -USER_LIB_DEPEND="${COMMON_LIB_DEPEND}"
2145 -X86_FIRMWARE_DEPEND="
2146 - >=sys-firmware/ipxe-1.0.0_p20130624
2147 - pin-upstream-blobs? (
2148 - ~sys-firmware/seabios-1.8.2
2149 - ~sys-firmware/sgabios-0.1_pre8
2150 - ~sys-firmware/vgabios-0.7a
2151 - )
2152 - !pin-upstream-blobs? (
2153 - sys-firmware/seabios
2154 - sys-firmware/sgabios
2155 - sys-firmware/vgabios
2156 - )"
2157 -CDEPEND="
2158 - !static-softmmu? ( $(printf "%s? ( ${SOFTMMU_LIB_DEPEND//\[static-libs(+)]} ) " ${use_softmmu_targets}) )
2159 - !static-user? ( $(printf "%s? ( ${USER_LIB_DEPEND//\[static-libs(+)]} ) " ${use_user_targets}) )
2160 - qemu_softmmu_targets_i386? ( ${X86_FIRMWARE_DEPEND} )
2161 - qemu_softmmu_targets_x86_64? ( ${X86_FIRMWARE_DEPEND} )
2162 - python? ( ${PYTHON_DEPS} )
2163 - systemtap? ( dev-util/systemtap )
2164 - xen? ( app-emulation/xen-tools:= )"
2165 -DEPEND="${CDEPEND}
2166 - dev-lang/perl
2167 - =dev-lang/python-2*
2168 - sys-apps/texinfo
2169 - virtual/pkgconfig
2170 - kernel_linux? ( >=sys-kernel/linux-headers-2.6.35 )
2171 - gtk? ( nls? ( sys-devel/gettext ) )
2172 - static-softmmu? ( $(printf "%s? ( ${SOFTMMU_LIB_DEPEND} ) " ${use_softmmu_targets}) )
2173 - static-user? ( $(printf "%s? ( ${USER_LIB_DEPEND} ) " ${use_user_targets}) )
2174 - test? (
2175 - dev-libs/glib[utils]
2176 - sys-devel/bc
2177 - )"
2178 -RDEPEND="${CDEPEND}
2179 - selinux? ( sec-policy/selinux-qemu )
2180 -"
2181 -
2182 -STRIP_MASK="/usr/share/qemu/palcode-clipper"
2183 -
2184 -QA_PREBUILT="
2185 - usr/share/qemu/openbios-ppc
2186 - usr/share/qemu/openbios-sparc64
2187 - usr/share/qemu/openbios-sparc32
2188 - usr/share/qemu/palcode-clipper
2189 - usr/share/qemu/s390-ccw.img
2190 - usr/share/qemu/u-boot.e500
2191 -"
2192 -
2193 -QA_WX_LOAD="usr/bin/qemu-i386
2194 - usr/bin/qemu-x86_64
2195 - usr/bin/qemu-alpha
2196 - usr/bin/qemu-arm
2197 - usr/bin/qemu-cris
2198 - usr/bin/qemu-m68k
2199 - usr/bin/qemu-microblaze
2200 - usr/bin/qemu-microblazeel
2201 - usr/bin/qemu-mips
2202 - usr/bin/qemu-mipsel
2203 - usr/bin/qemu-or32
2204 - usr/bin/qemu-ppc
2205 - usr/bin/qemu-ppc64
2206 - usr/bin/qemu-ppc64abi32
2207 - usr/bin/qemu-sh4
2208 - usr/bin/qemu-sh4eb
2209 - usr/bin/qemu-sparc
2210 - usr/bin/qemu-sparc64
2211 - usr/bin/qemu-armeb
2212 - usr/bin/qemu-sparc32plus
2213 - usr/bin/qemu-s390x
2214 - usr/bin/qemu-unicore32"
2215 -
2216 -DOC_CONTENTS="If you don't have kvm compiled into the kernel, make sure
2217 -you have the kernel module loaded before running kvm. The easiest way to
2218 -ensure that the kernel module is loaded is to load it on boot.\n
2219 -For AMD CPUs the module is called 'kvm-amd'.\n
2220 -For Intel CPUs the module is called 'kvm-intel'.\n
2221 -Please review /etc/conf.d/modules for how to load these.\n\n
2222 -Make sure your user is in the 'kvm' group\n
2223 -Just run 'gpasswd -a <USER> kvm', then have <USER> re-login.\n\n
2224 -For brand new installs, the default permissions on /dev/kvm might not let you
2225 -access it. You can tell udev to reset ownership/perms:\n
2226 -udevadm trigger -c add /dev/kvm"
2227 -
2228 -qemu_support_kvm() {
2229 - if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386 \
2230 - use qemu_softmmu_targets_ppc || use qemu_softmmu_targets_ppc64 \
2231 - use qemu_softmmu_targets_s390x; then
2232 - return 0
2233 - fi
2234 -
2235 - return 1
2236 -}
2237 -
2238 -pkg_pretend() {
2239 - if use kernel_linux && kernel_is lt 2 6 25; then
2240 - eerror "This version of KVM requres a host kernel of 2.6.25 or higher."
2241 - elif use kernel_linux; then
2242 - if ! linux_config_exists; then
2243 - eerror "Unable to check your kernel for KVM support"
2244 - else
2245 - CONFIG_CHECK="~KVM ~TUN ~BRIDGE"
2246 - ERROR_KVM="You must enable KVM in your kernel to continue"
2247 - ERROR_KVM_AMD="If you have an AMD CPU, you must enable KVM_AMD in"
2248 - ERROR_KVM_AMD+=" your kernel configuration."
2249 - ERROR_KVM_INTEL="If you have an Intel CPU, you must enable"
2250 - ERROR_KVM_INTEL+=" KVM_INTEL in your kernel configuration."
2251 - ERROR_TUN="You will need the Universal TUN/TAP driver compiled"
2252 - ERROR_TUN+=" into your kernel or loaded as a module to use the"
2253 - ERROR_TUN+=" virtual network device if using -net tap."
2254 - ERROR_BRIDGE="You will also need support for 802.1d"
2255 - ERROR_BRIDGE+=" Ethernet Bridging for some network configurations."
2256 - use vhost-net && CONFIG_CHECK+=" ~VHOST_NET"
2257 - ERROR_VHOST_NET="You must enable VHOST_NET to have vhost-net"
2258 - ERROR_VHOST_NET+=" support"
2259 -
2260 - if use amd64 || use x86 || use amd64-linux || use x86-linux; then
2261 - CONFIG_CHECK+=" ~KVM_AMD ~KVM_INTEL"
2262 - fi
2263 -
2264 - use python && CONFIG_CHECK+=" ~DEBUG_FS"
2265 - ERROR_DEBUG_FS="debugFS support required for kvm_stat"
2266 -
2267 - # Now do the actual checks setup above
2268 - check_extra_config
2269 - fi
2270 - fi
2271 -
2272 - if grep -qs '/usr/bin/qemu-kvm' "${EROOT}"/etc/libvirt/qemu/*.xml; then
2273 - eerror "The kvm/qemu-kvm wrappers no longer exist, but your libvirt"
2274 - eerror "instances are still pointing to it. Please update your"
2275 - eerror "configs in /etc/libvirt/qemu/ to use the -enable-kvm flag"
2276 - eerror "and the right system binary (e.g. qemu-system-x86_64)."
2277 - die "update your virt configs to not use qemu-kvm"
2278 - fi
2279 -}
2280 -
2281 -pkg_setup() {
2282 - enewgroup kvm 78
2283 -}
2284 -
2285 -# Sanity check to make sure target lists are kept up-to-date.
2286 -check_targets() {
2287 - local var=$1 mak=$2
2288 - local detected sorted
2289 -
2290 - pushd "${S}"/default-configs >/dev/null || die
2291 -
2292 - # Force C locale until glibc is updated. #564936
2293 - detected=$(echo $(printf '%s\n' *-${mak}.mak | sed "s:-${mak}.mak::" | LC_COLLATE=C sort -u))
2294 - sorted=$(echo $(printf '%s\n' ${!var} | LC_COLLATE=C sort -u))
2295 - if [[ ${sorted} != "${detected}" ]] ; then
2296 - eerror "The ebuild needs to be kept in sync."
2297 - eerror "${var}: ${sorted}"
2298 - eerror "$(printf '%-*s' ${#var} configure): ${detected}"
2299 - die "sync ${var} to the list of targets"
2300 - fi
2301 -
2302 - popd >/dev/null
2303 -}
2304 -
2305 -handle_locales() {
2306 - # Make sure locale list is kept up-to-date.
2307 - local detected sorted
2308 - detected=$(echo $(cd po && printf '%s\n' *.po | grep -v messages.po | sed 's:.po$::' | sort -u))
2309 - sorted=$(echo $(printf '%s\n' ${PLOCALES} | sort -u))
2310 - if [[ ${sorted} != "${detected}" ]] ; then
2311 - eerror "The ebuild needs to be kept in sync."
2312 - eerror "PLOCALES: ${sorted}"
2313 - eerror " po/*.po: ${detected}"
2314 - die "sync PLOCALES"
2315 - fi
2316 -
2317 - # Deal with selective install of locales.
2318 - if use nls ; then
2319 - # Delete locales the user does not want. #577814
2320 - rm_loc() { rm po/$1.po || die; }
2321 - l10n_for_each_disabled_locale_do rm_loc
2322 - else
2323 - # Cheap hack to disable gettext .mo generation.
2324 - rm -f po/*.po
2325 - fi
2326 -}
2327 -
2328 -src_prepare() {
2329 - check_targets IUSE_SOFTMMU_TARGETS softmmu
2330 - check_targets IUSE_USER_TARGETS linux-user
2331 -
2332 - # Alter target makefiles to accept CFLAGS set via flag-o
2333 - sed -i -r \
2334 - -e 's/^(C|OP_C|HELPER_C)FLAGS=/\1FLAGS+=/' \
2335 - Makefile Makefile.target || die
2336 -
2337 - epatch "${FILESDIR}"/${PN}-2.5.0-cflags.patch
2338 - epatch "${FILESDIR}"/${PN}-2.5.0-sysmacros.patch
2339 - epatch "${FILESDIR}"/${PN}-2.7.0-CVE-2016-6836.patch #591242
2340 - epatch "${FILESDIR}"/${PN}-2.7.0-CVE-2016-7156.patch #593036
2341 - epatch "${FILESDIR}"/${PN}-2.7.0-CVE-2016-7170.patch #593284
2342 - epatch "${FILESDIR}"/${PN}-2.7.0-CVE-2016-7422.patch #593956
2343 - epatch "${FILESDIR}"/${PN}-2.7.0-CVE-2016-7466.patch #594520
2344 - epatch "${FILESDIR}"/${PN}-2.7.0-CVE-2016-7907.patch #596048
2345 - epatch "${FILESDIR}"/${PN}-2.7.0-CVE-2016-7908.patch #596049
2346 - epatch "${FILESDIR}"/${PN}-2.7.0-CVE-2016-7909.patch #596048
2347 - epatch "${FILESDIR}"/${PN}-2.7.0-CVE-2016-7994-1.patch #596738
2348 - epatch "${FILESDIR}"/${PN}-2.7.0-CVE-2016-7994-2.patch #596738
2349 - epatch "${FILESDIR}"/${PN}-2.7.0-CVE-2016-8576.patch #596752
2350 - epatch "${FILESDIR}"/${PN}-2.7.0-CVE-2016-8577.patch #596776
2351 - epatch "${FILESDIR}"/${PN}-2.7.0-CVE-2016-8578.patch #596774
2352 - epatch "${FILESDIR}"/${PN}-2.7.0-CVE-2016-8668.patch #597110
2353 - epatch "${FILESDIR}"/${PN}-2.7.0-CVE-2016-8669-1.patch #597108
2354 - epatch "${FILESDIR}"/${PN}-2.7.0-CVE-2016-8669-2.patch #597108
2355 - epatch "${FILESDIR}"/${PN}-2.7.0-CVE-2016-8909.patch #598044
2356 - epatch "${FILESDIR}"/${PN}-2.7.0-CVE-2016-9102.patch #598328
2357 - epatch "${FILESDIR}"/${PN}-2.7.0-CVE-2016-9103.patch #598328
2358 - epatch "${FILESDIR}"/${PN}-2.7.0-CVE-2016-9104.patch #598328
2359 - epatch "${FILESDIR}"/${PN}-2.7.0-CVE-2016-9105.patch #598328
2360 - epatch "${FILESDIR}"/${PN}-2.7.0-CVE-2016-9106.patch #598772
2361 -
2362 - # Fix ld and objcopy being called directly
2363 - tc-export AR LD OBJCOPY
2364 -
2365 - # Verbose builds
2366 - MAKEOPTS+=" V=1"
2367 -
2368 - epatch_user
2369 -
2370 - # Run after we've applied all patches.
2371 - handle_locales
2372 -}
2373 -
2374 -##
2375 -# configures qemu based on the build directory and the build type
2376 -# we are using.
2377 -#
2378 -qemu_src_configure() {
2379 - debug-print-function ${FUNCNAME} "$@"
2380 -
2381 - local buildtype=$1
2382 - local builddir="${S}/${buildtype}-build"
2383 - local static_flag="static-${buildtype}"
2384 -
2385 - mkdir "${builddir}"
2386 -
2387 - local conf_opts=(
2388 - --prefix=/usr
2389 - --sysconfdir=/etc
2390 - --libdir=/usr/$(get_libdir)
2391 - --docdir=/usr/share/doc/${PF}/html
2392 - --disable-bsd-user
2393 - --disable-guest-agent
2394 - --disable-strip
2395 - --disable-werror
2396 - # We support gnutls/nettle for crypto operations. It is possible
2397 - # to use gcrypt when gnutls/nettle are disabled (but not when they
2398 - # are enabled), but it's not really worth the hassle. Disable it
2399 - # all the time to avoid automatically detecting it. #568856
2400 - --disable-gcrypt
2401 - --python="${PYTHON}"
2402 - --cc="$(tc-getCC)"
2403 - --cxx="$(tc-getCXX)"
2404 - --host-cc="$(tc-getBUILD_CC)"
2405 - $(use_enable debug debug-info)
2406 - $(use_enable debug debug-tcg)
2407 - --enable-docs
2408 - $(use_enable tci tcg-interpreter)
2409 - $(use_enable xattr attr)
2410 - )
2411 -
2412 - # Disable options not used by user targets as the default configure
2413 - # options will autoprobe and try to link in a bunch of unused junk.
2414 - conf_softmmu() {
2415 - if [[ ${buildtype} == "user" ]] ; then
2416 - echo "--disable-${2:-$1}"
2417 - else
2418 - use_enable "$@"
2419 - fi
2420 - }
2421 - conf_opts+=(
2422 - $(conf_softmmu accessibility brlapi)
2423 - $(conf_softmmu aio linux-aio)
2424 - $(conf_softmmu bzip2)
2425 - $(conf_softmmu bluetooth bluez)
2426 - $(conf_softmmu caps cap-ng)
2427 - $(conf_softmmu curl)
2428 - $(conf_softmmu fdt)
2429 - $(conf_softmmu glusterfs)
2430 - $(conf_softmmu gnutls)
2431 - $(conf_softmmu gnutls nettle)
2432 - $(conf_softmmu gtk)
2433 - $(conf_softmmu infiniband rdma)
2434 - $(conf_softmmu iscsi libiscsi)
2435 - $(conf_softmmu jpeg vnc-jpeg)
2436 - $(conf_softmmu kernel_linux kvm)
2437 - $(conf_softmmu lzo)
2438 - $(conf_softmmu ncurses curses)
2439 - $(conf_softmmu nfs libnfs)
2440 - $(conf_softmmu numa)
2441 - $(conf_softmmu opengl)
2442 - $(conf_softmmu png vnc-png)
2443 - $(conf_softmmu rbd)
2444 - $(conf_softmmu sasl vnc-sasl)
2445 - $(conf_softmmu sdl)
2446 - $(conf_softmmu seccomp)
2447 - $(conf_softmmu smartcard)
2448 - $(conf_softmmu snappy)
2449 - $(conf_softmmu spice)
2450 - $(conf_softmmu ssh libssh2)
2451 - $(conf_softmmu usb libusb)
2452 - $(conf_softmmu usbredir usb-redir)
2453 - $(conf_softmmu uuid)
2454 - $(conf_softmmu vde)
2455 - $(conf_softmmu vhost-net)
2456 - $(conf_softmmu virgl virglrenderer)
2457 - $(conf_softmmu virtfs)
2458 - $(conf_softmmu vnc)
2459 - $(conf_softmmu vte)
2460 - $(conf_softmmu xen)
2461 - $(conf_softmmu xen xen-pci-passthrough)
2462 - $(conf_softmmu xfs xfsctl)
2463 - )
2464 -
2465 - case ${buildtype} in
2466 - user)
2467 - conf_opts+=(
2468 - --enable-linux-user
2469 - --disable-system
2470 - --disable-blobs
2471 - --disable-tools
2472 - )
2473 - ;;
2474 - softmmu)
2475 - # audio options
2476 - local audio_opts="oss"
2477 - use alsa && audio_opts="alsa,${audio_opts}"
2478 - use sdl && audio_opts="sdl,${audio_opts}"
2479 - use pulseaudio && audio_opts="pa,${audio_opts}"
2480 -
2481 - conf_opts+=(
2482 - --disable-linux-user
2483 - --enable-system
2484 - --with-system-pixman
2485 - --audio-drv-list="${audio_opts}"
2486 - )
2487 - use gtk && conf_opts+=( --with-gtkabi=$(usex gtk2 2.0 3.0) )
2488 - use sdl && conf_opts+=( --with-sdlabi=$(usex sdl2 2.0 1.2) )
2489 - ;;
2490 - tools)
2491 - conf_opts+=(
2492 - --disable-linux-user
2493 - --disable-system
2494 - --disable-blobs
2495 - $(use_enable bzip2)
2496 - )
2497 - static_flag="static"
2498 - ;;
2499 - esac
2500 -
2501 - local targets="${buildtype}_targets"
2502 - [[ -n ${targets} ]] && conf_opts+=( --target-list="${!targets}" )
2503 -
2504 - # Add support for SystemTAP
2505 - use systemtap && conf_opts+=( --enable-trace-backend=dtrace )
2506 -
2507 - # We always want to attempt to build with PIE support as it results
2508 - # in a more secure binary. But it doesn't work with static or if
2509 - # the current GCC doesn't have PIE support.
2510 - if use ${static_flag}; then
2511 - conf_opts+=( --static --disable-pie )
2512 - else
2513 - gcc-specs-pie && conf_opts+=( --enable-pie )
2514 - fi
2515 -
2516 - echo "../configure ${conf_opts[*]}"
2517 - cd "${builddir}"
2518 - ../configure "${conf_opts[@]}" || die "configure failed"
2519 -
2520 - # FreeBSD's kernel does not support QEMU assigning/grabbing
2521 - # host USB devices yet
2522 - use kernel_FreeBSD && \
2523 - sed -i -E -e "s|^(HOST_USB=)bsd|\1stub|" "${S}"/config-host.mak
2524 -}
2525 -
2526 -src_configure() {
2527 - local target
2528 -
2529 - python_setup
2530 -
2531 - softmmu_targets= softmmu_bins=()
2532 - user_targets= user_bins=()
2533 -
2534 - for target in ${IUSE_SOFTMMU_TARGETS} ; do
2535 - if use "qemu_softmmu_targets_${target}"; then
2536 - softmmu_targets+=",${target}-softmmu"
2537 - softmmu_bins+=( "qemu-system-${target}" )
2538 - fi
2539 - done
2540 -
2541 - for target in ${IUSE_USER_TARGETS} ; do
2542 - if use "qemu_user_targets_${target}"; then
2543 - user_targets+=",${target}-linux-user"
2544 - user_bins+=( "qemu-${target}" )
2545 - fi
2546 - done
2547 -
2548 - softmmu_targets=${softmmu_targets#,}
2549 - user_targets=${user_targets#,}
2550 -
2551 - [[ -n ${softmmu_targets} ]] && qemu_src_configure "softmmu"
2552 - [[ -n ${user_targets} ]] && qemu_src_configure "user"
2553 - [[ -z ${softmmu_targets}${user_targets} ]] && qemu_src_configure "tools"
2554 -}
2555 -
2556 -src_compile() {
2557 - if [[ -n ${user_targets} ]]; then
2558 - cd "${S}/user-build"
2559 - default
2560 - fi
2561 -
2562 - if [[ -n ${softmmu_targets} ]]; then
2563 - cd "${S}/softmmu-build"
2564 - default
2565 - fi
2566 -
2567 - if [[ -z ${softmmu_targets}${user_targets} ]]; then
2568 - cd "${S}/tools-build"
2569 - default
2570 - fi
2571 -}
2572 -
2573 -src_test() {
2574 - if [[ -n ${softmmu_targets} ]]; then
2575 - cd "${S}/softmmu-build"
2576 - pax-mark m */qemu-system-* #515550
2577 - emake -j1 check
2578 - emake -j1 check-report.html
2579 - fi
2580 -}
2581 -
2582 -qemu_python_install() {
2583 - python_domodule "${S}/scripts/qmp/qmp.py"
2584 -
2585 - python_doscript "${S}/scripts/kvm/vmxcap"
2586 - python_doscript "${S}/scripts/qmp/qmp-shell"
2587 - python_doscript "${S}/scripts/qmp/qemu-ga-client"
2588 -}
2589 -
2590 -src_install() {
2591 - if [[ -n ${user_targets} ]]; then
2592 - cd "${S}/user-build"
2593 - emake DESTDIR="${ED}" install
2594 -
2595 - # Install binfmt handler init script for user targets
2596 - newinitd "${FILESDIR}/qemu-binfmt.initd-r1" qemu-binfmt
2597 - fi
2598 -
2599 - if [[ -n ${softmmu_targets} ]]; then
2600 - cd "${S}/softmmu-build"
2601 - emake DESTDIR="${ED}" install
2602 -
2603 - # This might not exist if the test failed. #512010
2604 - [[ -e check-report.html ]] && dohtml check-report.html
2605 -
2606 - if use kernel_linux; then
2607 - udev_dorules "${FILESDIR}"/65-kvm.rules
2608 - fi
2609 -
2610 - if use python; then
2611 - python_foreach_impl qemu_python_install
2612 - fi
2613 - fi
2614 -
2615 - if [[ -z ${softmmu_targets}${user_targets} ]]; then
2616 - cd "${S}/tools-build"
2617 - emake DESTDIR="${ED}" install
2618 - fi
2619 -
2620 - # Disable mprotect on the qemu binaries as they use JITs to be fast #459348
2621 - pushd "${ED}"/usr/bin >/dev/null
2622 - pax-mark m "${softmmu_bins[@]}" "${user_bins[@]}"
2623 - popd >/dev/null
2624 -
2625 - # Install config file example for qemu-bridge-helper
2626 - insinto "/etc/qemu"
2627 - doins "${FILESDIR}/bridge.conf"
2628 -
2629 - # Remove the docdir placed qmp-commands.txt
2630 - mv "${ED}/usr/share/doc/${PF}/html/qmp-commands.txt" "${S}/docs/" || die
2631 -
2632 - cd "${S}"
2633 - dodoc Changelog MAINTAINERS docs/specs/pci-ids.txt
2634 - newdoc pc-bios/README README.pc-bios
2635 - dodoc docs/qmp-*.txt
2636 -
2637 - if [[ -n ${softmmu_targets} ]]; then
2638 - # Remove SeaBIOS since we're using the SeaBIOS packaged one
2639 - rm "${ED}/usr/share/qemu/bios.bin"
2640 - if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
2641 - dosym ../seabios/bios.bin /usr/share/qemu/bios.bin
2642 - fi
2643 -
2644 - # Remove vgabios since we're using the vgabios packaged one
2645 - rm "${ED}/usr/share/qemu/vgabios.bin"
2646 - rm "${ED}/usr/share/qemu/vgabios-cirrus.bin"
2647 - rm "${ED}/usr/share/qemu/vgabios-qxl.bin"
2648 - rm "${ED}/usr/share/qemu/vgabios-stdvga.bin"
2649 - rm "${ED}/usr/share/qemu/vgabios-vmware.bin"
2650 - if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
2651 - dosym ../vgabios/vgabios.bin /usr/share/qemu/vgabios.bin
2652 - dosym ../vgabios/vgabios-cirrus.bin /usr/share/qemu/vgabios-cirrus.bin
2653 - dosym ../vgabios/vgabios-qxl.bin /usr/share/qemu/vgabios-qxl.bin
2654 - dosym ../vgabios/vgabios-stdvga.bin /usr/share/qemu/vgabios-stdvga.bin
2655 - dosym ../vgabios/vgabios-vmware.bin /usr/share/qemu/vgabios-vmware.bin
2656 - fi
2657 -
2658 - # Remove sgabios since we're using the sgabios packaged one
2659 - rm "${ED}/usr/share/qemu/sgabios.bin"
2660 - if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
2661 - dosym ../sgabios/sgabios.bin /usr/share/qemu/sgabios.bin
2662 - fi
2663 -
2664 - # Remove iPXE since we're using the iPXE packaged one
2665 - rm "${ED}"/usr/share/qemu/pxe-*.rom
2666 - if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
2667 - dosym ../ipxe/8086100e.rom /usr/share/qemu/pxe-e1000.rom
2668 - dosym ../ipxe/80861209.rom /usr/share/qemu/pxe-eepro100.rom
2669 - dosym ../ipxe/10500940.rom /usr/share/qemu/pxe-ne2k_pci.rom
2670 - dosym ../ipxe/10222000.rom /usr/share/qemu/pxe-pcnet.rom
2671 - dosym ../ipxe/10ec8139.rom /usr/share/qemu/pxe-rtl8139.rom
2672 - dosym ../ipxe/1af41000.rom /usr/share/qemu/pxe-virtio.rom
2673 - fi
2674 - fi
2675 -
2676 - qemu_support_kvm && readme.gentoo_create_doc
2677 -}
2678 -
2679 -pkg_postinst() {
2680 - if qemu_support_kvm; then
2681 - readme.gentoo_print_elog
2682 - fi
2683 -
2684 - if [[ -n ${softmmu_targets} ]] && use kernel_linux; then
2685 - udev_reload
2686 - fi
2687 -
2688 - fcaps cap_net_admin /usr/libexec/qemu-bridge-helper
2689 -}
2690 -
2691 -pkg_info() {
2692 - echo "Using:"
2693 - echo " $(best_version app-emulation/spice-protocol)"
2694 - echo " $(best_version sys-firmware/ipxe)"
2695 - echo " $(best_version sys-firmware/seabios)"
2696 - if has_version 'sys-firmware/seabios[binary]'; then
2697 - echo " USE=binary"
2698 - else
2699 - echo " USE=''"
2700 - fi
2701 - echo " $(best_version sys-firmware/vgabios)"
2702 -}