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
1diff --git a/debian/changelog b/debian/changelog
2index 3ee11c0..546008f 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,14 @@
6+qemu (1:2.11+dfsg-1ubuntu7.24) bionic; urgency=medium
7+
8+ * allow qemu to load old modules post upgrade (LP: #1847361)
9+ - d/p/ubuntu/lp-1847361-modules-load-upgrade.patch: to fallback module
10+ load to a versioned path
11+ - d/qemu-block-extra.*.in: save shared objects on upgrade
12+ - d/rules: generate maintainer scripts matching package version on build
13+ - d/rules: enable --enable-module-upgrades where --enable-modules is set
14+
15+ -- Christian Ehrhardt <christian.ehrhardt@canonical.com> Mon, 02 Mar 2020 15:21:27 +0100
16+
17 qemu (1:2.11+dfsg-1ubuntu7.23) bionic-security; urgency=medium
18
19 * SECURITY UPDATE: OOB heap access via unexpected iSCSI Server response
20diff --git a/debian/patches/series b/debian/patches/series
21index 0364234..123bc83 100644
22--- a/debian/patches/series
23+++ b/debian/patches/series
24@@ -142,3 +142,4 @@ CVE-2020-7039-2.patch
25 CVE-2020-7039-3.patch
26 CVE-2020-8608-1.patch
27 CVE-2020-8608-2.patch
28+ubuntu/lp-1847361-modules-load-upgrade.patch
29diff --git a/debian/patches/ubuntu/lp-1847361-modules-load-upgrade.patch b/debian/patches/ubuntu/lp-1847361-modules-load-upgrade.patch
30new file mode 100644
31index 0000000..df9dbe0
32--- /dev/null
33+++ b/debian/patches/ubuntu/lp-1847361-modules-load-upgrade.patch
34@@ -0,0 +1,133 @@
35+From ab7e28b0905b1e2daeb5d582cf0f0ce33ea47317 Mon Sep 17 00:00:00 2001
36+From: Christian Ehrhardt <christian.ehrhardt@canonical.com>
37+Date: Mon, 2 Mar 2020 15:12:53 +0100
38+Subject: [PATCH] modules: load modules from versioned /var/run dir
39+
40+On upgrades the old .so files usually are replaced. But on the other
41+hand since a qemu process represents a guest instance it is usually kept
42+around.
43+
44+That makes late addition of dynamic features e.g. 'hot-attach of a ceph
45+disk' fail by trying to load a new version of e.f. block-rbd.so into an
46+old still running qemu binary.
47+
48+This adds a fallback to also load modules from a versioned directory in the
49+temporary /var/run path. That way qemu is providing a way for packaging
50+to store modules of an upgraded qemu package as needed until the next reboot.
51+
52+Fixes: https://bugs.launchpad.net/ubuntu/+source/qemu/+bug/1847361
53+Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
54+
55+Backport-Note: the context is a bit different and the assert a ==.
56+Therefore adapt to the changed var name as well as adapting array size
57+based on the config option.
58+
59+Origin, backport, https://git.qemu.org/?p=qemu.git;a=commit;h=267514b33ffa3f315adc26fc14d89f92e90840f5
60+Origin, backport, https://git.qemu.org/?p=qemu.git;a=commit;h=bd83c861c0
61+Bug-Ubuntu: https://bugs.launchpad.net/bugs/1847361
62+Last-Update: 2020-03-02
63+
64+---
65+ configure | 15 +++++++++++++++
66+ util/module.c | 14 ++++++++++++++
67+ 2 files changed, 29 insertions(+)
68+
69+--- a/configure
70++++ b/configure
71+@@ -340,6 +340,7 @@ EXESUF=""
72+ DSOSUF=".so"
73+ LDFLAGS_SHARED="-shared"
74+ modules="no"
75++module_upgrades="no"
76+ prefix="/usr/local"
77+ mandir="\${prefix}/share/man"
78+ datadir="\${prefix}/share"
79+@@ -888,6 +889,10 @@ for opt do
80+ --disable-modules)
81+ modules="no"
82+ ;;
83++ --disable-module-upgrades) module_upgrades="no"
84++ ;;
85++ --enable-module-upgrades) module_upgrades="yes"
86++ ;;
87+ --cpu=*)
88+ ;;
89+ --target-list=*) target_list="$optarg"
90+@@ -1495,6 +1500,7 @@ disabled with --disable-FEATURE, default
91+ guest-agent-msi build guest agent Windows MSI installation package
92+ pie Position Independent Executables
93+ modules modules support
94++ module-upgrades try to load modules from alternate paths for upgrades
95+ debug-tcg TCG debugging (default is disabled)
96+ debug-info debugging information
97+ sparse sparse checker
98+@@ -1707,6 +1713,11 @@ if compile_prog "-Werror -fno-gcse" "" ;
99+ TRANSLATE_OPT_CFLAGS=-fno-gcse
100+ fi
101+
102++# module_upgrades is only reasonable if modules are enabled
103++if test "$modules" = "no" && test "$module_upgrades" = "yes" ; then
104++ error_exit "Can't enable module-upgrades as Modules are not enabled"
105++fi
106++
107+ if test "$static" = "yes" ; then
108+ if test "$modules" = "yes" ; then
109+ error_exit "static and modules are mutually incompatible"
110+@@ -5440,6 +5451,7 @@ if test "$slirp" = "yes" ; then
111+ echo "smbd $smbd"
112+ fi
113+ echo "module support $modules"
114++echo "alt path mod load $module_upgrades"
115+ echo "host CPU $cpu"
116+ echo "host big endian $bigendian"
117+ echo "target list $target_list"
118+@@ -5753,6 +5765,9 @@ if test "$modules" = "yes"; then
119+ echo "CONFIG_STAMP=_$( (echo $qemu_version; echo $pkgversion; cat $0) | $shacmd - | cut -f1 -d\ )" >> $config_host_mak
120+ echo "CONFIG_MODULES=y" >> $config_host_mak
121+ fi
122++if test "$module_upgrades" = "yes"; then
123++ echo "CONFIG_MODULE_UPGRADES=y" >> $config_host_mak
124++fi
125+ if test "$sdl" = "yes" ; then
126+ echo "CONFIG_SDL=y" >> $config_host_mak
127+ echo "CONFIG_SDLABI=$sdlabi" >> $config_host_mak
128+--- a/util/module.c
129++++ b/util/module.c
130+@@ -20,6 +20,9 @@
131+ #endif
132+ #include "qemu/queue.h"
133+ #include "qemu/module.h"
134++#ifdef CONFIG_MODULE_UPGRADES
135++#include "qemu-version.h"
136++#endif
137+
138+ typedef struct ModuleEntry
139+ {
140+@@ -162,7 +165,12 @@ void module_load_one(const char *prefix,
141+ #ifdef CONFIG_MODULES
142+ char *fname = NULL;
143+ char *exec_dir;
144++#ifdef CONFIG_MODULE_UPGRADES
145++ char *version_dir;
146++ char *dirs[4];
147++#else
148+ char *dirs[3];
149++#endif
150+ char *module_name;
151+ int i = 0;
152+ int ret;
153+@@ -189,6 +197,14 @@ void module_load_one(const char *prefix,
154+ dirs[i++] = g_strdup_printf("%s", CONFIG_QEMU_MODDIR);
155+ dirs[i++] = g_strdup_printf("%s/..", exec_dir ? : "");
156+ dirs[i++] = g_strdup_printf("%s", exec_dir ? : "");
157++
158++#ifdef CONFIG_MODULE_UPGRADES
159++ version_dir = g_strcanon(g_strdup(QEMU_PKGVERSION),
160++ G_CSET_A_2_Z G_CSET_a_2_z G_CSET_DIGITS "+-.~",
161++ '_');
162++ dirs[i++] = g_strdup_printf("/var/run/qemu/%s", version_dir);
163++#endif
164++
165+ assert(i == ARRAY_SIZE(dirs));
166+ g_free(exec_dir);
167+ exec_dir = NULL;
168diff --git a/debian/qemu-block-extra.postrm.in b/debian/qemu-block-extra.postrm.in
169new file mode 100644
170index 0000000..5c3d73e
171--- /dev/null
172+++ b/debian/qemu-block-extra.postrm.in
173@@ -0,0 +1,43 @@
174+#!/bin/sh
175+# postrm script for qemu-block-extra
176+#
177+# see: dh_installdeb(1)
178+
179+set -e
180+
181+# summary of how this script can be called:
182+# * <postrm> `remove'
183+# * <postrm> `purge'
184+# * <old-postrm> `upgrade' <new-version>
185+# * <new-postrm> `failed-upgrade' <old-version>
186+# * <new-postrm> `abort-install'
187+# * <new-postrm> `abort-install' <old-version>
188+# * <new-postrm> `abort-upgrade' <old-version>
189+# * <disappearer's-postrm> `disappear' <overwriter>
190+# <overwriter-version>
191+# for details, see https://www.debian.org/doc/debian-policy/ or
192+# the debian-policy package
193+
194+
195+case "$1" in
196+ purge|remove)
197+ # remove .so files for still running qemu instances in /var/run
198+ # for details see bug LP: #1847361
199+ rm -f /var/run/qemu/@PKGVERSION@/block-*.so
200+ ;;
201+
202+ upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
203+ ;;
204+
205+ *)
206+ echo "postrm called with unknown argument \`$1'" >&2
207+ exit 1
208+ ;;
209+esac
210+
211+# dh_installdeb will replace this with shell code automatically
212+# generated by other debhelper scripts.
213+
214+#DEBHELPER#
215+
216+exit 0
217diff --git a/debian/qemu-block-extra.prerm.in b/debian/qemu-block-extra.prerm.in
218new file mode 100644
219index 0000000..dee25a8
220--- /dev/null
221+++ b/debian/qemu-block-extra.prerm.in
222@@ -0,0 +1,45 @@
223+#!/bin/sh
224+# prerm script for qemu-block-extra
225+#
226+# see: dh_installdeb(1)
227+
228+set -e
229+
230+# summary of how this script can be called:
231+# * <prerm> `remove'
232+# * <old-prerm> `upgrade' <new-version>
233+# * <new-prerm> `failed-upgrade' <old-version>
234+# * <conflictor's-prerm> `remove' `in-favour' <package> <new-version>
235+# * <deconfigured's-prerm> `deconfigure' `in-favour'
236+# <package-being-installed> <version> `removing'
237+# <conflicting-package> <version>
238+# for details, see https://www.debian.org/doc/debian-policy/ or
239+# the debian-policy package
240+
241+
242+case "$1" in
243+ remove)
244+ ;;
245+
246+ upgrade|deconfigure)
247+ # retain .so files for still running qemu instances in /var/run
248+ # for details see bug LP: #1847361
249+ mkdir -p /var/run/qemu/@PKGVERSION@
250+ cp /usr/lib/@ARCH@/qemu/block-*.so /var/run/qemu/@PKGVERSION@/
251+ ;;
252+
253+ failed-upgrade)
254+ ;;
255+
256+ *)
257+ echo "prerm called with unknown argument \`$1'" >&2
258+ exit 1
259+ ;;
260+esac
261+
262+# dh_installdeb will replace this with shell code automatically
263+# generated by other debhelper scripts.
264+
265+#DEBHELPER#
266+
267+exit 0
268diff --git a/debian/rules b/debian/rules
269index 0cc70e1..ce0392e 100755
270--- a/debian/rules
271+++ b/debian/rules
272@@ -15,6 +15,9 @@ else
273 VENDOR := DEBIAN
274 endif
275
276+AUTOGENERATED:= qemu-block-extra.prerm qemu-block-extra.postrm
277+PKGVERSION := $(shell printf "Debian ${DEB_VERSION}" | tr --complement '[:alnum:]+-.~' '_')
278+
279 # support parallel build using DEB_BUILD_OPTIONS=parallel=N
280 ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
281 MAKEFLAGS += -j$(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
282@@ -90,6 +93,12 @@ endif # enable_linux_user
283 configure-stamp: configure
284 dh_testdir
285
286+ for f in ${AUTOGENERATED} ; do \
287+ sed -e 's%@ARCH@%${DEB_HOST_MULTIARCH}%g' \
288+ -e 's%@PKGVERSION@%${PKGVERSION}%g' \
289+ < debian/$$f.in > debian/$$f ; \
290+ done
291+
292 # system build
293 rm -rf qemu-build; mkdir qemu-build
294 cd qemu-build && \
295@@ -97,6 +106,7 @@ configure-stamp: configure
296 --${enable_system}-system \
297 --${enable_linux_user}-linux-user \
298 --enable-modules \
299+ --enable-module-upgrades \
300 $(shell sh debian/extract-config-opts \
301 $(DEB_HOST_ARCH_OS)-$(DEB_HOST_ARCH) debian/control) \
302 $(QEMU_CONFIGURE_OPTIONS) || \
303@@ -141,6 +151,7 @@ clean: debian/control
304 rm -rf qemu-build user-static-build
305 rm -f configure-stamp build-stamp
306 find scripts/ -name '*.pyc' -delete || :
307+ rm -f $(patsubst %, debian/%, ${AUTOGENERATED})
308 dh_clean
309
310 # define ${ai} variable to be one of -i (indep), -a (arch) or nothing (both)
311diff --git a/ui/keycodemapdb/..git b/ui/keycodemapdb/..git
312deleted file mode 100644
313index 5e38c9a..0000000
314--- a/ui/keycodemapdb/..git
315+++ /dev/null
316@@ -1 +0,0 @@
317-gitdir: ../../.git/modules/ui/keycodemapdb

Subscribers

People subscribed via source and target branches