Merge ~paelzer/ubuntu/+source/qemu:lp-1921468-1887535-1921665-FOCAL into ubuntu/+source/qemu:ubuntu/focal-devel

Proposed by Christian Ehrhardt 
Status: Merged
Approved by: Christian Ehrhardt 
Approved revision: 2fb74686bdd620637ff3ba9ce6353f9d6045c5f3
Merge reported by: Christian Ehrhardt 
Merged at revision: 2fb74686bdd620637ff3ba9ce6353f9d6045c5f3
Proposed branch: ~paelzer/ubuntu/+source/qemu:lp-1921468-1887535-1921665-FOCAL
Merge into: ubuntu/+source/qemu:ubuntu/focal-devel
Diff against target: 587 lines (+530/-0)
8 files modified
debian/changelog (+14/-0)
debian/patches/series (+5/-0)
debian/patches/ubuntu/lp-1887535-configure-replace-enable-disable-git-update-with-wit.patch (+277/-0)
debian/patches/ubuntu/lp-1921468-pc-bios-s390-ccw-break-loop-if-a-null-block-number-i.patch (+40/-0)
debian/patches/ubuntu/lp-1921468-pc-bios-s390-ccw-fix-off-by-one-error.patch (+41/-0)
debian/patches/ubuntu/lp-1921665-1-block-Require-aligned-image-size-to-avoid-assert.patch (+66/-0)
debian/patches/ubuntu/lp-1921665-2-file-posix-Allow-byte-aligned-O_DIRECT-with-NFS.patch (+86/-0)
debian/rules (+1/-0)
Reviewer Review Type Date Requested Status
Utkarsh Gupta (community) Approve
Sergio Durigan Junior (community) Needs Information
Canonical Server Pending
git-ubuntu developers Pending
Review via email: mp+400327@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Christian Ehrhardt  (paelzer) wrote :
Revision history for this message
Sergio Durigan Junior (sergiodj) wrote :

Thanks, Christian.

I reviewed everything and the changes look alright. The patches are properly named, the DEP-3 headers are OK, the changelog entry is OK.

I'm marking this as Needs Information because (as of this writing) the builds haven't finished on the PPA, which means that the dep8 tests have not been run yet. I'd like to see the results before approving the MP.

I have reviewed the SRU templates for the bugs mentioned in the changelog, with the exception of #1921468 which still doesn't have a template ready. I think the template for #1887535 could be expanded a bit on the "Regression potential" (which now should be named "Where problems could occur", by the way). I agree that a regression would likely cause a failed build, but not always. Are there any more scenarios where a regression could creep in and change the result of the build?

Once the build finishes and the test results are available I will update this review. Thanks.

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

Builds are complete by now and LGTM.
Tests started but not yet finished.

I have expanded on the regression potential (it was filed before the rename) of bug 1887535

I added an SRU template to 1921468 as well

Revision history for this message
Utkarsh Gupta (utkarsh) wrote :

* Changelog:
  - [✔] changelog entry correct version and targeted codename
  - [✔] changelog entries correct
  - [✔] update-maintainer has been run

* New Delta:
  - [✔] patches match what was proposed upstream
  - [✔] patches correctly included in debian/patches/series
  - [✔] patches have correct DEP3 metadata
  - [?] patches are all correct

A quick note here: I prefer to run `quilt refresh` after a patch is applied to refresh a patch, this removes the unnecessary noise from all the patches.

The first 3 patches seems to be partially refreshed (which is good!), but the last two (namely, lp-1921665-1-block-Require-aligned-image-size-to-avoid-assert.patch and lp-1921665-2-file-posix-Allow-byte-aligned-O_DIRECT-with-NFS.patch) haven't been refreshed. I know this is based on preferences, et al, but this is one thing that I always try to adapt to. Trivial (but of significance for me), so you could ignore as well, but I'd love it if you could do a complete refresh of all the 5 patches! :)

* Build/Test:
  - [✔] build is ok
  - [✔] verified PPA package installs/uninstalls
  - [✔] autopkgtest against the PPA package passes

* Extra:
  - [?] lintian warnings

I get a bunch of lintian warning for spelling errors; cf: https://paste.ubuntu.com/p/fbCQ8j47xq/. Maybe worth fixing it now or later? Or in fact, just forward the Debian specific ones to mjt and he can fix them. And maybe, we can fix the Ubuntu specific ones?

