Gentoo Archives: gentoo-musl

From: Felix Janda <felix.janda@××××××.de>
To: gentoo-musl@l.g.o
Subject: [gentoo-musl] [PATCH 1/2] app-emulation/qemu: bump to 2.5.0
Date: Fri, 29 Jan 2016 19:43:44
Message-Id: 20160129193203.GA23297@nyan
1 ---
2 app-emulation/qemu/Manifest | 13 +-
3 .../qemu/files/qemu-2.2.1-CVE-2015-1779-1.patch | 241 ------------------
4 .../qemu/files/qemu-2.2.1-CVE-2015-1779-2.patch | 58 -----
5 .../qemu/files/qemu-2.3.0-CVE-2015-3456.patch | 86 -------
6 .../qemu/files/qemu-2.5.0-CVE-2015-8558.patch | 50 ++++
7 .../qemu/files/qemu-2.5.0-CVE-2015-8567.patch | 95 +++++++
8 .../qemu/files/qemu-2.5.0-CVE-2015-8701.patch | 49 ++++
9 .../qemu/files/qemu-2.5.0-CVE-2015-8743.patch | 50 ++++
10 .../qemu/files/qemu-2.5.0-CVE-2016-1568.patch | 41 +++
11 app-emulation/qemu/files/qemu-2.5.0-cflags.patch | 13 +
12 ...qemu-2.2.1-r99.ebuild => qemu-2.5.0-r99.ebuild} | 274 ++++++++++++---------
13 11 files changed, 469 insertions(+), 501 deletions(-)
14 delete mode 100644 app-emulation/qemu/files/qemu-2.2.1-CVE-2015-1779-1.patch
15 delete mode 100644 app-emulation/qemu/files/qemu-2.2.1-CVE-2015-1779-2.patch
16 delete mode 100644 app-emulation/qemu/files/qemu-2.3.0-CVE-2015-3456.patch
17 create mode 100644 app-emulation/qemu/files/qemu-2.5.0-CVE-2015-8558.patch
18 create mode 100644 app-emulation/qemu/files/qemu-2.5.0-CVE-2015-8567.patch
19 create mode 100644 app-emulation/qemu/files/qemu-2.5.0-CVE-2015-8701.patch
20 create mode 100644 app-emulation/qemu/files/qemu-2.5.0-CVE-2015-8743.patch
21 create mode 100644 app-emulation/qemu/files/qemu-2.5.0-CVE-2016-1568.patch
22 create mode 100644 app-emulation/qemu/files/qemu-2.5.0-cflags.patch
23 rename app-emulation/qemu/{qemu-2.2.1-r99.ebuild => qemu-2.5.0-r99.ebuild} (73%)
24
25 diff --git a/app-emulation/qemu/Manifest b/app-emulation/qemu/Manifest
26 index 2ecdb66..9fdb00d 100644
27 --- a/app-emulation/qemu/Manifest
28 +++ b/app-emulation/qemu/Manifest
29 @@ -4,11 +4,14 @@ AUX qemu-1.7.0-cflags.patch 300 SHA256 8f35e55c4bae93e82f9580eabe2d6a2d4660bd053
30 AUX qemu-2.0.0-F_SHLCK-and-F_EXLCK.patch 563 SHA256 99de67d610ad13a1dcf6c67a3c2b5b87fb909220173a956435737f9bea3c371b SHA512 a29e9a889388a6627ed492a79e66514ffb5e64f9479646982091811548fc2a9bf6682104a6c774d83e645e4b1db39e491afd4efce789fe164623442a7f3e5d00 WHIRLPOOL d3aab06099de263c22f4c71810a3b2cb8602d17731ec76674cd1415e539306555a7b96b789f0daad473600dfa04a83224ff603f7b9a9ac63a4902f74d0e9deb5
31 AUX qemu-2.0.0-linux-user-signal.c-define-__SIGRTMIN-MAX-for-non-GN.patch 930 SHA256 6af6cf9044997710a6d0fbdba30a35c8d775e30d30c032ec97db672f75ec88ac SHA512 ec84b27648c01c6e58781295dcd0c2ff8e5a635f9836ef50c1da5d0ed125db1afc4cb5b01cb97606d6dd8f417acba93e1560d9a32ca29161a4bb730b302440ea WHIRLPOOL 06b9dd5251ac03405c97b1f5a623b4d86bda2f72fbcd52b90ae4d11a0cfb59cae62df2cb6189405fbe53ab05ff2b7ca8165fda239dbfe5f31ed70abb53b3b9f3
32 AUX qemu-2.2.0-_sigev_un.patch 636 SHA256 f3b9a4d6162c553f3110ad22716305818e2130e2ff5d628faf044fc58a5e3cb5 SHA512 f72b879daede5184904f64cabb276de96299a37a93fce444d09e9068671009e95a5e5d6b815ec41a5db5b3807de14d470a56bba5806ffd4dfec577577b046ccb WHIRLPOOL 9453ad4966e10d504f3e867fd984642a3c1ee3ae847b5ca56196fd1f9e6c0f2d7b52ca07446212af72fef6d0ded1527a5eb306fa6cd915e8dd9ce11523362bac
33 -AUX qemu-2.2.1-CVE-2015-1779-1.patch 8631 SHA256 17ea04bb0571f3a346eb25ce2d61fd7053515767adedfde567fd39205993c600 SHA512 191dde0754b9466d87cf99a578ac07f0902f373156f4d5ff98540b9099a6fa8e29ba4ca9d4a5a21ae5dbba2b80c36600ea0bd2c31fa0c8734926514015166ab8 WHIRLPOOL 2be2f490eb32857b2b218761df3580bc31eb5a89bf1b289a048e9fd489cdb024869399481345b5ecb09a45c4fbf1ee4639062ae1fdbee9781e66ca6cc8af4cac
34 -AUX qemu-2.2.1-CVE-2015-1779-2.patch 2318 SHA256 4c0966520bf09df25d99c883f94037e765406dd4097dd704e66361bb07f73679 SHA512 7a85bc8e00c60c6c36790d1169f0d84d2c75fe81c1700b4f764ddcb0d0587d4b6d228d80e65fead035e3ab99449aad2f559071edf9145ff7a755506f3ff05b0e WHIRLPOOL 078388c50367d41c810a02aa795b6ad0df381582bdd2725ae125243ee5921aa4057494f063a7de49da6b6f6343f37a3c83d96ef6d92c22e722972c8e4ea968dc
35 -AUX qemu-2.3.0-CVE-2015-3456.patch 2853 SHA256 efac61bf9c20d5d08ef47bc9d51be5c8bd519f1d970ba3c3506c5760bf807e7d SHA512 5fed59ae67a962d187418f4bd57cebe901f9bcba817694b5e2a57daf77c34a406ed7c1f278e12d813304e58c48a24493b4e001a9ee4045bab2608f1730715ac7 WHIRLPOOL 9ad5237aa1bbe46a8493e331bb9c2152c36f9c877582485e1cf811b09430bad97a9f3b6bc52face7e4287f9c9fe4f1891de154a62ba93ea454c3ed9d44e8f729
36 +AUX qemu-2.5.0-CVE-2015-8558.patch 1459 SHA256 d769e6eb6dc0bdb0b982ef5fe7d73cc6bad47233102f53d11c6ed6c9051602d8 SHA512 42961191890c500675610d5d33e6ff468b07428c6b428ac01bb5c0e3ea88ff611a3532f848d54317458475fef221a06e41761ef14ea61d1b741db73450c4f90d WHIRLPOOL 475679dc1a24bc75012995a9a2122847454701b65ff0b7f8192865b45de49ce08572f129a7cfdeb36521252ed2f80c95e9dddbd64cb8e39fdc5beacc25934798
37 +AUX qemu-2.5.0-CVE-2015-8567.patch 3108 SHA256 88b72df4e02407c3b9ca4835c38988b97fcd5aa9c68da6fa47207fe675d4e661 SHA512 2f0243ec9764d72fe5e7a005a8db40d3d5c4c2edae5c3451087ee3f5c841c96a3112875cf88a19061fa2ce0d04715d247e6eb1eb83e1e5b57ec0b9eb324b8ce6 WHIRLPOOL b432ff3e105da5c0bd20dd1d7da0374f4005b2ac5a9a8c824e96730aeafa89bb8fc125f8b2857fdaf72024082ddbc0c7a28c3e3ffb9114c3d370db1b638c4731
38 +AUX qemu-2.5.0-CVE-2015-8701.patch 1671 SHA256 f39e0c6301cffa1b14c3ef0ab72fce0e2acd42170759ef7954234d31602aeb99 SHA512 d39edf84e2d17e6080bbc4a270732cd73b41fa39d948ee7bc4456e1024c5a69ddfb5e848af3272615f5aa36a3b6410a12f5a73e00ccfa58e0d60d7289d034aa9 WHIRLPOOL 352148c367837ba2d6eb5eb39e00c128f0cff3faef159754a41318857bc11a6616be184c24df4767ec2c8c14910ad74fc3be48273f6312b1687910fbcaf7bec3
39 +AUX qemu-2.5.0-CVE-2015-8743.patch 1777 SHA256 22aac571c1aa6f6a283d200a7703fdfea0a5bcaf227a003a2cbf5741bbb8df85 SHA512 65d8632fd43959983ca02f9ab116ec78ea043e6d867e6d743014885c2a423bb3b87c2e56caa37e7f29e971a44f5ea695cb4ce1c3a9c1fc2d734b25ca0b2f4054 WHIRLPOOL 9128c812cfbfe3d4629cd6c7c2c6f50c9ef2fe2d5b62b24486559279296987f593f852f913eb67fbe956d650d50612fa7a658a60b3d80cf4fa9256e332d77330
40 +AUX qemu-2.5.0-CVE-2016-1568.patch 1476 SHA256 ba2a25142977eea531159d81ef8938e8519c92800aa1958e71da9e2780c8256a SHA512 643ef742e6cd1dbc8f420b38f684bc8639e4bd58ab38c254654d4b1a72b129202fecdddddfd308b48ed7813da193edff68d737080d5035c82daf9676ee17df22 WHIRLPOOL af9376400540f20d77ea06cb6a12ce415b72bb22cdde3365bba8b02deb8985aedfee303646e13e1d1263a2dcd17bf1518637183a81c66c2db7b438aa88ef7d95
41 +AUX qemu-2.5.0-cflags.patch 410 SHA256 17f5624dd733f5c80e733cc67ae36a736169ec066024dbf802b416accfed0755 SHA512 0194d28de08b4e51c5bd1c9a2cc7965ba7f66dfddb8fd91de3da93677e6cf2d38ad3270f69aaea8a20cf2533c2980018d6e0fed711be2806fe2053fba7c081f3 WHIRLPOOL 5f5b95d00409fbe03adb64801d30a2fb5f98dded5efa7f0e78b5746776f72917dcbea767e1d0afcb304d8bf8c484adedb8037e6d54e9d34997c2bc3a98b53154
42 AUX qemu-binfmt.initd-r1 7023 SHA256 3572c110c6f217754e638796400a5901910a2e61b8818c8569f8258b103ebcc6 SHA512 773af64fef164c00945acf5881e64a10141aa8fdc85491e57bf8dcc7c800a4f81879527998a0896a42f921edcbf5f741beb31ac2a82e45cba506c7b8461733c8 WHIRLPOOL 30382fe347248683e989c2b7fbd804ce26173b313746d80467029b2ad3594f414628f7537120b168a0e700c424d3525528eb632b07e16544c2fd07f418f3187c
43 AUX qemu-kvm-1.4 68 SHA256 8b1adf198129f001e75a2311fc420c168094d1084d2163cdf6a32b3b23c96137 SHA512 706fab4d155c410acc292e67fb354ce7dcd17f7e33f2ca8c9c44035ea128f8d36f89e27cf87ebe22721f5676be9e7f2ae5484fd000183c8ffd7854e02eb3d120 WHIRLPOOL ef795330b592cef8e3d92f52a77eb77a671e6aa1a47d07531917b5c1c09e72e5df1a44aea939b086e0a3c5ef2a5cea9223556a46ceae73e55300475c42f07067
44 -DIST qemu-2.2.1.tar.bz2 24483500 SHA256 4617154c6ef744b83e10b744e392ad111dd351d435d6563ce24d8da75b1335a0 SHA512 970ead0c92fc04502c6d3a8dbfafa5797667b3d276a1a25ddbe991d20d8e17a588905ecbffa77fb3b9d12e481ac3776ca4c38fe89a5e4c96dc2fb045214bfa9f WHIRLPOOL 9226ce4a4f5c7247d6ab34eb8b45c9a91416ee5849dbe25b9d15cddbd6aba2b8da77280f6055d363a81ddec515d28bf501351cb7e21ecfb4bfe42cdb7e349788
45 -EBUILD qemu-2.2.1-r99.ebuild 18744 SHA256 15c5267816cbc7798b2aa0c342bd0a0254550d2fdb1497f3237aa33b53c8c59f SHA512 c7c90792a79fbf226e41f8dd61d5f3b1046a1e9c130d3216a0c29d374a09ec5aa8575e2578b843f37fd04645e2804ae91298924d307aff25922d7461bf52fe78 WHIRLPOOL ef73221242451e8772598ee1b0e346f4aa94ec59c1daf58ca9ac35d49e431c687ca5d80155e4e5846a3f76d35330a1043f9ae9018c19e0e1fc828711298aebae
46 +DIST qemu-2.5.0.tar.bz2 25464996 SHA256 3443887401619fe33bfa5d900a4f2d6a79425ae2b7e43d5b8c36eb7a683772d4 SHA512 12153f94cc7f834fd6a85f25690c36f2331d88d414426fb8b9ac20a34e6f9222b1eda30b727674af583580fae90dfd6d0614a905dce1567d94cd049d426b9dd3 WHIRLPOOL 8f5717989d8d234ecf1763ee386b2e1f20c3b17918de130c6dae255e4523a230b2b01a759eba25e4b9f604c680d9b868c56f58bd71b7c6c2c22a2e46804435ef
47 +EBUILD qemu-2.5.0-r99.ebuild 20028 SHA256 aeca48b0f3004f6d41077db6a763ef43c900cecf59d0f9d3ec6eb028846f0560 SHA512 31101660cd608272b6d6b24081ca095f3eb2fb2a33a2174fe62bf86fe006db6deb56590ae8a784fc69e3dd4f19c7a96035d38506f8a3d07e27397d710cf9e85c WHIRLPOOL 457f88c5e474183df7ae41a8d6c0ad49e76a6fdd69c59591c62f750c426e3998628f0770303536102d87509cfc2578813799e4052e09fb688460fa7bf424a2c4
48 MISC metadata.xml 3774 SHA256 45d220d5c3fedecb5c318e2ab1fa796391f5fd3db09e4ef218b3bc7cb3cb10e1 SHA512 90b16206b5398b4044132d930b417372e1d305a93b062c895bc3b46ae64a19aa96d2471b5838f960cca7c6c30ce58571f332731f02eaeee17e4204469c5d6330 WHIRLPOOL f5498b8cb14aeeacdfd1da30c26ceca282bba3042a6288496d624d91c3c26c1bed34c42374db04e06378c8efd78010d3bef76c41c1aa529ccf17cec513ed1fa8
49 diff --git a/app-emulation/qemu/files/qemu-2.2.1-CVE-2015-1779-1.patch b/app-emulation/qemu/files/qemu-2.2.1-CVE-2015-1779-1.patch
50 deleted file mode 100644
51 index 35ef8fd..0000000
52 --- a/app-emulation/qemu/files/qemu-2.2.1-CVE-2015-1779-1.patch
53 +++ /dev/null
54 @@ -1,241 +0,0 @@
55 -From a2bebfd6e09d285aa793cae3fb0fc3a39a9fee6e Mon Sep 17 00:00:00 2001
56 -From: "Daniel P. Berrange" <berrange@××××××.com>
57 -Date: Mon, 23 Mar 2015 22:58:21 +0000
58 -Subject: [PATCH] CVE-2015-1779: incrementally decode websocket frames
59 -
60 -The logic for decoding websocket frames wants to fully
61 -decode the frame header and payload, before allowing the
62 -VNC server to see any of the payload data. There is no
63 -size limit on websocket payloads, so this allows a
64 -malicious network client to consume 2^64 bytes in memory
65 -in QEMU. It can trigger this denial of service before
66 -the VNC server even performs any authentication.
67 -
68 -The fix is to decode the header, and then incrementally
69 -decode the payload data as it is needed. With this fix
70 -the websocket decoder will allow at most 4k of data to
71 -be buffered before decoding and processing payload.
72 -
73 -Signed-off-by: Daniel P. Berrange <berrange@××××××.com>
74 -
75 -[ kraxel: fix frequent spurious disconnects, suggested by Peter Maydell ]
76 -
77 - @@ -361,7 +361,7 @@ int vncws_decode_frame_payload(Buffer *input,
78 - - *payload_size = input->offset;
79 - + *payload_size = *payload_remain;
80 -
81 -[ kraxel: fix 32bit build ]
82 -
83 - @@ -306,7 +306,7 @@ struct VncState
84 - - uint64_t ws_payload_remain;
85 - + size_t ws_payload_remain;
86 -
87 -Signed-off-by: Gerd Hoffmann <kraxel@××××××.com>
88 ----
89 - ui/vnc-ws.c | 105 ++++++++++++++++++++++++++++++++++++++++--------------------
90 - ui/vnc-ws.h | 9 ++++--
91 - ui/vnc.h | 2 ++
92 - 3 files changed, 80 insertions(+), 36 deletions(-)
93 -
94 -diff --git a/ui/vnc-ws.c b/ui/vnc-ws.c
95 -index 85dbb7e..0b7de4e 100644
96 ---- a/ui/vnc-ws.c
97 -+++ b/ui/vnc-ws.c
98 -@@ -107,7 +107,7 @@ long vnc_client_read_ws(VncState *vs)
99 - {
100 - int ret, err;
101 - uint8_t *payload;
102 -- size_t payload_size, frame_size;
103 -+ size_t payload_size, header_size;
104 - VNC_DEBUG("Read websocket %p size %zd offset %zd\n", vs->ws_input.buffer,
105 - vs->ws_input.capacity, vs->ws_input.offset);
106 - buffer_reserve(&vs->ws_input, 4096);
107 -@@ -117,18 +117,39 @@ long vnc_client_read_ws(VncState *vs)
108 - }
109 - vs->ws_input.offset += ret;
110 -
111 -- /* make sure that nothing is left in the ws_input buffer */
112 -+ ret = 0;
113 -+ /* consume as much of ws_input buffer as possible */
114 - do {
115 -- err = vncws_decode_frame(&vs->ws_input, &payload,
116 -- &payload_size, &frame_size);
117 -- if (err <= 0) {
118 -- return err;
119 -+ if (vs->ws_payload_remain == 0) {
120 -+ err = vncws_decode_frame_header(&vs->ws_input,
121 -+ &header_size,
122 -+ &vs->ws_payload_remain,
123 -+ &vs->ws_payload_mask);
124 -+ if (err <= 0) {
125 -+ return err;
126 -+ }
127 -+
128 -+ buffer_advance(&vs->ws_input, header_size);
129 - }
130 -+ if (vs->ws_payload_remain != 0) {
131 -+ err = vncws_decode_frame_payload(&vs->ws_input,
132 -+ &vs->ws_payload_remain,
133 -+ &vs->ws_payload_mask,
134 -+ &payload,
135 -+ &payload_size);
136 -+ if (err < 0) {
137 -+ return err;
138 -+ }
139 -+ if (err == 0) {
140 -+ return ret;
141 -+ }
142 -+ ret += err;
143 -
144 -- buffer_reserve(&vs->input, payload_size);
145 -- buffer_append(&vs->input, payload, payload_size);
146 -+ buffer_reserve(&vs->input, payload_size);
147 -+ buffer_append(&vs->input, payload, payload_size);
148 -
149 -- buffer_advance(&vs->ws_input, frame_size);
150 -+ buffer_advance(&vs->ws_input, payload_size);
151 -+ }
152 - } while (vs->ws_input.offset > 0);
153 -
154 - return ret;
155 -@@ -265,15 +286,14 @@ void vncws_encode_frame(Buffer *output, const void *payload,
156 - buffer_append(output, payload, payload_size);
157 - }
158 -
159 --int vncws_decode_frame(Buffer *input, uint8_t **payload,
160 -- size_t *payload_size, size_t *frame_size)
161 -+int vncws_decode_frame_header(Buffer *input,
162 -+ size_t *header_size,
163 -+ size_t *payload_remain,
164 -+ WsMask *payload_mask)
165 - {
166 - unsigned char opcode = 0, fin = 0, has_mask = 0;
167 -- size_t header_size = 0;
168 -- uint32_t *payload32;
169 -+ size_t payload_len;
170 - WsHeader *header = (WsHeader *)input->buffer;
171 -- WsMask mask;
172 -- int i;
173 -
174 - if (input->offset < WS_HEAD_MIN_LEN + 4) {
175 - /* header not complete */
176 -@@ -283,7 +303,7 @@ int vncws_decode_frame(Buffer *input, uint8_t **payload,
177 - fin = (header->b0 & 0x80) >> 7;
178 - opcode = header->b0 & 0x0f;
179 - has_mask = (header->b1 & 0x80) >> 7;
180 -- *payload_size = header->b1 & 0x7f;
181 -+ payload_len = header->b1 & 0x7f;
182 -
183 - if (opcode == WS_OPCODE_CLOSE) {
184 - /* disconnect */
185 -@@ -300,40 +320,57 @@ int vncws_decode_frame(Buffer *input, uint8_t **payload,
186 - return -2;
187 - }
188 -
189 -- if (*payload_size < 126) {
190 -- header_size = 6;
191 -- mask = header->u.m;
192 -- } else if (*payload_size == 126 && input->offset >= 8) {
193 -- *payload_size = be16_to_cpu(header->u.s16.l16);
194 -- header_size = 8;
195 -- mask = header->u.s16.m16;
196 -- } else if (*payload_size == 127 && input->offset >= 14) {
197 -- *payload_size = be64_to_cpu(header->u.s64.l64);
198 -- header_size = 14;
199 -- mask = header->u.s64.m64;
200 -+ if (payload_len < 126) {
201 -+ *payload_remain = payload_len;
202 -+ *header_size = 6;
203 -+ *payload_mask = header->u.m;
204 -+ } else if (payload_len == 126 && input->offset >= 8) {
205 -+ *payload_remain = be16_to_cpu(header->u.s16.l16);
206 -+ *header_size = 8;
207 -+ *payload_mask = header->u.s16.m16;
208 -+ } else if (payload_len == 127 && input->offset >= 14) {
209 -+ *payload_remain = be64_to_cpu(header->u.s64.l64);
210 -+ *header_size = 14;
211 -+ *payload_mask = header->u.s64.m64;
212 - } else {
213 - /* header not complete */
214 - return 0;
215 - }
216 -
217 -- *frame_size = header_size + *payload_size;
218 -+ return 1;
219 -+}
220 -+
221 -+int vncws_decode_frame_payload(Buffer *input,
222 -+ size_t *payload_remain, WsMask *payload_mask,
223 -+ uint8_t **payload, size_t *payload_size)
224 -+{
225 -+ size_t i;
226 -+ uint32_t *payload32;
227 -
228 -- if (input->offset < *frame_size) {
229 -- /* frame not complete */
230 -+ *payload = input->buffer;
231 -+ /* If we aren't at the end of the payload, then drop
232 -+ * off the last bytes, so we're always multiple of 4
233 -+ * for purpose of unmasking, except at end of payload
234 -+ */
235 -+ if (input->offset < *payload_remain) {
236 -+ *payload_size = input->offset - (input->offset % 4);
237 -+ } else {
238 -+ *payload_size = *payload_remain;
239 -+ }
240 -+ if (*payload_size == 0) {
241 - return 0;
242 - }
243 --
244 -- *payload = input->buffer + header_size;
245 -+ *payload_remain -= *payload_size;
246 -
247 - /* unmask frame */
248 - /* process 1 frame (32 bit op) */
249 - payload32 = (uint32_t *)(*payload);
250 - for (i = 0; i < *payload_size / 4; i++) {
251 -- payload32[i] ^= mask.u;
252 -+ payload32[i] ^= payload_mask->u;
253 - }
254 - /* process the remaining bytes (if any) */
255 - for (i *= 4; i < *payload_size; i++) {
256 -- (*payload)[i] ^= mask.c[i % 4];
257 -+ (*payload)[i] ^= payload_mask->c[i % 4];
258 - }
259 -
260 - return 1;
261 -diff --git a/ui/vnc-ws.h b/ui/vnc-ws.h
262 -index ef229b7..14d4230 100644
263 ---- a/ui/vnc-ws.h
264 -+++ b/ui/vnc-ws.h
265 -@@ -83,7 +83,12 @@ long vnc_client_read_ws(VncState *vs);
266 - void vncws_process_handshake(VncState *vs, uint8_t *line, size_t size);
267 - void vncws_encode_frame(Buffer *output, const void *payload,
268 - const size_t payload_size);
269 --int vncws_decode_frame(Buffer *input, uint8_t **payload,
270 -- size_t *payload_size, size_t *frame_size);
271 -+int vncws_decode_frame_header(Buffer *input,
272 -+ size_t *header_size,
273 -+ size_t *payload_remain,
274 -+ WsMask *payload_mask);
275 -+int vncws_decode_frame_payload(Buffer *input,
276 -+ size_t *payload_remain, WsMask *payload_mask,
277 -+ uint8_t **payload, size_t *payload_size);
278 -
279 - #endif /* __QEMU_UI_VNC_WS_H */
280 -diff --git a/ui/vnc.h b/ui/vnc.h
281 -index e19ac39..3f7c6a9 100644
282 ---- a/ui/vnc.h
283 -+++ b/ui/vnc.h
284 -@@ -306,6 +306,8 @@ struct VncState
285 - #ifdef CONFIG_VNC_WS
286 - Buffer ws_input;
287 - Buffer ws_output;
288 -+ size_t ws_payload_remain;
289 -+ WsMask ws_payload_mask;
290 - #endif
291 - /* current output mode information */
292 - VncWritePixels *write_pixels;
293 ---
294 -2.3.5
295 -
296 diff --git a/app-emulation/qemu/files/qemu-2.2.1-CVE-2015-1779-2.patch b/app-emulation/qemu/files/qemu-2.2.1-CVE-2015-1779-2.patch
297 deleted file mode 100644
298 index c7a8c8b..0000000
299 --- a/app-emulation/qemu/files/qemu-2.2.1-CVE-2015-1779-2.patch
300 +++ /dev/null
301 @@ -1,58 +0,0 @@
302 -From 2cdb5e142fb93e875fa53c52864ef5eb8d5d8b41 Mon Sep 17 00:00:00 2001
303 -From: "Daniel P. Berrange" <berrange@××××××.com>
304 -Date: Mon, 23 Mar 2015 22:58:22 +0000
305 -Subject: [PATCH] CVE-2015-1779: limit size of HTTP headers from websockets
306 - clients
307 -
308 -The VNC server websockets decoder will read and buffer data from
309 -websockets clients until it sees the end of the HTTP headers,
310 -as indicated by \r\n\r\n. In theory this allows a malicious to
311 -trick QEMU into consuming an arbitrary amount of RAM. In practice,
312 -because QEMU runs g_strstr_len() across the buffered header data,
313 -it will spend increasingly long burning CPU time searching for
314 -the substring match and less & less time reading data. So while
315 -this does cause arbitrary memory growth, the bigger problem is
316 -that QEMU will be burning 100% of available CPU time.
317 -
318 -A novnc websockets client typically sends headers of around
319 -512 bytes in length. As such it is reasonable to place a 4096
320 -byte limit on the amount of data buffered while searching for
321 -the end of HTTP headers.
322 -
323 -Signed-off-by: Daniel P. Berrange <berrange@××××××.com>
324 -Signed-off-by: Gerd Hoffmann <kraxel@××××××.com>
325 ----
326 - ui/vnc-ws.c | 10 ++++++++--
327 - 1 file changed, 8 insertions(+), 2 deletions(-)
328 -
329 -diff --git a/ui/vnc-ws.c b/ui/vnc-ws.c
330 -index 0b7de4e..62eb97f 100644
331 ---- a/ui/vnc-ws.c
332 -+++ b/ui/vnc-ws.c
333 -@@ -81,8 +81,11 @@ void vncws_handshake_read(void *opaque)
334 - VncState *vs = opaque;
335 - uint8_t *handshake_end;
336 - long ret;
337 -- buffer_reserve(&vs->ws_input, 4096);
338 -- ret = vnc_client_read_buf(vs, buffer_end(&vs->ws_input), 4096);
339 -+ /* Typical HTTP headers from novnc are 512 bytes, so limiting
340 -+ * total header size to 4096 is easily enough. */
341 -+ size_t want = 4096 - vs->ws_input.offset;
342 -+ buffer_reserve(&vs->ws_input, want);
343 -+ ret = vnc_client_read_buf(vs, buffer_end(&vs->ws_input), want);
344 -
345 - if (!ret) {
346 - if (vs->csock == -1) {
347 -@@ -99,6 +102,9 @@ void vncws_handshake_read(void *opaque)
348 - vncws_process_handshake(vs, vs->ws_input.buffer, vs->ws_input.offset);
349 - buffer_advance(&vs->ws_input, handshake_end - vs->ws_input.buffer +
350 - strlen(WS_HANDSHAKE_END));
351 -+ } else if (vs->ws_input.offset >= 4096) {
352 -+ VNC_DEBUG("End of headers not found in first 4096 bytes\n");
353 -+ vnc_client_error(vs);
354 - }
355 - }
356 -
357 ---
358 -2.3.5
359 -
360 diff --git a/app-emulation/qemu/files/qemu-2.3.0-CVE-2015-3456.patch b/app-emulation/qemu/files/qemu-2.3.0-CVE-2015-3456.patch
361 deleted file mode 100644
362 index 87697d0..0000000
363 --- a/app-emulation/qemu/files/qemu-2.3.0-CVE-2015-3456.patch
364 +++ /dev/null
365 @@ -1,86 +0,0 @@
366 -https://bugs.gentoo.org/549404
367 -
368 -From e907746266721f305d67bc0718795fedee2e824c Mon Sep 17 00:00:00 2001
369 -From: Petr Matousek <pmatouse@××××××.com>
370 -Date: Wed, 6 May 2015 09:48:59 +0200
371 -Subject: [PATCH] fdc: force the fifo access to be in bounds of the allocated buffer
372 -
373 -During processing of certain commands such as FD_CMD_READ_ID and
374 -FD_CMD_DRIVE_SPECIFICATION_COMMAND the fifo memory access could
375 -get out of bounds leading to memory corruption with values coming
376 -from the guest.
377 -
378 -Fix this by making sure that the index is always bounded by the
379 -allocated memory.
380 -
381 -This is CVE-2015-3456.
382 -
383 -Signed-off-by: Petr Matousek <pmatouse@××××××.com>
384 -Reviewed-by: John Snow <jsnow@××××××.com>
385 -Signed-off-by: John Snow <jsnow@××××××.com>
386 ----
387 - hw/block/fdc.c | 17 +++++++++++------
388 - 1 files changed, 11 insertions(+), 6 deletions(-)
389 -
390 -diff --git a/hw/block/fdc.c b/hw/block/fdc.c
391 -index f72a392..d8a8edd 100644
392 ---- a/hw/block/fdc.c
393 -+++ b/hw/block/fdc.c
394 -@@ -1497,7 +1497,7 @@ static uint32_t fdctrl_read_data(FDCtrl *fdctrl)
395 - {
396 - FDrive *cur_drv;
397 - uint32_t retval = 0;
398 -- int pos;
399 -+ uint32_t pos;
400 -
401 - cur_drv = get_cur_drv(fdctrl);
402 - fdctrl->dsr &= ~FD_DSR_PWRDOWN;
403 -@@ -1506,8 +1506,8 @@ static uint32_t fdctrl_read_data(FDCtrl *fdctrl)
404 - return 0;
405 - }
406 - pos = fdctrl->data_pos;
407 -+ pos %= FD_SECTOR_LEN;
408 - if (fdctrl->msr & FD_MSR_NONDMA) {
409 -- pos %= FD_SECTOR_LEN;
410 - if (pos == 0) {
411 - if (fdctrl->data_pos != 0)
412 - if (!fdctrl_seek_to_next_sect(fdctrl, cur_drv)) {
413 -@@ -1852,10 +1852,13 @@ static void fdctrl_handle_option(FDCtrl *fdctrl, int direction)
414 - static void fdctrl_handle_drive_specification_command(FDCtrl *fdctrl, int direction)
415 - {
416 - FDrive *cur_drv = get_cur_drv(fdctrl);
417 -+ uint32_t pos;
418 -
419 -- if (fdctrl->fifo[fdctrl->data_pos - 1] & 0x80) {
420 -+ pos = fdctrl->data_pos - 1;
421 -+ pos %= FD_SECTOR_LEN;
422 -+ if (fdctrl->fifo[pos] & 0x80) {
423 - /* Command parameters done */
424 -- if (fdctrl->fifo[fdctrl->data_pos - 1] & 0x40) {
425 -+ if (fdctrl->fifo[pos] & 0x40) {
426 - fdctrl->fifo[0] = fdctrl->fifo[1];
427 - fdctrl->fifo[2] = 0;
428 - fdctrl->fifo[3] = 0;
429 -@@ -1955,7 +1958,7 @@ static uint8_t command_to_handler[256];
430 - static void fdctrl_write_data(FDCtrl *fdctrl, uint32_t value)
431 - {
432 - FDrive *cur_drv;
433 -- int pos;
434 -+ uint32_t pos;
435 -
436 - /* Reset mode */
437 - if (!(fdctrl->dor & FD_DOR_nRESET)) {
438 -@@ -2004,7 +2007,9 @@ static void fdctrl_write_data(FDCtrl *fdctrl, uint32_t value)
439 - }
440 -
441 - FLOPPY_DPRINTF("%s: %02x\n", __func__, value);
442 -- fdctrl->fifo[fdctrl->data_pos++] = value;
443 -+ pos = fdctrl->data_pos++;
444 -+ pos %= FD_SECTOR_LEN;
445 -+ fdctrl->fifo[pos] = value;
446 - if (fdctrl->data_pos == fdctrl->data_len) {
447 - /* We now have all parameters
448 - * and will be able to treat the command
449 ---
450 -1.7.0.4
451 -
452 diff --git a/app-emulation/qemu/files/qemu-2.5.0-CVE-2015-8558.patch b/app-emulation/qemu/files/qemu-2.5.0-CVE-2015-8558.patch
453 new file mode 100644
454 index 0000000..fbc6a0a
455 --- /dev/null
456 +++ b/app-emulation/qemu/files/qemu-2.5.0-CVE-2015-8558.patch
457 @@ -0,0 +1,50 @@
458 +https://bugs.gentoo.org/568246
459 +
460 +From 156a2e4dbffa85997636a7a39ef12da6f1b40254 Mon Sep 17 00:00:00 2001
461 +From: Gerd Hoffmann <kraxel@××××××.com>
462 +Date: Mon, 14 Dec 2015 09:21:23 +0100
463 +Subject: [PATCH] ehci: make idt processing more robust
464 +
465 +Make ehci_process_itd return an error in case we didn't do any actual
466 +iso transfer because we've found no active transaction. That'll avoid
467 +ehci happily run in circles forever if the guest builds a loop out of
468 +idts.
469 +
470 +This is CVE-2015-8558.
471 +
472 +Cc: qemu-stable@××××××.org
473 +Reported-by: Qinghao Tang <luodalongde@×××××.com>
474 +Tested-by: P J P <ppandit@××××××.com>
475 +Signed-off-by: Gerd Hoffmann <kraxel@××××××.com>
476 +---
477 + hw/usb/hcd-ehci.c | 5 +++--
478 + 1 file changed, 3 insertions(+), 2 deletions(-)
479 +
480 +diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c
481 +index 4e2161b..d07f228 100644
482 +--- a/hw/usb/hcd-ehci.c
483 ++++ b/hw/usb/hcd-ehci.c
484 +@@ -1389,7 +1389,7 @@ static int ehci_process_itd(EHCIState *ehci,
485 + {
486 + USBDevice *dev;
487 + USBEndpoint *ep;
488 +- uint32_t i, len, pid, dir, devaddr, endp;
489 ++ uint32_t i, len, pid, dir, devaddr, endp, xfers = 0;
490 + uint32_t pg, off, ptr1, ptr2, max, mult;
491 +
492 + ehci->periodic_sched_active = PERIODIC_ACTIVE;
493 +@@ -1479,9 +1479,10 @@ static int ehci_process_itd(EHCIState *ehci,
494 + ehci_raise_irq(ehci, USBSTS_INT);
495 + }
496 + itd->transact[i] &= ~ITD_XACT_ACTIVE;
497 ++ xfers++;
498 + }
499 + }
500 +- return 0;
501 ++ return xfers ? 0 : -1;
502 + }
503 +
504 +
505 +--
506 +2.6.2
507 +
508 diff --git a/app-emulation/qemu/files/qemu-2.5.0-CVE-2015-8567.patch b/app-emulation/qemu/files/qemu-2.5.0-CVE-2015-8567.patch
509 new file mode 100644
510 index 0000000..e196043
511 --- /dev/null
512 +++ b/app-emulation/qemu/files/qemu-2.5.0-CVE-2015-8567.patch
513 @@ -0,0 +1,95 @@
514 +https://bugs.gentoo.org/567868
515 +
516 +From aa4a3dce1c88ed51b616806b8214b7c8428b7470 Mon Sep 17 00:00:00 2001
517 +From: P J P <ppandit@××××××.com>
518 +Date: Tue, 15 Dec 2015 12:27:54 +0530
519 +Subject: [PATCH] net: vmxnet3: avoid memory leakage in activate_device
520 +
521 +Vmxnet3 device emulator does not check if the device is active
522 +before activating it, also it did not free the transmit & receive
523 +buffers while deactivating the device, thus resulting in memory
524 +leakage on the host. This patch fixes both these issues to avoid
525 +host memory leakage.
526 +
527 +Reported-by: Qinghao Tang <luodalongde@×××××.com>
528 +Reviewed-by: Dmitry Fleytman <dmitry@××××××.com>
529 +Signed-off-by: Prasad J Pandit <pjp@×××××××××××××.org>
530 +Cc: qemu-stable@××××××.org
531 +Signed-off-by: Jason Wang <jasowang@××××××.com>
532 +---
533 + hw/net/vmxnet3.c | 24 ++++++++++++++++--------
534 + 1 file changed, 16 insertions(+), 8 deletions(-)
535 +
536 +diff --git a/hw/net/vmxnet3.c b/hw/net/vmxnet3.c
537 +index a5dd79a..9c1adfc 100644
538 +--- a/hw/net/vmxnet3.c
539 ++++ b/hw/net/vmxnet3.c
540 +@@ -1194,8 +1194,13 @@ static void vmxnet3_reset_mac(VMXNET3State *s)
541 +
542 + static void vmxnet3_deactivate_device(VMXNET3State *s)
543 + {
544 +- VMW_CBPRN("Deactivating vmxnet3...");
545 +- s->device_active = false;
546 ++ if (s->device_active) {
547 ++ VMW_CBPRN("Deactivating vmxnet3...");
548 ++ vmxnet_tx_pkt_reset(s->tx_pkt);
549 ++ vmxnet_tx_pkt_uninit(s->tx_pkt);
550 ++ vmxnet_rx_pkt_uninit(s->rx_pkt);
551 ++ s->device_active = false;
552 ++ }
553 + }
554 +
555 + static void vmxnet3_reset(VMXNET3State *s)
556 +@@ -1204,7 +1209,6 @@ static void vmxnet3_reset(VMXNET3State *s)
557 +
558 + vmxnet3_deactivate_device(s);
559 + vmxnet3_reset_interrupt_states(s);
560 +- vmxnet_tx_pkt_reset(s->tx_pkt);
561 + s->drv_shmem = 0;
562 + s->tx_sop = true;
563 + s->skip_current_tx_pkt = false;
564 +@@ -1431,6 +1435,12 @@ static void vmxnet3_activate_device(VMXNET3State *s)
565 + return;
566 + }
567 +
568 ++ /* Verify if device is active */
569 ++ if (s->device_active) {
570 ++ VMW_CFPRN("Vmxnet3 device is active");
571 ++ return;
572 ++ }
573 ++
574 + vmxnet3_adjust_by_guest_type(s);
575 + vmxnet3_update_features(s);
576 + vmxnet3_update_pm_state(s);
577 +@@ -1627,7 +1637,7 @@ static void vmxnet3_handle_command(VMXNET3State *s, uint64_t cmd)
578 + break;
579 +
580 + case VMXNET3_CMD_QUIESCE_DEV:
581 +- VMW_CBPRN("Set: VMXNET3_CMD_QUIESCE_DEV - pause the device");
582 ++ VMW_CBPRN("Set: VMXNET3_CMD_QUIESCE_DEV - deactivate the device");
583 + vmxnet3_deactivate_device(s);
584 + break;
585 +
586 +@@ -1741,7 +1751,7 @@ vmxnet3_io_bar1_write(void *opaque,
587 + * shared address only after we get the high part
588 + */
589 + if (val == 0) {
590 +- s->device_active = false;
591 ++ vmxnet3_deactivate_device(s);
592 + }
593 + s->temp_shared_guest_driver_memory = val;
594 + s->drv_shmem = 0;
595 +@@ -2021,9 +2031,7 @@ static bool vmxnet3_peer_has_vnet_hdr(VMXNET3State *s)
596 + static void vmxnet3_net_uninit(VMXNET3State *s)
597 + {
598 + g_free(s->mcast_list);
599 +- vmxnet_tx_pkt_reset(s->tx_pkt);
600 +- vmxnet_tx_pkt_uninit(s->tx_pkt);
601 +- vmxnet_rx_pkt_uninit(s->rx_pkt);
602 ++ vmxnet3_deactivate_device(s);
603 + qemu_del_nic(s->nic);
604 + }
605 +
606 +--
607 +2.6.2
608 +
609 diff --git a/app-emulation/qemu/files/qemu-2.5.0-CVE-2015-8701.patch b/app-emulation/qemu/files/qemu-2.5.0-CVE-2015-8701.patch
610 new file mode 100644
611 index 0000000..0dab1c3
612 --- /dev/null
613 +++ b/app-emulation/qemu/files/qemu-2.5.0-CVE-2015-8701.patch
614 @@ -0,0 +1,49 @@
615 +https://bugs.gentoo.org/570110
616 +
617 +From 007cd223de527b5f41278f2d886c1a4beb3e67aa Mon Sep 17 00:00:00 2001
618 +From: Prasad J Pandit <pjp@×××××××××××××.org>
619 +Date: Mon, 28 Dec 2015 16:24:08 +0530
620 +Subject: [PATCH] net: rocker: fix an incorrect array bounds check
621 +
622 +While processing transmit(tx) descriptors in 'tx_consume' routine
623 +the switch emulator suffers from an off-by-one error, if a
624 +descriptor was to have more than allowed(ROCKER_TX_FRAGS_MAX=16)
625 +fragments. Fix an incorrect bounds check to avoid it.
626 +
627 +Reported-by: Qinghao Tang <luodalongde@×××××.com>
628 +Cc: qemu-stable@××××××.org
629 +Signed-off-by: Prasad J Pandit <pjp@×××××××××××××.org>
630 +Signed-off-by: Jason Wang <jasowang@××××××.com>
631 +---
632 + hw/net/rocker/rocker.c | 8 ++++----
633 + 1 file changed, 4 insertions(+), 4 deletions(-)
634 +
635 +diff --git a/hw/net/rocker/rocker.c b/hw/net/rocker/rocker.c
636 +index c57f1a6..2e77e50 100644
637 +--- a/hw/net/rocker/rocker.c
638 ++++ b/hw/net/rocker/rocker.c
639 +@@ -232,6 +232,9 @@ static int tx_consume(Rocker *r, DescInfo *info)
640 + frag_addr = rocker_tlv_get_le64(tlvs[ROCKER_TLV_TX_FRAG_ATTR_ADDR]);
641 + frag_len = rocker_tlv_get_le16(tlvs[ROCKER_TLV_TX_FRAG_ATTR_LEN]);
642 +
643 ++ if (iovcnt >= ROCKER_TX_FRAGS_MAX) {
644 ++ goto err_too_many_frags;
645 ++ }
646 + iov[iovcnt].iov_len = frag_len;
647 + iov[iovcnt].iov_base = g_malloc(frag_len);
648 + if (!iov[iovcnt].iov_base) {
649 +@@ -244,10 +247,7 @@ static int tx_consume(Rocker *r, DescInfo *info)
650 + err = -ROCKER_ENXIO;
651 + goto err_bad_io;
652 + }
653 +-
654 +- if (++iovcnt > ROCKER_TX_FRAGS_MAX) {
655 +- goto err_too_many_frags;
656 +- }
657 ++ iovcnt++;
658 + }
659 +
660 + if (iovcnt) {
661 +--
662 +2.6.2
663 +
664 diff --git a/app-emulation/qemu/files/qemu-2.5.0-CVE-2015-8743.patch b/app-emulation/qemu/files/qemu-2.5.0-CVE-2015-8743.patch
665 new file mode 100644
666 index 0000000..b2bca56
667 --- /dev/null
668 +++ b/app-emulation/qemu/files/qemu-2.5.0-CVE-2015-8743.patch
669 @@ -0,0 +1,50 @@
670 +https://bugs.gentoo.org/570988
671 +
672 +From aa7f9966dfdff500bbbf1956d9e115b1fa8987a6 Mon Sep 17 00:00:00 2001
673 +From: Prasad J Pandit <pjp@×××××××××××××.org>
674 +Date: Thu, 31 Dec 2015 17:05:27 +0530
675 +Subject: [PATCH] net: ne2000: fix bounds check in ioport operations
676 +
677 +While doing ioport r/w operations, ne2000 device emulation suffers
678 +from OOB r/w errors. Update respective array bounds check to avoid
679 +OOB access.
680 +
681 +Reported-by: Ling Liu <liuling-it@×××.cn>
682 +Cc: qemu-stable@××××××.org
683 +Signed-off-by: Prasad J Pandit <pjp@×××××××××××××.org>
684 +Signed-off-by: Jason Wang <jasowang@××××××.com>
685 +---
686 + hw/net/ne2000.c | 10 ++++++----
687 + 1 file changed, 6 insertions(+), 4 deletions(-)
688 +
689 +diff --git a/hw/net/ne2000.c b/hw/net/ne2000.c
690 +index 010f9ef..a3dffff 100644
691 +--- a/hw/net/ne2000.c
692 ++++ b/hw/net/ne2000.c
693 +@@ -467,8 +467,9 @@ static inline void ne2000_mem_writel(NE2000State *s, uint32_t addr,
694 + uint32_t val)
695 + {
696 + addr &= ~1; /* XXX: check exact behaviour if not even */
697 +- if (addr < 32 ||
698 +- (addr >= NE2000_PMEM_START && addr < NE2000_MEM_SIZE)) {
699 ++ if (addr < 32
700 ++ || (addr >= NE2000_PMEM_START
701 ++ && addr + sizeof(uint32_t) <= NE2000_MEM_SIZE)) {
702 + stl_le_p(s->mem + addr, val);
703 + }
704 + }
705 +@@ -497,8 +498,9 @@ static inline uint32_t ne2000_mem_readw(NE2000State *s, uint32_t addr)
706 + static inline uint32_t ne2000_mem_readl(NE2000State *s, uint32_t addr)
707 + {
708 + addr &= ~1; /* XXX: check exact behaviour if not even */
709 +- if (addr < 32 ||
710 +- (addr >= NE2000_PMEM_START && addr < NE2000_MEM_SIZE)) {
711 ++ if (addr < 32
712 ++ || (addr >= NE2000_PMEM_START
713 ++ && addr + sizeof(uint32_t) <= NE2000_MEM_SIZE)) {
714 + return ldl_le_p(s->mem + addr);
715 + } else {
716 + return 0xffffffff;
717 +--
718 +2.6.2
719 +
720 diff --git a/app-emulation/qemu/files/qemu-2.5.0-CVE-2016-1568.patch b/app-emulation/qemu/files/qemu-2.5.0-CVE-2016-1568.patch
721 new file mode 100644
722 index 0000000..4ce9a35
723 --- /dev/null
724 +++ b/app-emulation/qemu/files/qemu-2.5.0-CVE-2016-1568.patch
725 @@ -0,0 +1,41 @@
726 +https://bugs.gentoo.org/571566
727 +
728 +From 4ab0359a8ae182a7ac5c99609667273167703fab Mon Sep 17 00:00:00 2001
729 +From: Prasad J Pandit <pjp@×××××××××××××.org>
730 +Date: Mon, 11 Jan 2016 14:10:42 -0500
731 +Subject: [PATCH] ide: ahci: reset ncq object to unused on error
732 +
733 +When processing NCQ commands, AHCI device emulation prepares a
734 +NCQ transfer object; To which an aio control block(aiocb) object
735 +is assigned in 'execute_ncq_command'. In case, when the NCQ
736 +command is invalid, the 'aiocb' object is not assigned, and NCQ
737 +transfer object is left as 'used'. This leads to a use after
738 +free kind of error in 'bdrv_aio_cancel_async' via 'ahci_reset_port'.
739 +Reset NCQ transfer object to 'unused' to avoid it.
740 +
741 +[Maintainer edit: s/ACHI/AHCI/ in the commit message. --js]
742 +
743 +Reported-by: Qinghao Tang <luodalongde@×××××.com>
744 +Signed-off-by: Prasad J Pandit <pjp@×××××××××××××.org>
745 +Reviewed-by: John Snow <jsnow@××××××.com>
746 +Message-id: 1452282511-4116-1-git-send-email-ppandit@××××××.com
747 +Signed-off-by: John Snow <jsnow@××××××.com>
748 +---
749 + hw/ide/ahci.c | 1 +
750 + 1 file changed, 1 insertion(+)
751 +
752 +diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c
753 +index dd1912e..17f1cbd 100644
754 +--- a/hw/ide/ahci.c
755 ++++ b/hw/ide/ahci.c
756 +@@ -910,6 +910,7 @@ static void ncq_err(NCQTransferState *ncq_tfs)
757 + ide_state->error = ABRT_ERR;
758 + ide_state->status = READY_STAT | ERR_STAT;
759 + ncq_tfs->drive->port_regs.scr_err |= (1 << ncq_tfs->tag);
760 ++ ncq_tfs->used = 0;
761 + }
762 +
763 + static void ncq_finish(NCQTransferState *ncq_tfs)
764 +--
765 +2.6.2
766 +
767 diff --git a/app-emulation/qemu/files/qemu-2.5.0-cflags.patch b/app-emulation/qemu/files/qemu-2.5.0-cflags.patch
768 new file mode 100644
769 index 0000000..173394f
770 --- /dev/null
771 +++ b/app-emulation/qemu/files/qemu-2.5.0-cflags.patch
772 @@ -0,0 +1,13 @@
773 +--- a/configure
774 ++++ b/configure
775 +@@ -4468,10 +4468,6 @@ fi
776 + if test "$gcov" = "yes" ; then
777 + CFLAGS="-fprofile-arcs -ftest-coverage -g $CFLAGS"
778 + LDFLAGS="-fprofile-arcs -ftest-coverage $LDFLAGS"
779 +-elif test "$fortify_source" = "yes" ; then
780 +- CFLAGS="-O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $CFLAGS"
781 +-elif test "$debug" = "no"; then
782 +- CFLAGS="-O2 $CFLAGS"
783 + fi
784 +
785 + ##########################################
786 diff --git a/app-emulation/qemu/qemu-2.2.1-r99.ebuild b/app-emulation/qemu/qemu-2.5.0-r99.ebuild
787 similarity index 73%
788 rename from app-emulation/qemu/qemu-2.2.1-r99.ebuild
789 rename to app-emulation/qemu/qemu-2.5.0-r99.ebuild
790 index 5b8baf1..2fe26b3 100644
791 --- a/app-emulation/qemu/qemu-2.2.1-r99.ebuild
792 +++ b/app-emulation/qemu/qemu-2.5.0-r99.ebuild
793 @@ -1,6 +1,6 @@
794 # Copyright 1999-2015 Gentoo Foundation
795 # Distributed under the terms of the GNU General Public License v2
796 -# $Header: /var/cvsroot/gentoo-x86/app-emulation/qemu/qemu-2.2.1-r2.ebuild,v 1.3 2015/05/14 07:09:58 ago Exp $
797 +# $Id$
798
799 EAPI=5
800
801 @@ -16,12 +16,11 @@ if [[ ${PV} = *9999* ]]; then
802 EGIT_REPO_URI="git://git.qemu.org/qemu.git"
803 inherit git-2
804 SRC_URI=""
805 - KEYWORDS=""
806 else
807 SRC_URI="http://wiki.qemu-project.org/download/${P}.tar.bz2
808 ${BACKPORTS:+
809 - http://dev.gentoo.org/~cardoe/distfiles/${P}-${BACKPORTS}.tar.xz}"
810 - KEYWORDS="amd64 ~ppc ~ppc64 x86 ~x86-fbsd"
811 + https://dev.gentoo.org/~cardoe/distfiles/${P}-${BACKPORTS}.tar.xz}"
812 + KEYWORDS="amd64 ~ppc x86"
813 fi
814
815 DESCRIPTION="QEMU + Kernel-based Virtual Machine userland tools"
816 @@ -30,76 +29,119 @@ HOMEPAGE="http://www.qemu.org http://www.linux-kvm.org"
817 LICENSE="GPL-2 LGPL-2 BSD-2"
818 SLOT="0"
819 IUSE="accessibility +aio alsa bluetooth +caps +curl debug +fdt glusterfs \
820 -gtk infiniband iscsi +jpeg \
821 +gnutls gtk gtk2 infiniband iscsi +jpeg \
822 kernel_linux kernel_FreeBSD lzo ncurses nfs nls numa opengl +pin-upstream-blobs
823 +png pulseaudio python \
824 -rbd sasl +seccomp sdl selinux smartcard snappy spice ssh static static-softmmu \
825 -static-user systemtap tci test +threads tls usb usbredir +uuid vde +vhost-net \
826 -virtfs +vnc xattr xen xfs"
827 +rbd sasl +seccomp sdl sdl2 selinux smartcard snappy spice ssh static static-softmmu
828 +static-user systemtap tci test +threads usb usbredir +uuid vde +vhost-net \
829 +virgl virtfs +vnc vte xattr xen xfs"
830
831 COMMON_TARGETS="aarch64 alpha arm cris i386 m68k microblaze microblazeel mips
832 mips64 mips64el mipsel or32 ppc ppc64 s390x sh4 sh4eb sparc sparc64 unicore32
833 x86_64"
834 -IUSE_SOFTMMU_TARGETS="${COMMON_TARGETS} lm32 moxie ppcemb xtensa xtensaeb"
835 -IUSE_USER_TARGETS="${COMMON_TARGETS} armeb mipsn32 mipsn32el ppc64abi32 sparc32plus"
836 +IUSE_SOFTMMU_TARGETS="${COMMON_TARGETS} lm32 moxie ppcemb tricore xtensa xtensaeb"
837 +IUSE_USER_TARGETS="${COMMON_TARGETS} armeb mipsn32 mipsn32el ppc64abi32 ppc64le sparc32plus tilegx"
838
839 -use_targets="
840 - $(printf ' qemu_softmmu_targets_%s' ${IUSE_SOFTMMU_TARGETS})
841 - $(printf ' qemu_user_targets_%s' ${IUSE_USER_TARGETS})
842 -"
843 -IUSE+=" ${use_targets}"
844 +use_softmmu_targets=$(printf ' qemu_softmmu_targets_%s' ${IUSE_SOFTMMU_TARGETS})
845 +use_user_targets=$(printf ' qemu_user_targets_%s' ${IUSE_USER_TARGETS})
846 +IUSE+=" ${use_softmmu_targets} ${use_user_targets}"
847
848 -# Require at least one softmmu or user target.
849 +# Allow no targets to be built so that people can get a tools-only build.
850 # Block USE flag configurations known to not work.
851 -REQUIRED_USE="|| ( ${use_targets} )
852 - ${PYTHON_REQUIRED_USE}
853 +REQUIRED_USE="${PYTHON_REQUIRED_USE}
854 + gtk2? ( gtk )
855 qemu_softmmu_targets_arm? ( fdt )
856 qemu_softmmu_targets_microblaze? ( fdt )
857 qemu_softmmu_targets_ppc? ( fdt )
858 qemu_softmmu_targets_ppc64? ( fdt )
859 + sdl2? ( sdl )
860 static? ( static-softmmu static-user )
861 - static-softmmu? ( !alsa !pulseaudio !bluetooth !opengl !gtk )
862 - virtfs? ( xattr )"
863 + static-softmmu? ( !alsa !pulseaudio !bluetooth !opengl !gtk !gtk2 )
864 + virtfs? ( xattr )
865 + vte? ( gtk )"
866
867 # Yep, you need both libcap and libcap-ng since virtfs only uses libcap.
868 #
869 # The attr lib isn't always linked in (although the USE flag is always
870 # respected). This is because qemu supports using the C library's API
871 # when available rather than always using the extranl library.
872 +#
873 +# Older versions of gnutls are supported, but it's simpler to just require
874 +# the latest versions. This is also why we require nettle.
875 COMMON_LIB_DEPEND=">=dev-libs/glib-2.0[static-libs(+)]
876 sys-libs/zlib[static-libs(+)]
877 xattr? ( sys-apps/attr[static-libs(+)] )"
878 SOFTMMU_LIB_DEPEND="${COMMON_LIB_DEPEND}
879 >=x11-libs/pixman-0.28.0[static-libs(+)]
880 + accessibility? ( app-accessibility/brltty[static-libs(+)] )
881 aio? ( dev-libs/libaio[static-libs(+)] )
882 + alsa? ( >=media-libs/alsa-lib-1.0.13 )
883 + bluetooth? ( net-wireless/bluez )
884 caps? ( sys-libs/libcap-ng[static-libs(+)] )
885 curl? ( >=net-misc/curl-7.15.4[static-libs(+)] )
886 fdt? ( >=sys-apps/dtc-1.4.0[static-libs(+)] )
887 glusterfs? ( >=sys-cluster/glusterfs-3.4.0[static-libs(+)] )
888 + gnutls? (
889 + dev-libs/nettle[static-libs(+)]
890 + >=net-libs/gnutls-3.0[static-libs(+)]
891 + )
892 + gtk? (
893 + gtk2? (
894 + x11-libs/gtk+:2
895 + vte? ( x11-libs/vte:0 )
896 + )
897 + !gtk2? (
898 + x11-libs/gtk+:3
899 + vte? ( x11-libs/vte:2.90 )
900 + )
901 + )
902 infiniband? ( sys-infiniband/librdmacm:=[static-libs(+)] )
903 + iscsi? ( net-libs/libiscsi )
904 jpeg? ( virtual/jpeg:=[static-libs(+)] )
905 lzo? ( dev-libs/lzo:2[static-libs(+)] )
906 - ncurses? ( sys-libs/ncurses[static-libs(+)] )
907 + ncurses? ( sys-libs/ncurses:0=[static-libs(+)] )
908 nfs? ( >=net-fs/libnfs-1.9.3[static-libs(+)] )
909 numa? ( sys-process/numactl[static-libs(+)] )
910 + opengl? (
911 + virtual/opengl
912 + media-libs/libepoxy[static-libs(+)]
913 + media-libs/mesa[static-libs(+)]
914 + media-libs/mesa[egl,gles2]
915 + )
916 png? ( media-libs/libpng:0=[static-libs(+)] )
917 + pulseaudio? ( media-sound/pulseaudio )
918 rbd? ( sys-cluster/ceph[static-libs(+)] )
919 sasl? ( dev-libs/cyrus-sasl[static-libs(+)] )
920 - sdl? ( >=media-libs/libsdl-1.2.11[static-libs(+)] )
921 + sdl? (
922 + !sdl2? (
923 + media-libs/libsdl[X]
924 + >=media-libs/libsdl-1.2.11[static-libs(+)]
925 + )
926 + sdl2? (
927 + media-libs/libsdl2[X]
928 + media-libs/libsdl2[static-libs(+)]
929 + )
930 + )
931 seccomp? ( >=sys-libs/libseccomp-2.1.0[static-libs(+)] )
932 + smartcard? ( >=app-emulation/libcacard-2.5.0[static-libs(+)] )
933 snappy? ( app-arch/snappy[static-libs(+)] )
934 - spice? ( >=app-emulation/spice-0.12.0[static-libs(+)] )
935 + spice? (
936 + >=app-emulation/spice-protocol-0.12.3
937 + >=app-emulation/spice-0.12.0[static-libs(+)]
938 + )
939 ssh? ( >=net-libs/libssh2-1.2.8[static-libs(+)] )
940 - tls? ( net-libs/gnutls[static-libs(+)] )
941 - usb? ( >=dev-libs/libusb-1.0.18[static-libs(+)] )
942 + usb? ( >=virtual/libusb-1-r2[static-libs(+)] )
943 + usbredir? ( >=sys-apps/usbredir-0.6[static-libs(+)] )
944 uuid? ( >=sys-apps/util-linux-2.16.0[static-libs(+)] )
945 vde? ( net-misc/vde[static-libs(+)] )
946 + virgl? ( media-libs/virglrenderer[static-libs(+)] )
947 + virtfs? ( sys-libs/libcap )
948 xfs? ( sys-fs/xfsprogs[static-libs(+)] )"
949 USER_LIB_DEPEND="${COMMON_LIB_DEPEND}"
950 X86_FIRMWARE_DEPEND="
951 >=sys-firmware/ipxe-1.0.0_p20130624
952 pin-upstream-blobs? (
953 - ~sys-firmware/seabios-1.7.5
954 + ~sys-firmware/seabios-1.8.2
955 ~sys-firmware/sgabios-0.1_pre8
956 ~sys-firmware/vgabios-0.7a
957 )
958 @@ -108,28 +150,14 @@ X86_FIRMWARE_DEPEND="
959 sys-firmware/sgabios
960 sys-firmware/vgabios
961 )"
962 -CDEPEND="!static-softmmu? ( ${SOFTMMU_LIB_DEPEND//\[static-libs(+)]} )
963 - !static-user? ( ${USER_LIB_DEPEND//\[static-libs(+)]} )
964 +CDEPEND="
965 + !static-softmmu? ( $(printf "%s? ( ${SOFTMMU_LIB_DEPEND//\[static-libs(+)]} ) " ${use_softmmu_targets}) )
966 + !static-user? ( $(printf "%s? ( ${USER_LIB_DEPEND//\[static-libs(+)]} ) " ${use_user_targets}) )
967 qemu_softmmu_targets_i386? ( ${X86_FIRMWARE_DEPEND} )
968 qemu_softmmu_targets_x86_64? ( ${X86_FIRMWARE_DEPEND} )
969 - accessibility? ( app-accessibility/brltty )
970 - alsa? ( >=media-libs/alsa-lib-1.0.13 )
971 - bluetooth? ( net-wireless/bluez )
972 - gtk? (
973 - x11-libs/gtk+:3
974 - x11-libs/vte:2.90
975 - )
976 - iscsi? ( net-libs/libiscsi )
977 - opengl? ( virtual/opengl )
978 - pulseaudio? ( media-sound/pulseaudio )
979 python? ( ${PYTHON_DEPS} )
980 - sdl? ( media-libs/libsdl[X] )
981 - smartcard? ( dev-libs/nss !app-emulation/libcacard )
982 - spice? ( >=app-emulation/spice-protocol-0.12.3 )
983 systemtap? ( dev-util/systemtap )
984 - usbredir? ( >=sys-apps/usbredir-0.6 )
985 - virtfs? ( sys-libs/libcap )
986 - xen? ( app-emulation/xen-tools )"
987 + xen? ( app-emulation/xen-tools:= )"
988 DEPEND="${CDEPEND}
989 dev-lang/perl
990 =dev-lang/python-2*
991 @@ -137,8 +165,8 @@ DEPEND="${CDEPEND}
992 virtual/pkgconfig
993 kernel_linux? ( >=sys-kernel/linux-headers-2.6.35 )
994 gtk? ( nls? ( sys-devel/gettext ) )
995 - static-softmmu? ( ${SOFTMMU_LIB_DEPEND} )
996 - static-user? ( ${USER_LIB_DEPEND} )
997 + static-softmmu? ( $(printf "%s? ( ${SOFTMMU_LIB_DEPEND} ) " ${use_softmmu_targets}) )
998 + static-user? ( $(printf "%s? ( ${USER_LIB_DEPEND} ) " ${use_user_targets}) )
999 test? (
1000 dev-libs/glib[utils]
1001 sys-devel/bc
1002 @@ -245,10 +273,32 @@ pkg_pretend() {
1003
1004 pkg_setup() {
1005 enewgroup kvm 78
1006 - python_setup
1007 +}
1008 +
1009 +# Sanity check to make sure target lists are kept up-to-date.
1010 +check_targets() {
1011 + local var=$1 mak=$2
1012 + local detected sorted
1013 +
1014 + pushd "${S}"/default-configs >/dev/null || die
1015 +
1016 + # Force C locale until glibc is updated. #564936
1017 + detected=$(echo $(printf '%s\n' *-${mak}.mak | sed "s:-${mak}.mak::" | LC_COLLATE=C sort -u))
1018 + sorted=$(echo $(printf '%s\n' ${!var} | LC_COLLATE=C sort -u))
1019 + if [[ ${sorted} != "${detected}" ]] ; then
1020 + eerror "The ebuild needs to be kept in sync."
1021 + eerror "${var}: ${sorted}"
1022 + eerror "$(printf '%-*s' ${#var} configure): ${detected}"
1023 + die "sync ${var} to the list of targets"
1024 + fi
1025 +
1026 + popd >/dev/null
1027 }
1028
1029 src_prepare() {
1030 + check_targets IUSE_SOFTMMU_TARGETS softmmu
1031 + check_targets IUSE_USER_TARGETS linux-user
1032 +
1033 # Alter target makefiles to accept CFLAGS set via flag-o
1034 sed -i -r \
1035 -e 's/^(C|OP_C|HELPER_C)FLAGS=/\1FLAGS+=/' \
1036 @@ -257,20 +307,22 @@ src_prepare() {
1037 # Cheap hack to disable gettext .mo generation.
1038 use nls || rm -f po/*.po
1039
1040 - epatch "${FILESDIR}"/qemu-1.7.0-cflags.patch
1041 - epatch "${FILESDIR}"/${P}-CVE-2015-1779-1.patch #544328
1042 - epatch "${FILESDIR}"/${P}-CVE-2015-1779-2.patch #544328
1043 - epatch "${FILESDIR}"/${PN}-2.3.0-CVE-2015-3456.patch #549404
1044 -
1045 # Patching for musl
1046 epatch "${FILESDIR}"/${PN}-2.0.0-F_SHLCK-and-F_EXLCK.patch
1047 epatch "${FILESDIR}"/${PN}-2.0.0-linux-user-signal.c-define-__SIGRTMIN-MAX-for-non-GN.patch
1048 epatch "${FILESDIR}"/${PN}-2.2.0-_sigev_un.patch
1049
1050 + epatch "${FILESDIR}"/qemu-2.5.0-cflags.patch
1051 [[ -n ${BACKPORTS} ]] && \
1052 EPATCH_FORCE=yes EPATCH_SUFFIX="patch" EPATCH_SOURCE="${S}/patches" \
1053 epatch
1054
1055 + epatch "${FILESDIR}"/${P}-CVE-2015-8567.patch #567868
1056 + epatch "${FILESDIR}"/${P}-CVE-2015-8558.patch #568246
1057 + epatch "${FILESDIR}"/${P}-CVE-2015-8701.patch #570110
1058 + epatch "${FILESDIR}"/${P}-CVE-2015-8743.patch #570988
1059 + epatch "${FILESDIR}"/${P}-CVE-2016-1568.patch #571566
1060 +
1061 # Fix ld and objcopy being called directly
1062 tc-export AR LD OBJCOPY
1063
1064 @@ -288,14 +340,10 @@ qemu_src_configure() {
1065 debug-print-function ${FUNCNAME} "$@"
1066
1067 local buildtype=$1
1068 - local builddir=$2
1069 + local builddir="${S}/${buildtype}-build"
1070 local static_flag="static-${buildtype}"
1071
1072 - # audio options
1073 - local audio_opts="oss"
1074 - use alsa && audio_opts="alsa,${audio_opts}"
1075 - use sdl && audio_opts="sdl,${audio_opts}"
1076 - use pulseaudio && audio_opts="pa,${audio_opts}"
1077 + mkdir "${builddir}"
1078
1079 local conf_opts=(
1080 --prefix=/usr
1081 @@ -306,6 +354,11 @@ qemu_src_configure() {
1082 --disable-guest-agent
1083 --disable-strip
1084 --disable-werror
1085 + # We support gnutls/nettle for crypto operations. It is possible
1086 + # to use gcrypt when gnutls/nettle are disabled (but not when they
1087 + # are enabled), but it's not really worth the hassle. Disable it
1088 + # all the time to avoid automatically detecting it. #568856
1089 + --disable-gcrypt
1090 --python="${PYTHON}"
1091 --cc="$(tc-getCC)"
1092 --cxx="$(tc-getCXX)"
1093 @@ -334,6 +387,8 @@ qemu_src_configure() {
1094 $(conf_softmmu curl)
1095 $(conf_softmmu fdt)
1096 $(conf_softmmu glusterfs)
1097 + $(conf_softmmu gnutls)
1098 + $(conf_softmmu gnutls nettle)
1099 $(conf_softmmu gtk)
1100 $(conf_softmmu infiniband rdma)
1101 $(conf_softmmu iscsi libiscsi)
1102 @@ -343,26 +398,25 @@ qemu_src_configure() {
1103 $(conf_softmmu ncurses curses)
1104 $(conf_softmmu nfs libnfs)
1105 $(conf_softmmu numa)
1106 - $(conf_softmmu opengl glx)
1107 + $(conf_softmmu opengl)
1108 $(conf_softmmu png vnc-png)
1109 $(conf_softmmu rbd)
1110 $(conf_softmmu sasl vnc-sasl)
1111 $(conf_softmmu sdl)
1112 $(conf_softmmu seccomp)
1113 - $(conf_softmmu smartcard smartcard-nss)
1114 + $(conf_softmmu smartcard)
1115 $(conf_softmmu snappy)
1116 $(conf_softmmu spice)
1117 $(conf_softmmu ssh libssh2)
1118 - $(conf_softmmu tls quorum)
1119 - $(conf_softmmu tls vnc-tls)
1120 - $(conf_softmmu tls vnc-ws)
1121 $(conf_softmmu usb libusb)
1122 $(conf_softmmu usbredir usb-redir)
1123 $(conf_softmmu uuid)
1124 $(conf_softmmu vde)
1125 $(conf_softmmu vhost-net)
1126 + $(conf_softmmu virgl virglrenderer)
1127 $(conf_softmmu virtfs)
1128 $(conf_softmmu vnc)
1129 + $(conf_softmmu vte)
1130 $(conf_softmmu xen)
1131 $(conf_softmmu xen xen-pci-passthrough)
1132 $(conf_softmmu xfs xfsctl)
1133 @@ -373,23 +427,39 @@ qemu_src_configure() {
1134 conf_opts+=(
1135 --enable-linux-user
1136 --disable-system
1137 - --target-list="${user_targets}"
1138 --disable-blobs
1139 --disable-tools
1140 )
1141 ;;
1142 softmmu)
1143 + # audio options
1144 + local audio_opts="oss"
1145 + use alsa && audio_opts="alsa,${audio_opts}"
1146 + use sdl && audio_opts="sdl,${audio_opts}"
1147 + use pulseaudio && audio_opts="pa,${audio_opts}"
1148 +
1149 conf_opts+=(
1150 --disable-linux-user
1151 --enable-system
1152 - --target-list="${softmmu_targets}"
1153 --with-system-pixman
1154 --audio-drv-list="${audio_opts}"
1155 )
1156 - use gtk && conf_opts+=( --with-gtkabi=3.0 )
1157 + use gtk && conf_opts+=( --with-gtkabi=$(usex gtk2 2.0 3.0) )
1158 + use sdl && conf_opts+=( --with-sdlabi=$(usex sdl2 2.0 1.2) )
1159 + ;;
1160 + tools)
1161 + conf_opts+=(
1162 + --disable-linux-user
1163 + --disable-system
1164 + --disable-blobs
1165 + )
1166 + static_flag="static"
1167 ;;
1168 esac
1169
1170 + local targets="${buildtype}_targets"
1171 + [[ -n ${targets} ]] && conf_opts+=( --target-list="${!targets}" )
1172 +
1173 # Add support for SystemTAP
1174 use systemtap && conf_opts+=( --enable-trace-backend=dtrace )
1175
1176 @@ -402,7 +472,7 @@ qemu_src_configure() {
1177 gcc-specs-pie && conf_opts+=( --enable-pie )
1178 fi
1179
1180 - einfo "../configure ${conf_opts[*]}"
1181 + echo "../configure ${conf_opts[*]}"
1182 cd "${builddir}"
1183 ../configure "${conf_opts[@]}" || die "configure failed"
1184
1185 @@ -415,7 +485,7 @@ qemu_src_configure() {
1186 src_configure() {
1187 local target
1188
1189 - python_export_best
1190 + python_setup
1191
1192 softmmu_targets= softmmu_bins=()
1193 user_targets= user_bins=()
1194 @@ -434,21 +504,12 @@ src_configure() {
1195 fi
1196 done
1197
1198 - [[ -n ${softmmu_targets} ]] && \
1199 - einfo "Building the following softmmu targets: ${softmmu_targets}"
1200 -
1201 - [[ -n ${user_targets} ]] && \
1202 - einfo "Building the following user targets: ${user_targets}"
1203 -
1204 - if [[ -n ${softmmu_targets} ]]; then
1205 - mkdir "${S}/softmmu-build"
1206 - qemu_src_configure "softmmu" "${S}/softmmu-build"
1207 - fi
1208 + softmmu_targets=${softmmu_targets#,}
1209 + user_targets=${user_targets#,}
1210
1211 - if [[ -n ${user_targets} ]]; then
1212 - mkdir "${S}/user-build"
1213 - qemu_src_configure "user" "${S}/user-build"
1214 - fi
1215 + [[ -n ${softmmu_targets} ]] && qemu_src_configure "softmmu"
1216 + [[ -n ${user_targets} ]] && qemu_src_configure "user"
1217 + [[ -z ${softmmu_targets}${user_targets} ]] && qemu_src_configure "tools"
1218 }
1219
1220 src_compile() {
1221 @@ -461,6 +522,11 @@ src_compile() {
1222 cd "${S}/softmmu-build"
1223 default
1224 fi
1225 +
1226 + if [[ -z ${softmmu_targets}${user_targets} ]]; then
1227 + cd "${S}/tools-build"
1228 + default
1229 + fi
1230 }
1231
1232 src_test() {
1233 @@ -506,6 +572,11 @@ src_install() {
1234 fi
1235 fi
1236
1237 + if [[ -z ${softmmu_targets}${user_targets} ]]; then
1238 + cd "${S}/tools-build"
1239 + emake DESTDIR="${ED}" install
1240 + fi
1241 +
1242 # Disable mprotect on the qemu binaries as they use JITs to be fast #459348
1243 pushd "${ED}"/usr/bin >/dev/null
1244 pax-mark m "${softmmu_bins[@]}" "${user_bins[@]}"
1245 @@ -516,21 +587,21 @@ src_install() {
1246 doins "${FILESDIR}/bridge.conf"
1247
1248 # Remove the docdir placed qmp-commands.txt
1249 - mv "${ED}/usr/share/doc/${PF}/html/qmp-commands.txt" "${S}/docs/qmp/"
1250 + mv "${ED}/usr/share/doc/${PF}/html/qmp-commands.txt" "${S}/docs/" || die
1251
1252 cd "${S}"
1253 dodoc Changelog MAINTAINERS docs/specs/pci-ids.txt
1254 newdoc pc-bios/README README.pc-bios
1255 - dodoc docs/qmp/*.txt
1256 + dodoc docs/qmp-*.txt
1257
1258 - # Remove SeaBIOS since we're using the SeaBIOS packaged one
1259 - rm "${ED}/usr/share/qemu/bios.bin"
1260 - if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
1261 - dosym ../seabios/bios.bin /usr/share/qemu/bios.bin
1262 - fi
1263 -
1264 - # Remove vgabios since we're using the vgabios packaged one
1265 if [[ -n ${softmmu_targets} ]]; then
1266 + # Remove SeaBIOS since we're using the SeaBIOS packaged one
1267 + rm "${ED}/usr/share/qemu/bios.bin"
1268 + if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
1269 + dosym ../seabios/bios.bin /usr/share/qemu/bios.bin
1270 + fi
1271 +
1272 + # Remove vgabios since we're using the vgabios packaged one
1273 rm "${ED}/usr/share/qemu/vgabios.bin"
1274 rm "${ED}/usr/share/qemu/vgabios-cirrus.bin"
1275 rm "${ED}/usr/share/qemu/vgabios-qxl.bin"
1276 @@ -568,21 +639,6 @@ src_install() {
1277 pkg_postinst() {
1278 if qemu_support_kvm; then
1279 readme.gentoo_print_elog
1280 - ewarn "Migration from qemu-kvm instances and loading qemu-kvm created"
1281 - ewarn "save states has been removed starting with the 1.6.2 release"
1282 - ewarn
1283 - ewarn "It is recommended that you migrate any VMs that may be running"
1284 - ewarn "on qemu-kvm to a host with a newer qemu and regenerate"
1285 - ewarn "any saved states with a newer qemu."
1286 - ewarn
1287 - ewarn "qemu-kvm was the primary qemu provider in Gentoo through 1.2.x"
1288 -
1289 - if use x86 || use amd64; then
1290 - ewarn
1291 - ewarn "The /usr/bin/kvm and /usr/bin/qemu-kvm wrappers are no longer"
1292 - ewarn "installed. In order to use kvm acceleration, pass the flag"
1293 - ewarn "-enable-kvm when running your system target."
1294 - fi
1295 fi
1296
1297 if [[ -n ${softmmu_targets} ]] && use kernel_linux; then
1298 @@ -590,10 +646,6 @@ pkg_postinst() {
1299 fi
1300
1301 fcaps cap_net_admin /usr/libexec/qemu-bridge-helper
1302 - if use virtfs && [ -n "${softmmu_targets}" ]; then
1303 - local virtfs_caps="cap_chown,cap_dac_override,cap_fowner,cap_fsetid,cap_setgid,cap_mknod,cap_setuid"
1304 - fcaps ${virtfs_caps} /usr/bin/virtfs-proxy-helper
1305 - fi
1306 }
1307
1308 pkg_info() {
1309 @@ -601,7 +653,7 @@ pkg_info() {
1310 echo " $(best_version app-emulation/spice-protocol)"
1311 echo " $(best_version sys-firmware/ipxe)"
1312 echo " $(best_version sys-firmware/seabios)"
1313 - if has_version sys-firmware/seabios[binary]; then
1314 + if has_version 'sys-firmware/seabios[binary]'; then
1315 echo " USE=binary"
1316 else
1317 echo " USE=''"
1318 --
1319 2.4.10