Merge ~paelzer/ubuntu/+source/qemu:bug-1847361-miss-old-so-on-upgrade-SRU-BIONIC into ubuntu/+source/qemu:ubuntu/bionic-devel

Proposed by Christian Ehrhardt 
Status: Merged
Approved by: Christian Ehrhardt 
Approved revision: 161a7736f5f1a7747534b115057d22125c193f52
Merge reported by: Christian Ehrhardt 
Merged at revision: 161a7736f5f1a7747534b115057d22125c193f52
Proposed branch: ~paelzer/ubuntu/+source/qemu:bug-1847361-miss-old-so-on-upgrade-SRU-BIONIC
Merge into: ubuntu/+source/qemu:ubuntu/bionic-devel
Diff against target: 317 lines (+244/-1)
7 files modified
debian/changelog (+11/-0)
debian/patches/series (+1/-0)
debian/patches/ubuntu/lp-1847361-modules-load-upgrade.patch (+133/-0)
debian/qemu-block-extra.postrm.in (+43/-0)
debian/qemu-block-extra.prerm.in (+45/-0)
debian/rules (+11/-0)
dev/null (+0/-1)
Reviewer Review Type Date Requested Status
Rafael David Tinoco (community) Approve
Canonical Server Pending
Review via email: mp+381998@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

Marking these WIP until bug 1871830 is finished

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

Bug 1871830 fixed and the required change is in the planned SRUs as well.
libvirt didn't need a change so it actually stayed as-is.

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

SRU Template added, ready for review.

Revision history for this message
Rafael David Tinoco (rafaeldtinoco) wrote :

+1. Everything looks good.

review: Approve
Revision history for this message
Rafael David Tinoco (rafaeldtinoco) wrote :

No no no I did +1 by accident on this one, will review it..

review: Needs Information
Revision history for this message
Rafael David Tinoco (rafaeldtinoco) wrote :

# checklist for fixes
----------------------------
 [.] changelog entry correct:
 [.] targeted to correct codename
 [.] version number is correct
 [.] update-maintainer has been run before
 ----
 [.] changes forwarded upstream/debian (if appropriate)
 [.] patches match what was proposed upstream
 ----
 [.] patches correctly included in debian/patches/series?
 [.] patches have correct DEP3 metadata
 ----
 [-] relying on PPA only for build check ?
 [-] if relying on PPA, did it install correctly ?
 ----
 [-] building it locally ?
 [-] if building locally, was source build good ?
 [-] if building locally, was binary build good ?
 ----
 [-] was autopkgtest tested ?
 [.] relying on committer tests ?
 ----
 [.] is this a SRU ?
 [.] if a SRU, does the public bug have a template ?
 [-] is this a bundle of fixes ?
 [.] is this a single fix ?
 ----
 [-] if single fix, was testcase provided ?
 [-] if single fix, and testcase provided, could I reproduce it ?
 [-] if single fix, and testcase provided, did it work ?
 [.] relying on committer verification ?
----------------------------
 [.] = ok
 [x] = not ok
 [?] = question
 [!] = note
 [-] = n/a
----------------------------
# files touched:

 /debian/patches/ubuntu/lp-1847361-modules-load-upgrade.patch | 125 (trunc)
 b/debian/changelog | 11 ++++++
 b/debian/patches/series | 1
 b/debian/patches/ubuntu/lp-1847361-modules-load-upgrade.patch | 7 +++-
 b/debian/qemu-block-extra.postrm.in | 43 +++++++++
 b/debian/qemu-block-extra.prerm.in | 45 +++++++++
 b/debian/rules | 1
 debian/patches/ubuntu/lp-1847361-modules-load-upgrade.patch | 49 (trunc)
 debian/rules | 10 +++++
 ui/keycodemapdb/..git | 1
 10 files changed, 268 insertions(+), 25 deletions(-)
----------------------------
# files check:

ubuntu/lp-1847361-modules-load-upgrade.patch -> ok
debian/qemu-block-extra.postrm.in -> already changed brrr
debian/qemu-block-extra.prerm.in -> ok
debian/rules -> ok
debian/patches/ubuntu/lp-1847361-modules-load-upgrade.patch -> ok

----------------------------
# comments:

all good -> +1.
----------------------------
# commits:

49352e8f93c fixup: remove mismatch between gt and src tarball
3dcbbb29a6a changelog: allow qemu to load old modules post upgrade (LP: #184736
c099ef1838f d/p/ubuntu/lp-1847361-modules-load-upgrade.patch: adapt context for
e5b66304e41 d/rules: enable --enable-module-upgrades where --enable-modules is
ce7e5322c27 d/rules: generate maintainer scripts matching package version
c8bdada6f54 d/qemu-block-extra.*.in: save shared objects on upgrade
ce8fcf051c7 d/p/ubuntu/lp-1847361-modules-load-upgrade.patch: allow qemu to loa
----------------------------

review: Approve
Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

Thanks, tags pushed and uploaded for SRU review

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/debian/changelog b/debian/changelog
index 3ee11c0..546008f 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,14 @@
1qemu (1:2.11+dfsg-1ubuntu7.24) bionic; urgency=medium
2
3 * allow qemu to load old modules post upgrade (LP: #1847361)
4 - d/p/ubuntu/lp-1847361-modules-load-upgrade.patch: to fallback module
5 load to a versioned path
6 - d/qemu-block-extra.*.in: save shared objects on upgrade
7 - d/rules: generate maintainer scripts matching package version on build
8 - d/rules: enable --enable-module-upgrades where --enable-modules is set
9
10 -- Christian Ehrhardt <christian.ehrhardt@canonical.com> Mon, 02 Mar 2020 15:21:27 +0100
11
1qemu (1:2.11+dfsg-1ubuntu7.23) bionic-security; urgency=medium12qemu (1:2.11+dfsg-1ubuntu7.23) bionic-security; urgency=medium
213
3 * SECURITY UPDATE: OOB heap access via unexpected iSCSI Server response14 * SECURITY UPDATE: OOB heap access via unexpected iSCSI Server response
diff --git a/debian/patches/series b/debian/patches/series
index 0364234..123bc83 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -142,3 +142,4 @@ CVE-2020-7039-2.patch
142CVE-2020-7039-3.patch142CVE-2020-7039-3.patch
143CVE-2020-8608-1.patch143CVE-2020-8608-1.patch
144CVE-2020-8608-2.patch144CVE-2020-8608-2.patch
145ubuntu/lp-1847361-modules-load-upgrade.patch
diff --git a/debian/patches/ubuntu/lp-1847361-modules-load-upgrade.patch b/debian/patches/ubuntu/lp-1847361-modules-load-upgrade.patch
145new file mode 100644146new file mode 100644
index 0000000..df9dbe0
--- /dev/null
+++ b/debian/patches/ubuntu/lp-1847361-modules-load-upgrade.patch
@@ -0,0 +1,133 @@
1From ab7e28b0905b1e2daeb5d582cf0f0ce33ea47317 Mon Sep 17 00:00:00 2001
2From: Christian Ehrhardt <christian.ehrhardt@canonical.com>
3Date: Mon, 2 Mar 2020 15:12:53 +0100
4Subject: [PATCH] modules: load modules from versioned /var/run dir
5
6On upgrades the old .so files usually are replaced. But on the other
7hand since a qemu process represents a guest instance it is usually kept
8around.
9
10That makes late addition of dynamic features e.g. 'hot-attach of a ceph
11disk' fail by trying to load a new version of e.f. block-rbd.so into an
12old still running qemu binary.
13
14This adds a fallback to also load modules from a versioned directory in the
15temporary /var/run path. That way qemu is providing a way for packaging
16to store modules of an upgraded qemu package as needed until the next reboot.
17
18Fixes: https://bugs.launchpad.net/ubuntu/+source/qemu/+bug/1847361
19Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
20
21Backport-Note: the context is a bit different and the assert a ==.
22Therefore adapt to the changed var name as well as adapting array size
23based on the config option.
24
25Origin, backport, https://git.qemu.org/?p=qemu.git;a=commit;h=267514b33ffa3f315adc26fc14d89f92e90840f5
26Origin, backport, https://git.qemu.org/?p=qemu.git;a=commit;h=bd83c861c0
27Bug-Ubuntu: https://bugs.launchpad.net/bugs/1847361
28Last-Update: 2020-03-02
29
30---
31 configure | 15 +++++++++++++++
32 util/module.c | 14 ++++++++++++++
33 2 files changed, 29 insertions(+)
34
35--- a/configure
36+++ b/configure
37@@ -340,6 +340,7 @@ EXESUF=""
38 DSOSUF=".so"
39 LDFLAGS_SHARED="-shared"
40 modules="no"
41+module_upgrades="no"
42 prefix="/usr/local"
43 mandir="\${prefix}/share/man"
44 datadir="\${prefix}/share"
45@@ -888,6 +889,10 @@ for opt do
46 --disable-modules)
47 modules="no"
48 ;;
49+ --disable-module-upgrades) module_upgrades="no"
50+ ;;
51+ --enable-module-upgrades) module_upgrades="yes"
52+ ;;
53 --cpu=*)
54 ;;
55 --target-list=*) target_list="$optarg"
56@@ -1495,6 +1500,7 @@ disabled with --disable-FEATURE, default
57 guest-agent-msi build guest agent Windows MSI installation package
58 pie Position Independent Executables
59 modules modules support
60+ module-upgrades try to load modules from alternate paths for upgrades
61 debug-tcg TCG debugging (default is disabled)
62 debug-info debugging information
63 sparse sparse checker
64@@ -1707,6 +1713,11 @@ if compile_prog "-Werror -fno-gcse" "" ;
65 TRANSLATE_OPT_CFLAGS=-fno-gcse
66 fi
67
68+# module_upgrades is only reasonable if modules are enabled
69+if test "$modules" = "no" && test "$module_upgrades" = "yes" ; then
70+ error_exit "Can't enable module-upgrades as Modules are not enabled"
71+fi
72+
73 if test "$static" = "yes" ; then
74 if test "$modules" = "yes" ; then
75 error_exit "static and modules are mutually incompatible"
76@@ -5440,6 +5451,7 @@ if test "$slirp" = "yes" ; then
77 echo "smbd $smbd"
78 fi
79 echo "module support $modules"
80+echo "alt path mod load $module_upgrades"
81 echo "host CPU $cpu"
82 echo "host big endian $bigendian"
83 echo "target list $target_list"
84@@ -5753,6 +5765,9 @@ if test "$modules" = "yes"; then
85 echo "CONFIG_STAMP=_$( (echo $qemu_version; echo $pkgversion; cat $0) | $shacmd - | cut -f1 -d\ )" >> $config_host_mak
86 echo "CONFIG_MODULES=y" >> $config_host_mak
87 fi
88+if test "$module_upgrades" = "yes"; then
89+ echo "CONFIG_MODULE_UPGRADES=y" >> $config_host_mak
90+fi
91 if test "$sdl" = "yes" ; then
92 echo "CONFIG_SDL=y" >> $config_host_mak
93 echo "CONFIG_SDLABI=$sdlabi" >> $config_host_mak
94--- a/util/module.c
95+++ b/util/module.c
96@@ -20,6 +20,9 @@
97 #endif
98 #include "qemu/queue.h"
99 #include "qemu/module.h"
100+#ifdef CONFIG_MODULE_UPGRADES
101+#include "qemu-version.h"
102+#endif
103
104 typedef struct ModuleEntry
105 {
106@@ -162,7 +165,12 @@ void module_load_one(const char *prefix,
107 #ifdef CONFIG_MODULES
108 char *fname = NULL;
109 char *exec_dir;
110+#ifdef CONFIG_MODULE_UPGRADES
111+ char *version_dir;
112+ char *dirs[4];
113+#else
114 char *dirs[3];
115+#endif
116 char *module_name;
117 int i = 0;
118 int ret;
119@@ -189,6 +197,14 @@ void module_load_one(const char *prefix,
120 dirs[i++] = g_strdup_printf("%s", CONFIG_QEMU_MODDIR);
121 dirs[i++] = g_strdup_printf("%s/..", exec_dir ? : "");
122 dirs[i++] = g_strdup_printf("%s", exec_dir ? : "");
123+
124+#ifdef CONFIG_MODULE_UPGRADES
125+ version_dir = g_strcanon(g_strdup(QEMU_PKGVERSION),
126+ G_CSET_A_2_Z G_CSET_a_2_z G_CSET_DIGITS "+-.~",
127+ '_');
128+ dirs[i++] = g_strdup_printf("/var/run/qemu/%s", version_dir);
129+#endif
130+
131 assert(i == ARRAY_SIZE(dirs));
132 g_free(exec_dir);
133 exec_dir = NULL;
diff --git a/debian/qemu-block-extra.postrm.in b/debian/qemu-block-extra.postrm.in
0new file mode 100644134new file mode 100644
index 0000000..5c3d73e
--- /dev/null
+++ b/debian/qemu-block-extra.postrm.in
@@ -0,0 +1,43 @@
1#!/bin/sh
2# postrm script for qemu-block-extra
3#
4# see: dh_installdeb(1)
5
6set -e
7
8# summary of how this script can be called:
9# * <postrm> `remove'
10# * <postrm> `purge'
11# * <old-postrm> `upgrade' <new-version>
12# * <new-postrm> `failed-upgrade' <old-version>
13# * <new-postrm> `abort-install'
14# * <new-postrm> `abort-install' <old-version>
15# * <new-postrm> `abort-upgrade' <old-version>
16# * <disappearer's-postrm> `disappear' <overwriter>
17# <overwriter-version>
18# for details, see https://www.debian.org/doc/debian-policy/ or
19# the debian-policy package
20
21
22case "$1" in
23 purge|remove)
24 # remove .so files for still running qemu instances in /var/run
25 # for details see bug LP: #1847361
26 rm -f /var/run/qemu/@PKGVERSION@/block-*.so
27 ;;
28
29 upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
30 ;;
31
32 *)
33 echo "postrm called with unknown argument \`$1'" >&2
34 exit 1
35 ;;
36esac
37
38# dh_installdeb will replace this with shell code automatically
39# generated by other debhelper scripts.
40
41#DEBHELPER#
42
43exit 0
diff --git a/debian/qemu-block-extra.prerm.in b/debian/qemu-block-extra.prerm.in
0new file mode 10064444new file mode 100644
index 0000000..dee25a8
--- /dev/null
+++ b/debian/qemu-block-extra.prerm.in
@@ -0,0 +1,45 @@
1#!/bin/sh
2# prerm script for qemu-block-extra
3#
4# see: dh_installdeb(1)
5
6set -e
7
8# summary of how this script can be called:
9# * <prerm> `remove'
10# * <old-prerm> `upgrade' <new-version>
11# * <new-prerm> `failed-upgrade' <old-version>
12# * <conflictor's-prerm> `remove' `in-favour' <package> <new-version>
13# * <deconfigured's-prerm> `deconfigure' `in-favour'
14# <package-being-installed> <version> `removing'
15# <conflicting-package> <version>
16# for details, see https://www.debian.org/doc/debian-policy/ or
17# the debian-policy package
18
19
20case "$1" in
21 remove)
22 ;;
23
24 upgrade|deconfigure)
25 # retain .so files for still running qemu instances in /var/run
26 # for details see bug LP: #1847361
27 mkdir -p /var/run/qemu/@PKGVERSION@
28 cp /usr/lib/@ARCH@/qemu/block-*.so /var/run/qemu/@PKGVERSION@/
29 ;;
30
31 failed-upgrade)
32 ;;
33
34 *)
35 echo "prerm called with unknown argument \`$1'" >&2
36 exit 1
37 ;;
38esac
39
40# dh_installdeb will replace this with shell code automatically
41# generated by other debhelper scripts.
42
43#DEBHELPER#
44
45exit 0
diff --git a/debian/rules b/debian/rules
index 0cc70e1..ce0392e 100755
--- a/debian/rules
+++ b/debian/rules
@@ -15,6 +15,9 @@ else
15VENDOR := DEBIAN15VENDOR := DEBIAN
16endif16endif
1717
18AUTOGENERATED:= qemu-block-extra.prerm qemu-block-extra.postrm
19PKGVERSION := $(shell printf "Debian ${DEB_VERSION}" | tr --complement '[:alnum:]+-.~' '_')
20
18# support parallel build using DEB_BUILD_OPTIONS=parallel=N21# support parallel build using DEB_BUILD_OPTIONS=parallel=N
19ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))22ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
20 MAKEFLAGS += -j$(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))23 MAKEFLAGS += -j$(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
@@ -90,6 +93,12 @@ endif # enable_linux_user
90configure-stamp: configure93configure-stamp: configure
91 dh_testdir94 dh_testdir
9295
96 for f in ${AUTOGENERATED} ; do \
97 sed -e 's%@ARCH@%${DEB_HOST_MULTIARCH}%g' \
98 -e 's%@PKGVERSION@%${PKGVERSION}%g' \
99 < debian/$$f.in > debian/$$f ; \
100 done
101
93 # system build102 # system build
94 rm -rf qemu-build; mkdir qemu-build103 rm -rf qemu-build; mkdir qemu-build
95 cd qemu-build && \104 cd qemu-build && \
@@ -97,6 +106,7 @@ configure-stamp: configure
97 --${enable_system}-system \106 --${enable_system}-system \
98 --${enable_linux_user}-linux-user \107 --${enable_linux_user}-linux-user \
99 --enable-modules \108 --enable-modules \
109 --enable-module-upgrades \
100 $(shell sh debian/extract-config-opts \110 $(shell sh debian/extract-config-opts \
101 $(DEB_HOST_ARCH_OS)-$(DEB_HOST_ARCH) debian/control) \111 $(DEB_HOST_ARCH_OS)-$(DEB_HOST_ARCH) debian/control) \
102 $(QEMU_CONFIGURE_OPTIONS) || \112 $(QEMU_CONFIGURE_OPTIONS) || \
@@ -141,6 +151,7 @@ clean: debian/control
141 rm -rf qemu-build user-static-build151 rm -rf qemu-build user-static-build
142 rm -f configure-stamp build-stamp152 rm -f configure-stamp build-stamp
143 find scripts/ -name '*.pyc' -delete || :153 find scripts/ -name '*.pyc' -delete || :
154 rm -f $(patsubst %, debian/%, ${AUTOGENERATED})
144 dh_clean155 dh_clean
145156
146# define ${ai} variable to be one of -i (indep), -a (arch) or nothing (both)157# define ${ai} variable to be one of -i (indep), -a (arch) or nothing (both)
diff --git a/ui/keycodemapdb/..git b/ui/keycodemapdb/..git
147deleted file mode 100644158deleted file mode 100644
index 5e38c9a..0000000
--- a/ui/keycodemapdb/..git
+++ /dev/null
@@ -1 +0,0 @@
1gitdir: ../../.git/modules/ui/keycodemapdb

Subscribers

People subscribed via source and target branches