Another very, very trivial lintian comment is about trailing whitespaces in debian/changelog. You could run:
sed -i -e 's@[[:space:]]*$@@g' debian/changelog
to get rid of them but I guess worth sending this pointer to mjt maybe?

That said, this MP looks good and you can upload as-is but maybe worth considering my points above?

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

Thanks for the review.

Ok on patch refreshing and done - thanks.

The rest I have postponed and answered in more detail on the groovy MP.

To ssh://git.launchpad.net/~usd-import-team/ubuntu/+source/qemu
 * [new tag] upload/1%4.2-3ubuntu6.15 -> upload/1%4.2-3ubuntu6.15

Uploading to ubuntu (via ftp to upload.ubuntu.com):
  Uploading qemu_4.2-3ubuntu6.15.dsc: done.
  Uploading qemu_4.2-3ubuntu6.15.debian.tar.xz: done.
  Uploading qemu_4.2-3ubuntu6.15_source.buildinfo: done.
  Uploading qemu_4.2-3ubuntu6.15_source.changes: done.
Successfully uploaded packages.

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

merged - closing MP

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 6728b7a..d263f9e 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,17 @@
6+qemu (1:4.2-3ubuntu6.15) focal; urgency=medium
7+
8+ * d/p/u/lp-1921468-*: fix issues handling boot menu index on s390x
9+ (LP: #1921468)
10+ * d/p/u/lp-1887535-configure-replace-enable-disable-git-update-with-wit.patch,
11+ d/rules: Backport --with-git-submodules param so building from git repo
12+ doesn't fail (LP: #1887535)
13+ * Fix byte aligned writes when writing to image stored on NFS
14+ server, as they aren't required to be 4kib aligned. (LP: #1921665)
15+ - d/p/u/lp-1921665-1-block-Require-aligned-image-size-to-avoid-assert.patch
16+ - d/p/u/lp-1921665-2-file-posix-Allow-byte-aligned-O_DIRECT-with-NFS.patch
17+
18+ -- Christian Ehrhardt <christian.ehrhardt@canonical.com> Fri, 26 Mar 2021 10:38:47 +0100
19+
20 qemu (1:4.2-3ubuntu6.14) focal-security; urgency=medium
21
22 * SECURITY REGRESSION: fix multiple regressions caused by CVE-2020-13754
23diff --git a/debian/patches/series b/debian/patches/series
24index e622674..631f85a 100644
25--- a/debian/patches/series
26+++ b/debian/patches/series
27@@ -258,3 +258,8 @@ ubuntu/CVE-2020-13754-4.patch
28 ubuntu/CVE-2020-13754-5.patch
29 ubuntu/CVE-2020-13754-6.patch
30 ubuntu/CVE-2020-13754-9.patch
31+ubuntu/lp-1921468-pc-bios-s390-ccw-fix-off-by-one-error.patch
32+ubuntu/lp-1921468-pc-bios-s390-ccw-break-loop-if-a-null-block-number-i.patch
33+ubuntu/lp-1887535-configure-replace-enable-disable-git-update-with-wit.patch
34+ubuntu/lp-1921665-1-block-Require-aligned-image-size-to-avoid-assert.patch
35+ubuntu/lp-1921665-2-file-posix-Allow-byte-aligned-O_DIRECT-with-NFS.patch
36diff --git a/debian/patches/ubuntu/lp-1887535-configure-replace-enable-disable-git-update-with-wit.patch b/debian/patches/ubuntu/lp-1887535-configure-replace-enable-disable-git-update-with-wit.patch
37new file mode 100644
38index 0000000..0fe0ec5
39--- /dev/null
40+++ b/debian/patches/ubuntu/lp-1887535-configure-replace-enable-disable-git-update-with-wit.patch
41@@ -0,0 +1,277 @@
42+From 7d7dbf9dc15be6e1465c756c2c5ae7f1ab104fc8 Mon Sep 17 00:00:00 2001
43+From: Dan Streetman <ddstreet@canonical.com>
44+Date: Tue, 19 Jan 2021 12:20:46 -0500
45+Subject: [PATCH] configure: replace --enable/disable-git-update with
46+ --with-git-submodules
47+MIME-Version: 1.0
48+Content-Type: text/plain; charset=UTF-8
49+Content-Transfer-Encoding: 8bit
50+Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/qemu/+bug/1887535
51+Origin: upstream, https://git.qemu.org/?p=qemu.git;a=commit;h=7d7dbf9dc15be6e1465c756c2c5ae7f1ab104fc8
52+
53+Replace the --enable-git-update and --disable-git-update configure params
54+with the param --with-git-submodules=(update|validate|ignore) to
55+allow 3 options for building from a git repo.
56+
57+This is needed because downstream packagers, e.g. Debian, Ubuntu, etc,
58+also keep the source code in git, but do not want to enable the
59+'git_update' mode; with the current code, that's not possible even
60+if the downstream package specifies --disable-git-update.
61+
62+The previous parameters are deprecated but still available; the
63+--enable-git-update parameter maps to --with-git-submodules=update and
64+--disable-git-update parameter maps to --with-git-submodules=validate.
65+
66+The configure script behavior is slightly modified, where previously
67+the dtc, capstone, and slirp submodules were not validated when
68+--disable-git-update was specified (but were updated with git-update
69+enabled), now they are validated when using --with-git-submodules=validate
70+and are only ignored when using --with-git-submodules=ignore.
71+
72+Signed-off-by: Dan Streetman <ddstreet@canonical.com>
73+Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
74+---
75+ Makefile | 24 ++-----------------
76+ configure | 51 ++++++++++++++++++++++++++++++----------
77+ scripts/git-submodule.sh | 34 ++++++++++++++++++++-------
78+ 3 files changed, 66 insertions(+), 43 deletions(-)
79+
80+--- a/Makefile
81++++ b/Makefile
82+@@ -24,33 +24,11 @@ ifneq ($(wildcard config-host.mak),)
83+ all:
84+ include config-host.mak
85+
86+-git-submodule-update:
87+-
88+ .PHONY: git-submodule-update
89+-
90+-git_module_status := $(shell \
91+- cd '$(SRC_PATH)' && \
92+- GIT="$(GIT)" ./scripts/git-submodule.sh status $(GIT_SUBMODULES); \
93+- echo $$?; \
94+-)
95+-
96+-ifeq (1,$(git_module_status))
97+-ifeq (no,$(GIT_UPDATE))
98+-git-submodule-update:
99+- $(call quiet-command, \
100+- echo && \
101+- echo "GIT submodule checkout is out of date. Please run" && \
102+- echo " scripts/git-submodule.sh update $(GIT_SUBMODULES)" && \
103+- echo "from the source directory checkout $(SRC_PATH)" && \
104+- echo && \
105+- exit 1)
106+-else
107+ git-submodule-update:
108+ $(call quiet-command, \
109+- (cd $(SRC_PATH) && GIT="$(GIT)" ./scripts/git-submodule.sh update $(GIT_SUBMODULES)), \
110+- "GIT","$(GIT_SUBMODULES)")
111+-endif
112+-endif
113++ (GIT="$(GIT)" "$(SRC_PATH)/scripts/git-submodule.sh" $(GIT_SUBMODULES_ACTION) $(GIT_SUBMODULES)), \
114++ "GIT","$(GIT_SUBMODULES)")
115+
116+ .git-submodule-status: git-submodule-update config-host.mak
117+
118+--- a/configure
119++++ b/configure
120+@@ -305,12 +305,12 @@ stack_protector=""
121+
122+ if test -e "$source_path/.git"
123+ then
124+- git_update=yes
125++ git_submodules_action="update"
126+ git_submodules="ui/keycodemapdb"
127+ git_submodules="$git_submodules tests/fp/berkeley-testfloat-3"
128+ git_submodules="$git_submodules tests/fp/berkeley-softfloat-3"
129+ else
130+- git_update=no
131++ git_submodules_action="ignore"
132+ git_submodules=""
133+
134+ if ! test -f "$source_path/ui/keycodemapdb/README"
135+@@ -1524,9 +1524,16 @@ for opt do
136+ ;;
137+ --with-git=*) git="$optarg"
138+ ;;
139+- --enable-git-update) git_update=yes
140++ --enable-git-update)
141++ git_submodules_action="update"
142++ echo "--enable-git-update deprecated, use --with-git-submodules=update"
143++ ;;
144++ --disable-git-update)
145++ git_submodules_action="validate"
146++ echo "--disable-git-update deprecated, use --with-git-submodules=validate"
147+ ;;
148+- --disable-git-update) git_update=no
149++ --with-git-submodules=*)
150++ git_submodules_action="$optarg"
151+ ;;
152+ --enable-debug-mutex) debug_mutex=yes
153+ ;;
154+@@ -1552,6 +1559,21 @@ for opt do
155+ esac
156+ done
157+
158++case $git_submodules_action in
159++ update|validate)
160++ if test ! -e "$source_path/.git"; then
161++ echo "ERROR: cannot $git_submodules_action git submodules without .git"
162++ exit 1
163++ fi
164++ ;;
165++ ignore)
166++ ;;
167++ *)
168++ echo "ERROR: invalid --with-git-submodules= value '$git_submodules_action'"
169++ exit 1
170++ ;;
171++esac
172++
173+ case "$cpu" in
174+ ppc)
175+ CPU_CFLAGS="-m32"
176+@@ -1678,6 +1700,9 @@ Advanced options (experts only):
177+ --python=PYTHON use specified python [$python]
178+ --smbd=SMBD use specified smbd [$smbd]
179+ --with-git=GIT use specified git [$git]
180++ --with-git-submodules=update update git submodules (default if .git dir exists)
181++ --with-git-submodules=validate fail if git submodules are not up to date
182++ --with-git-submodules=ignore do not update or check git submodules (default if no .git dir)
183+ --static enable static build [$static]
184+ --mandir=PATH install man pages in PATH
185+ --datadir=PATH install firmware in PATH$confsuffix
186+@@ -1885,7 +1910,7 @@ fi
187+ # Consult white-list to determine whether to enable werror
188+ # by default. Only enable by default for git builds
189+ if test -z "$werror" ; then
190+- if test -e "$source_path/.git" && \
191++ if test $git_submodules_action != 'ignore' && \
192+ { test "$linux" = "yes" || test "$mingw32" = "yes"; }; then
193+ werror="yes"
194+ else
195+@@ -4148,10 +4173,10 @@ EOF
196+ fdt=system
197+ else
198+ # have GIT checkout, so activate dtc submodule
199+- if test -e "${source_path}/.git" ; then
200++ if test $git_submodules_action != 'ignore' ; then
201+ git_submodules="${git_submodules} dtc"
202+ fi
203+- if test -d "${source_path}/dtc/libfdt" || test -e "${source_path}/.git" ; then
204++ if test -d "${source_path}/dtc/libfdt" || test $git_submodules_action != 'ignore' ; then
205+ fdt=git
206+ mkdir -p dtc
207+ if [ "$pwd_is_source_path" != "y" ] ; then
208+@@ -5084,7 +5109,7 @@ case "$capstone" in
209+ "" | yes)
210+ if $pkg_config capstone; then
211+ capstone=system
212+- elif test -e "${source_path}/.git" && test $git_update = 'yes' ; then
213++ elif test $git_submodules_action != 'ignore' ; then
214+ capstone=git
215+ elif test -e "${source_path}/capstone/Makefile" ; then
216+ capstone=internal
217+@@ -6054,7 +6079,7 @@ case "$slirp" in
218+ "" | yes)
219+ if $pkg_config slirp; then
220+ slirp=system
221+- elif test -e "${source_path}/.git" && test $git_update = 'yes' ; then
222++ elif test $git_submodules_action != 'ignore' ; then
223+ slirp=git
224+ elif test -e "${source_path}/slirp/Makefile" ; then
225+ slirp=internal
226+@@ -6678,7 +6703,7 @@ echo "libs_cpu=$libs_cpu" >> $config_hos
227+ echo "libs_softmmu=$libs_softmmu" >> $config_host_mak
228+ echo "GIT=$git" >> $config_host_mak
229+ echo "GIT_SUBMODULES=$git_submodules" >> $config_host_mak
230+-echo "GIT_UPDATE=$git_update" >> $config_host_mak
231++echo "GIT_SUBMODULES_ACTION=$git_submodules_action" >> $config_host_mak
232+
233+ echo "ARCH=$ARCH" >> $config_host_mak
234+
235+--- a/scripts/git-submodule.sh
236++++ b/scripts/git-submodule.sh
237+@@ -9,9 +9,14 @@ command=$1
238+ shift
239+ maybe_modules="$@"
240+
241++# if --with-git-submodules=ignore, do nothing
242++test "$command" = "ignore" && exit 0
243++
244+ test -z "$GIT" && GIT=git
245+
246+-error() {
247++cd "$(dirname "$0")/.."
248++
249++update_error() {
250+ echo "$0: $*"
251+ echo
252+ echo "Unable to automatically checkout GIT submodules '$modules'."
253+@@ -24,7 +29,7 @@ error() {
254+ echo "Alternatively you may disable automatic GIT submodule checkout"
255+ echo "with:"
256+ echo
257+- echo " $ ./configure --disable-git-update"
258++ echo " $ ./configure --with-git-submodules=validate"
259+ echo
260+ echo "and then manually update submodules prior to running make, with:"
261+ echo
262+@@ -33,6 +38,19 @@ error() {
263+ exit 1
264+ }
265+
266++validate_error() {
267++ if test "$1" = "validate"; then
268++ echo "GIT submodules checkout is out of date, and submodules"
269++ echo "configured for validate only. Please run"
270++ echo " scripts/git-submodule.sh update $maybe_modules"
271++ echo "from the source directory or call configure with"
272++ echo " --with-git-submodules=update"
273++ echo "To disable GIT submodules validation, use"
274++ echo " --with-git-submodules=ignore"
275++ fi
276++ exit 1
277++}
278++
279+ modules=""
280+ for m in $maybe_modules
281+ do
282+@@ -52,17 +70,18 @@ then
283+ fi
284+
285+ case "$command" in
286+-status)
287++status|validate)
288+ if test -z "$maybe_modules"
289+ then
290+- test -s ${substat} && exit 1 || exit 0
291++ test -s ${substat} && validate_error "$command" || exit 0
292+ fi
293+
294+- test -f "$substat" || exit 1
295++ test -f "$substat" || validate_error "$command"
296+ CURSTATUS=$($GIT submodule status $modules)
297+ OLDSTATUS=$(cat $substat)
298+- test "$CURSTATUS" = "$OLDSTATUS"
299+- exit $?
300++ if test "$CURSTATUS" != "$OLDSTATUS"; then
301++ validate_error "$command"
302++ fi
303+ ;;
304+ update)
305+ if test -z "$maybe_modules"
306+@@ -72,10 +91,10 @@ update)
307+ fi
308+
309+ $GIT submodule update --init $modules 1>/dev/null
310+- test $? -ne 0 && error "failed to update modules"
311++ test $? -ne 0 && update_error "failed to update modules"
312+
313+ $GIT submodule status $modules > "${substat}"
314+- test $? -ne 0 && error "failed to save git submodule status" >&2
315++ test $? -ne 0 && update_error "failed to save git submodule status" >&2
316+ ;;
317+ esac
318+
319diff --git a/debian/patches/ubuntu/lp-1921468-pc-bios-s390-ccw-break-loop-if-a-null-block-number-i.patch b/debian/patches/ubuntu/lp-1921468-pc-bios-s390-ccw-break-loop-if-a-null-block-number-i.patch
320new file mode 100644
321index 0000000..1df9421
322--- /dev/null
323+++ b/debian/patches/ubuntu/lp-1921468-pc-bios-s390-ccw-break-loop-if-a-null-block-number-i.patch
324@@ -0,0 +1,40 @@
325+From 468184ec9024f4f7b55247f70ec57554e8a500d7 Mon Sep 17 00:00:00 2001
326+From: Marc Hartmayer <mhartmay@linux.ibm.com>
327+Date: Thu, 24 Sep 2020 10:59:25 +0200
328+Subject: [PATCH] pc-bios/s390-ccw: break loop if a null block number is
329+ reached
330+
331+Break the loop if `cur_block_nr` is a null block number because this
332+means that the end of chunk is reached. In this case we will try to
333+boot the default entry.
334+
335+Fixes: ba831b25262a ("s390-ccw: read stage2 boot loader data to find menu")
336+Reviewed-by: Collin Walling <walling@linux.ibm.com>
337+Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
338+Message-Id: <20200924085926.21709-3-mhartmay@linux.ibm.com>
339+Signed-off-by: Thomas Huth <thuth@redhat.com>
340+
341+Origin: upstream, https://git.qemu.org/?p=qemu.git;a=commit;h=468184ec9024
342+Bug-Ubuntu: https://bugs.launchpad.net/bugs/1921468
343+Last-Update: 2021-03-26
344+
345+---
346+ pc-bios/s390-ccw/bootmap.c | 2 +-
347+ 1 file changed, 1 insertion(+), 1 deletion(-)
348+
349+diff --git a/pc-bios/s390-ccw/bootmap.c b/pc-bios/s390-ccw/bootmap.c
350+index 767bb612db..942fba3fa7 100644
351+--- a/pc-bios/s390-ccw/bootmap.c
352++++ b/pc-bios/s390-ccw/bootmap.c
353+@@ -192,7 +192,7 @@ static int eckd_get_boot_menu_index(block_number_t s1b_block_nr)
354+ for (i = 0; i < STAGE2_BLK_CNT_MAX; i++) {
355+ cur_block_nr = eckd_block_num(&s1b->seek[i].chs);
356+
357+- if (!cur_block_nr) {
358++ if (!cur_block_nr || is_null_block_number(cur_block_nr)) {
359+ break;
360+ }
361+
362+--
363+2.30.0
364+
365diff --git a/debian/patches/ubuntu/lp-1921468-pc-bios-s390-ccw-fix-off-by-one-error.patch b/debian/patches/ubuntu/lp-1921468-pc-bios-s390-ccw-fix-off-by-one-error.patch
366new file mode 100644
367index 0000000..b59bdad
368--- /dev/null
369+++ b/debian/patches/ubuntu/lp-1921468-pc-bios-s390-ccw-fix-off-by-one-error.patch
370@@ -0,0 +1,41 @@
371+From 5f97ba0c74ccace0a4014460de9751ff3c6f454a Mon Sep 17 00:00:00 2001
372+From: Marc Hartmayer <mhartmay@linux.ibm.com>
373+Date: Thu, 24 Sep 2020 10:59:24 +0200
374+Subject: [PATCH] pc-bios/s390-ccw: fix off-by-one error
375+
376+This error takes effect when the magic value "zIPL" is located at the
377+end of a block. For example if s2_cur_blk = 0x7fe18000 and the magic
378+value "zIPL" is located at 0x7fe18ffc - 0x7fe18fff.
379+
380+Fixes: ba831b25262a ("s390-ccw: read stage2 boot loader data to find menu")
381+Reviewed-by: Collin Walling <walling@linux.ibm.com>
382+Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
383+Message-Id: <20200924085926.21709-2-mhartmay@linux.ibm.com>
384+Reviewed-by: Thomas Huth <thuth@redhat.com>
385+[thuth: Use "<= ... - 4" instead of "< ... - 3"]
386+Signed-off-by: Thomas Huth <thuth@redhat.com>
387+
388+Origin: upstream, https://git.qemu.org/?p=qemu.git;a=commit;h=5f97ba0c74cc
389+Bug-Ubuntu: https://bugs.launchpad.net/bugs/1921468
390+Last-Update: 2021-03-26
391+
392+---
393+ pc-bios/s390-ccw/bootmap.c | 2 +-
394+ 1 file changed, 1 insertion(+), 1 deletion(-)
395+
396+diff --git a/pc-bios/s390-ccw/bootmap.c b/pc-bios/s390-ccw/bootmap.c
397+index 0ef6b851f3..767bb612db 100644
398+--- a/pc-bios/s390-ccw/bootmap.c
399++++ b/pc-bios/s390-ccw/bootmap.c
400+@@ -163,7 +163,7 @@ static bool find_zipl_boot_menu_banner(int *offset)
401+ int i;
402+
403+ /* Menu banner starts with "zIPL" */
404+- for (i = 0; i < virtio_get_block_size() - 4; i++) {
405++ for (i = 0; i <= virtio_get_block_size() - 4; i++) {
406+ if (magic_match(s2_cur_blk + i, ZIPL_MAGIC_EBCDIC)) {
407+ *offset = i;
408+ return true;
409+--
410+2.30.0
411+
412diff --git a/debian/patches/ubuntu/lp-1921665-1-block-Require-aligned-image-size-to-avoid-assert.patch b/debian/patches/ubuntu/lp-1921665-1-block-Require-aligned-image-size-to-avoid-assert.patch
413new file mode 100644
414index 0000000..81dd3fb
415--- /dev/null
416+++ b/debian/patches/ubuntu/lp-1921665-1-block-Require-aligned-image-size-to-avoid-assert.patch
417@@ -0,0 +1,66 @@
418+From 9c60a5d1978e6dcf85c0e01b50e6f7f54ca09104 Mon Sep 17 00:00:00 2001
419+From: Kevin Wolf <kwolf@redhat.com>
420+Date: Thu, 16 Jul 2020 16:26:00 +0200
421+Subject: [PATCH] block: Require aligned image size to avoid assertion failure
422+
423+Unaligned requests will automatically be aligned to bl.request_alignment
424+and we can't extend write requests to access space beyond the end of the
425+image without resizing the image, so if we have the WRITE permission,
426+but not the RESIZE one, it's required that the image size is aligned.
427+
428+Failing to meet this requirement could cause assertion failures like
429+this if RESIZE permissions weren't requested:
430+
431+qemu-img: block/io.c:1910: bdrv_co_write_req_prepare: Assertion `end_sector <= bs->total_sectors || child->perm & BLK_PERM_RESIZE' failed.
432+
433+This was e.g. triggered by qemu-img converting to a target image with 4k
434+request alignment when the image was only aligned to 512 bytes, but not
435+to 4k.
436+
437+Turn this into a graceful error in bdrv_check_perm() so that WRITE
438+without RESIZE can only be taken if the image size is aligned. If a user
439+holds both permissions and drops only RESIZE, the function will return
440+an error, but bdrv_child_try_set_perm() will ignore the failure silently
441+if permissions are only requested to be relaxed and just keep both
442+permissions while returning success.
443+
444+Signed-off-by: Kevin Wolf <kwolf@redhat.com>
445+Message-Id: <20200716142601.111237-2-kwolf@redhat.com>
446+Reviewed-by: Max Reitz <mreitz@redhat.com>
447+Signed-off-by: Kevin Wolf <kwolf@redhat.com>
448+
449+Origin: backport, https://git.qemu.org/?p=qemu.git;a=commit;h=9c60a5d1978e6dcf85c0e01b50e6f7f54ca09104
450+Bug-Ubuntu: https://bugs.launchpad.net/bugs/1921665
451+Last-Update: 2021-03-29
452+
453+---
454+ block.c | 16 ++++++++++++++++
455+ 1 file changed, 16 insertions(+)
456+
457+Index: qemu-4.2/block.c
458+===================================================================
459+--- qemu-4.2.orig/block.c 2021-03-29 16:37:44.376599273 +1300
460++++ qemu-4.2/block.c 2021-03-29 16:37:44.372599220 +1300
461+@@ -1842,6 +1842,22 @@
462+ return -EPERM;
463+ }
464+
465++ /*
466++ * Unaligned requests will automatically be aligned to bl.request_alignment
467++ * and without RESIZE we can't extend requests to write to space beyond the
468++ * end of the image, so it's required that the image size is aligned.
469++ */
470++ if ((cumulative_perms & (BLK_PERM_WRITE | BLK_PERM_WRITE_UNCHANGED)) &&
471++ !(cumulative_perms & BLK_PERM_RESIZE))
472++ {
473++ if ((bs->total_sectors * BDRV_SECTOR_SIZE) % bs->bl.request_alignment) {
474++ error_setg(errp, "Cannot get 'write' permission without 'resize': "
475++ "Image size is not a multiple of request "
476++ "alignment");
477++ return -EPERM;
478++ }
479++ }
480++
481+ /* Check this node */
482+ if (!drv) {
483+ return 0;
484diff --git a/debian/patches/ubuntu/lp-1921665-2-file-posix-Allow-byte-aligned-O_DIRECT-with-NFS.patch b/debian/patches/ubuntu/lp-1921665-2-file-posix-Allow-byte-aligned-O_DIRECT-with-NFS.patch
485new file mode 100644
486index 0000000..3eeee86
487--- /dev/null
488+++ b/debian/patches/ubuntu/lp-1921665-2-file-posix-Allow-byte-aligned-O_DIRECT-with-NFS.patch
489@@ -0,0 +1,86 @@
490+From 5edc85571e7b7269dce408735eba7507f18ac666 Mon Sep 17 00:00:00 2001
491+From: Kevin Wolf <kwolf@redhat.com>
492+Date: Thu, 16 Jul 2020 16:26:01 +0200
493+Subject: [PATCH] file-posix: Allow byte-aligned O_DIRECT with NFS
494+
495+Since commit a6b257a08e3 ('file-posix: Handle undetectable alignment'),
496+we assume that if we open a file with O_DIRECT and alignment probing
497+returns 1, we just couldn't find out the real alignment requirement
498+because some filesystems make the requirement only for allocated blocks.
499+In this case, a safe default of 4k is used.
500+
501+This is too strict for NFS, which does actually allow byte-aligned
502+requests even with O_DIRECT. Because we can't distinguish both cases
503+with generic code, let's just look at the file system magic and disable
504+s->needs_alignment for NFS. This way, O_DIRECT can still be used on NFS
505+for images that are not aligned to 4k.
506+
507+Signed-off-by: Kevin Wolf <kwolf@redhat.com>
508+Reviewed-by: Eric Blake <eblake@redhat.com>
509+Message-Id: <20200716142601.111237-3-kwolf@redhat.com>
510+Reviewed-by: Max Reitz <mreitz@redhat.com>
511+Signed-off-by: Kevin Wolf <kwolf@redhat.com>
512+
513+Origin: backport, https://git.qemu.org/?p=qemu.git;a=commit;h=5edc85571e7b7269dce408735eba7507f18ac666
514+Bug-Ubuntu: https://bugs.launchpad.net/bugs/1921665
515+Last-Update: 2021-03-29
516+
517+---
518+ block/file-posix.c | 26 +++++++++++++++++++++++++-
519+ 1 file changed, 25 insertions(+), 1 deletion(-)
520+
521+Index: qemu-4.2/block/file-posix.c
522+===================================================================
523+--- qemu-4.2.orig/block/file-posix.c 2021-03-29 16:38:00.008804168 +1300
524++++ qemu-4.2/block/file-posix.c 2021-03-29 16:38:00.008804168 +1300
525+@@ -61,10 +61,12 @@
526+ #include <sys/ioctl.h>
527+ #include <sys/param.h>
528+ #include <sys/syscall.h>
529++#include <sys/vfs.h>
530+ #include <linux/cdrom.h>
531+ #include <linux/fd.h>
532+ #include <linux/fs.h>
533+ #include <linux/hdreg.h>
534++#include <linux/magic.h>
535+ #include <scsi/sg.h>
536+ #ifdef __s390__
537+ #include <asm/dasd.h>
538+@@ -298,6 +300,28 @@
539+ #endif
540+ }
541+
542++/*
543++ * Returns true if no alignment restrictions are necessary even for files
544++ * opened with O_DIRECT.
545++ *
546++ * raw_probe_alignment() probes the required alignment and assume that 1 means
547++ * the probing failed, so it falls back to a safe default of 4k. This can be
548++ * avoided if we know that byte alignment is okay for the file.
549++ */
550++static bool dio_byte_aligned(int fd)
551++{
552++#ifdef __linux__
553++ struct statfs buf;
554++ int ret;
555++
556++ ret = fstatfs(fd, &buf);
557++ if (ret == 0 && buf.f_type == NFS_SUPER_MAGIC) {
558++ return true;
559++ }
560++#endif
561++ return false;
562++}
563++
564+ /* Check if read is allowed with given memory buffer and length.
565+ *
566+ * This function is used to check O_DIRECT memory buffer and request alignment.
567+@@ -602,7 +626,7 @@
568+
569+ s->has_discard = true;
570+ s->has_write_zeroes = true;
571+- if ((bs->open_flags & BDRV_O_NOCACHE) != 0) {
572++ if ((bs->open_flags & BDRV_O_NOCACHE) != 0 && !dio_byte_aligned(s->fd)) {
573+ s->needs_alignment = true;
574+ }
575+
576diff --git a/debian/rules b/debian/rules
577index e78d27d..6a55d5a 100755
578--- a/debian/rules
579+++ b/debian/rules
580@@ -53,6 +53,7 @@ common_configure_opts = \
581 --disable-strip \
582 --interp-prefix=/etc/qemu-binfmt/%M \
583 --localstatedir=/var \
584+ --with-git-submodules=ignore \
585
586 # Cross compiling support
587 ifneq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))

Subscribers

People subscribed via source and target branches