kvm: x86: Fix initial kvm_has_msr_star

KVM_GET_MSR_INDEX_LIST returns -E2BIG when the provided space is too
small for all MSRs. But this is precisely the error we trigger with the
initial request in order to obtain that size. Do not fail in that case.

This caused a subtle corruption of the guest state as MSR_STAR was not
properly saved/restored. The corruption became visible with latest kvm
optimizing the MSR updates.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
1 file changed
tree: cb4ce6d604e999c1b538fd9f2f031a01831f4ea7
  1. audio/
  2. block/
  3. bsd-user/
  4. darwin-user/
  5. default-configs/
  6. fpu/
  7. gdb-xml/
  8. hw/
  9. linux-user/
  10. net/
  11. pc-bios/
  12. QMP/
  13. roms/
  14. slirp/
  15. target-alpha/
  16. target-arm/
  17. target-cris/
  18. target-i386/
  19. target-m68k/
  20. target-microblaze/
  21. target-mips/
  22. target-ppc/
  23. target-s390x/
  24. target-sh4/
  25. target-sparc/
  26. tcg/
  27. tests/
  28. .gitignore
  29. .gitmodules
  30. a.out.h
  31. acl.c
  32. acl.h
  33. aes.c
  34. aes.h
  35. aio.c
  36. alpha-dis.c
  37. alpha.ld
  38. arm-dis.c
  39. arm-semi.c
  40. arm.ld
  41. async.c
  42. balloon.h
  43. block-migration.c
  44. block-migration.h
  45. block.c
  46. block.h
  47. block_int.h
  48. bswap.h
  49. bt-host.c
  50. bt-host.h
  51. bt-vhci.c
  52. buffered_file.c
  53. buffered_file.h
  54. cache-utils.c
  55. cache-utils.h
  56. Changelog
  57. check-qdict.c
  58. check-qfloat.c
  59. check-qint.c
  60. check-qjson.c
  61. check-qlist.c
  62. check-qstring.c
  63. cmd.c
  64. cmd.h
  65. cocoa.m
  66. CODING_STYLE
  67. config.h
  68. configure
  69. console.c
  70. console.h
  71. COPYING
  72. COPYING.LIB
  73. cpu-all.h
  74. cpu-common.h
  75. cpu-defs.h
  76. cpu-exec.c
  77. create_config
  78. cris-dis.c
  79. curses.c
  80. curses_keys.h
  81. cutils.c
  82. d3des.c
  83. d3des.h
  84. def-helper.h
  85. device_tree.c
  86. device_tree.h
  87. dis-asm.h
  88. disas.c
  89. disas.h
  90. dma-helpers.c
  91. dma.h
  92. dyngen-exec.h
  93. elf.h
  94. envlist.c
  95. envlist.h
  96. exec-all.h
  97. exec.c
  98. feature_to_c.sh
  99. gdbstub.c
  100. gdbstub.h
  101. gen-icount.h
  102. host-utils.c
  103. host-utils.h
  104. hostregs_helper.h
  105. hpet.h
  106. hppa-dis.c
  107. hppa.ld
  108. hxtool
  109. i386-dis.c
  110. i386.ld
  111. ia64.ld
  112. ioport-user.c
  113. ioport.c
  114. ioport.h
  115. json-lexer.c
  116. json-lexer.h
  117. json-parser.c
  118. json-parser.h
  119. json-streamer.c
  120. json-streamer.h
  121. keymaps.c
  122. keymaps.h
  123. kvm-all.c
  124. kvm.h
  125. libfdt_env.h
  126. LICENSE
  127. linux-aio.c
  128. m68k-dis.c
  129. m68k-semi.c
  130. m68k.ld
  131. MAINTAINERS
  132. Makefile
  133. Makefile.hw
  134. Makefile.target
  135. Makefile.user
  136. microblaze-dis.c
  137. migration-exec.c
  138. migration-fd.c
  139. migration-tcp.c
  140. migration-unix.c
  141. migration.c
  142. migration.h
  143. mips-dis.c
  144. mips.ld
  145. module.c
  146. module.h
  147. monitor.c
  148. monitor.h
  149. nbd.c
  150. nbd.h
  151. net-checksum.c
  152. net.c
  153. net.h
  154. osdep.c
  155. osdep.h
  156. path.c
  157. pci-ids.txt
  158. posix-aio-compat.c
  159. ppc-dis.c
  160. ppc.ld
  161. ppc64.ld
  162. qbool.c
  163. qbool.h
  164. qdict-test-data.txt
  165. qdict.c
  166. qdict.h
  167. qemu-aio.h
  168. qemu-binfmt-conf.sh
  169. qemu-char.c
  170. qemu-char.h
  171. qemu-common.h
  172. qemu-config.c
  173. qemu-config.h
  174. qemu-doc.texi
  175. qemu-img-cmds.hx
  176. qemu-img.c
  177. qemu-img.texi
  178. qemu-io.c
  179. qemu-lock.h
  180. qemu-log.h
  181. qemu-malloc.c
  182. qemu-monitor.hx
  183. qemu-nbd.c
  184. qemu-nbd.texi
  185. qemu-option.c
  186. qemu-option.h
  187. qemu-options.hx
  188. qemu-queue.h
  189. qemu-sockets.c
  190. qemu-tech.texi
  191. qemu-thread.c
  192. qemu-thread.h
  193. qemu-timer.h
  194. qemu-tool.c
  195. qemu.sasl
  196. qemu_socket.h
  197. qerror.c
  198. qerror.h
  199. qfloat.c
  200. qfloat.h
  201. qint.c
  202. qint.h
  203. qjson.c
  204. qjson.h
  205. qlist.c
  206. qlist.h
  207. qobject.h
  208. qstring.c
  209. qstring.h
  210. readline.c
  211. readline.h
  212. README
  213. rules.mak
  214. s390-dis.c
  215. s390.ld
  216. savevm.c
  217. sdl.c
  218. sdl_keysym.h
  219. sdl_zoom.c
  220. sdl_zoom.h
  221. sdl_zoom_template.h
  222. sh4-dis.c
  223. softmmu-semi.h
  224. softmmu_defs.h
  225. softmmu_exec.h
  226. softmmu_header.h
  227. softmmu_template.h
  228. sparc-dis.c
  229. sparc.ld
  230. sparc64.ld
  231. sysemu.h
  232. targphys.h
  233. tcg-runtime.c
  234. texi2pod.pl
  235. thunk.c
  236. thunk.h
  237. TODO
  238. translate-all.c
  239. uboot_image.h
  240. usb-bsd.c
  241. usb-linux.c
  242. usb-stub.c
  243. VERSION
  244. vgafont.h
  245. vl.c
  246. vnc-auth-sasl.c
  247. vnc-auth-sasl.h
  248. vnc-auth-vencrypt.c
  249. vnc-auth-vencrypt.h
  250. vnc-tls.c
  251. vnc-tls.h
  252. vnc.c
  253. vnc.h
  254. vnc_keysym.h
  255. vnchextile.h
  256. x86_64.ld
  257. x_keymap.c
  258. x_keymap.h