qemu: 4.2.0 -> 5.0.0

authored by

Scott Worley and committed by
Milan
f2406c60 760aa782

+27 -49
+5 -41
pkgs/applications/virtualization/qemu/default.nix
··· 35 35 in 36 36 37 37 stdenv.mkDerivation rec { 38 - version = "4.2.0"; 38 + version = "5.0.0"; 39 39 pname = "qemu" 40 40 + stdenv.lib.optionalString xenSupport "-xen" 41 41 + stdenv.lib.optionalString hostCpuOnly "-host-cpu-only" 42 42 + stdenv.lib.optionalString nixosTestRunner "-for-vm-tests"; 43 43 44 44 src = fetchurl { 45 - url = "https://wiki.qemu.org/download/qemu-${version}.tar.bz2"; 46 - sha256 = "1gczv8hn3wqci86css3mhzrppp3z8vppxw25l08j589k6bvz7x1w"; 45 + url= "https://download.qemu.org/qemu-${version}.tar.xz"; 46 + sha256 = "1dlcwyshdp94fwd30pddxf9bn2q8dfw5jsvry2gvdj551wmaj4rg"; 47 47 }; 48 48 49 49 nativeBuildInputs = [ python python.pkgs.sphinx pkgconfig flex bison ]; ··· 77 77 ./no-etc-install.patch 78 78 ./fix-qemu-ga.patch 79 79 ./9p-ignore-noatime.patch 80 - (fetchpatch { 81 - name = "CVE-2019-15890.patch"; 82 - url = "https://git.qemu.org/?p=libslirp.git;a=patch;h=c59279437eda91841b9d26079c70b8a540d41204"; 83 - sha256 = "1q2rc67mfdz034mk81z9bw105x9zad7n954sy3kq068b1svrf7iy"; 84 - stripLen = 1; 85 - extraPrefix = "slirp/"; 86 - }) 87 - # patches listed at: https://nvd.nist.gov/vuln/detail/CVE-2020-7039 88 - (fetchpatch { 89 - name = "CVE-2020-7039-1.patch"; 90 - url = "https://git.qemu.org/?p=libslirp.git;a=patch;h=2655fffed7a9e765bcb4701dd876e9dab975f289"; 91 - sha256 = "1jh0k3lg3553c2x1kq1kl3967jabhba5gm584wjpmr5mjqk3lnz1"; 92 - stripLen = 1; 93 - extraPrefix = "slirp/"; 94 - excludes = ["slirp/CHANGELOG.md"]; 95 - }) 96 - (fetchpatch { 97 - name = "CVE-2020-7039-2.patch"; 98 - url = "https://git.qemu.org/?p=libslirp.git;a=patch;h=82ebe9c370a0e2970fb5695aa19aa5214a6a1c80"; 99 - sha256 = "08ccxcmrhzknnzd1a1q2brszv3a7h02n26r73kpli10b0hn12r2l"; 100 - stripLen = 1; 101 - extraPrefix = "slirp/"; 102 - }) 103 - (fetchpatch { 104 - name = "CVE-2020-7039-3.patch"; 105 - url = "https://git.qemu.org/?p=libslirp.git;a=patch;h=ce131029d6d4a405cb7d3ac6716d03e58fb4a5d9"; 106 - sha256 = "18ypj9an2jmsmdn58853rbz42r10587h7cz5fdws2x4635778ibd"; 107 - stripLen = 1; 108 - extraPrefix = "slirp/"; 109 - }) 110 - # patches listed at: https://nvd.nist.gov/vuln/detail/CVE-2020-7211 111 - (fetchpatch { 112 - name = "CVE-2020-7211.patch"; 113 - url = "https://git.qemu.org/?p=libslirp.git;a=patch;h=14ec36e107a8c9af7d0a80c3571fe39b291ff1d4"; 114 - sha256 = "1lc8zabqs580iqrsr5k7zwgkx6qjmja7apwfbc36lkvnrxwfzmrc"; 115 - stripLen = 1; 116 - extraPrefix = "slirp/"; 117 - }) 118 80 ] ++ optional nixosTestRunner ./force-uid0-on-9p.patch 119 81 ++ optionals stdenv.hostPlatform.isMusl [ 120 82 (fetchpatch { ··· 145 107 "--sysconfdir=/etc" 146 108 "--localstatedir=/var" 147 109 "--enable-docs" 110 + "--enable-tools" 111 + "--enable-guest-agent" 148 112 ] 149 113 # disable sysctl check on darwin. 150 114 ++ optional stdenv.isDarwin "--cpu=x86_64"
+22 -8
pkgs/applications/virtualization/qemu/fix-qemu-ga.patch
··· 1 - diff --git a/qga/commands-posix.c b/qga/commands-posix.c 2 - index 0dc219d..9d020d3 100644 1 + diff -Naur a/qga/commands-posix.c b/qga/commands-posix.c 3 2 --- a/qga/commands-posix.c 4 3 +++ b/qga/commands-posix.c 5 - @@ -102,6 +102,8 @@ void qmp_guest_shutdown(bool has_mode, const char *mode, Error **errp) 4 + @@ -109,6 +109,8 @@ 6 5 reopen_fd_to_null(1); 7 6 reopen_fd_to_null(2); 8 - 7 + 9 8 + execle("/run/current-system/sw/bin/shutdown", "shutdown", "-h", shutdown_flag, "+0", 10 9 + "hypervisor initiated shutdown", (char*)NULL, environ); 11 10 execle("/sbin/shutdown", "shutdown", "-h", shutdown_flag, "+0", 12 11 "hypervisor initiated shutdown", (char*)NULL, environ); 13 12 _exit(EXIT_FAILURE); 14 - @@ -189,6 +191,8 @@ void qmp_guest_set_time(bool has_time, int64_t time_ns, Error **errp) 15 - 13 + @@ -157,11 +159,13 @@ 14 + pid_t pid; 15 + Error *local_err = NULL; 16 + struct timeval tv; 17 + + static const char hwclock_path_nix[] = "/run/current-system/sw/bin/hwclock"; 18 + static const char hwclock_path[] = "/sbin/hwclock"; 19 + static int hwclock_available = -1; 20 + 21 + if (hwclock_available < 0) { 22 + - hwclock_available = (access(hwclock_path, X_OK) == 0); 23 + + hwclock_available = (access(hwclock_path_nix, X_OK) == 0) || 24 + + (access(hwclock_path, X_OK) == 0); 25 + } 26 + 27 + if (!hwclock_available) { 28 + @@ -207,6 +211,8 @@ 29 + 16 30 /* Use '/sbin/hwclock -w' to set RTC from the system time, 17 31 * or '/sbin/hwclock -s' to set the system time from RTC. */ 18 - + execle("/run/current-system/sw/bin/hwclock", "hwclock", has_time ? "-w" : "-s", 32 + + execle(hwclock_path_nix, "hwclock", has_time ? "-w" : "-s", 19 33 + NULL, environ); 20 - execle("/sbin/hwclock", "hwclock", has_time ? "-w" : "-s", 34 + execle(hwclock_path, "hwclock", has_time ? "-w" : "-s", 21 35 NULL, environ); 22 36 _exit(EXIT_FAILURE);