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
diff --git a/debian/changelog b/debian/changelog
index 6728b7a..d263f9e 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,17 @@
1qemu (1:4.2-3ubuntu6.15) focal; urgency=medium
2
3 * d/p/u/lp-1921468-*: fix issues handling boot menu index on s390x
4 (LP: #1921468)
5 * d/p/u/lp-1887535-configure-replace-enable-disable-git-update-with-wit.patch,
6 d/rules: Backport --with-git-submodules param so building from git repo
7 doesn't fail (LP: #1887535)
8 * Fix byte aligned writes when writing to image stored on NFS
9 server, as they aren't required to be 4kib aligned. (LP: #1921665)
10 - d/p/u/lp-1921665-1-block-Require-aligned-image-size-to-avoid-assert.patch
11 - d/p/u/lp-1921665-2-file-posix-Allow-byte-aligned-O_DIRECT-with-NFS.patch
12
13 -- Christian Ehrhardt <christian.ehrhardt@canonical.com> Fri, 26 Mar 2021 10:38:47 +0100
14
1qemu (1:4.2-3ubuntu6.14) focal-security; urgency=medium15qemu (1:4.2-3ubuntu6.14) focal-security; urgency=medium
216
3 * SECURITY REGRESSION: fix multiple regressions caused by CVE-2020-1375417 * SECURITY REGRESSION: fix multiple regressions caused by CVE-2020-13754
diff --git a/debian/patches/series b/debian/patches/series
index e622674..631f85a 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -258,3 +258,8 @@ ubuntu/CVE-2020-13754-4.patch
258ubuntu/CVE-2020-13754-5.patch258ubuntu/CVE-2020-13754-5.patch
259ubuntu/CVE-2020-13754-6.patch259ubuntu/CVE-2020-13754-6.patch
260ubuntu/CVE-2020-13754-9.patch260ubuntu/CVE-2020-13754-9.patch
261ubuntu/lp-1921468-pc-bios-s390-ccw-fix-off-by-one-error.patch
262ubuntu/lp-1921468-pc-bios-s390-ccw-break-loop-if-a-null-block-number-i.patch
263ubuntu/lp-1887535-configure-replace-enable-disable-git-update-with-wit.patch
264ubuntu/lp-1921665-1-block-Require-aligned-image-size-to-avoid-assert.patch
265ubuntu/lp-1921665-2-file-posix-Allow-byte-aligned-O_DIRECT-with-NFS.patch
diff --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
261new file mode 100644266new file mode 100644
index 0000000..0fe0ec5
--- /dev/null
+++ b/debian/patches/ubuntu/lp-1887535-configure-replace-enable-disable-git-update-with-wit.patch
@@ -0,0 +1,277 @@
1From 7d7dbf9dc15be6e1465c756c2c5ae7f1ab104fc8 Mon Sep 17 00:00:00 2001
2From: Dan Streetman <ddstreet@canonical.com>
3Date: Tue, 19 Jan 2021 12:20:46 -0500
4Subject: [PATCH] configure: replace --enable/disable-git-update with
5 --with-git-submodules
6MIME-Version: 1.0
7Content-Type: text/plain; charset=UTF-8
8Content-Transfer-Encoding: 8bit
9Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/qemu/+bug/1887535
10Origin: upstream, https://git.qemu.org/?p=qemu.git;a=commit;h=7d7dbf9dc15be6e1465c756c2c5ae7f1ab104fc8
11
12Replace the --enable-git-update and --disable-git-update configure params
13with the param --with-git-submodules=(update|validate|ignore) to
14allow 3 options for building from a git repo.
15
16This is needed because downstream packagers, e.g. Debian, Ubuntu, etc,
17also keep the source code in git, but do not want to enable the
18'git_update' mode; with the current code, that's not possible even
19if the downstream package specifies --disable-git-update.
20
21The previous parameters are deprecated but still available; the
22--enable-git-update parameter maps to --with-git-submodules=update and
23--disable-git-update parameter maps to --with-git-submodules=validate.
24
25The configure script behavior is slightly modified, where previously
26the dtc, capstone, and slirp submodules were not validated when
27--disable-git-update was specified (but were updated with git-update
28enabled), now they are validated when using --with-git-submodules=validate
29and are only ignored when using --with-git-submodules=ignore.
30
31Signed-off-by: Dan Streetman <ddstreet@canonical.com>
32Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
33---
34 Makefile | 24 ++-----------------
35 configure | 51 ++++++++++++++++++++++++++++++----------
36 scripts/git-submodule.sh | 34 ++++++++++++++++++++-------
37 3 files changed, 66 insertions(+), 43 deletions(-)
38
39--- a/Makefile
40+++ b/Makefile
41@@ -24,33 +24,11 @@ ifneq ($(wildcard config-host.mak),)
42 all:
43 include config-host.mak
44
45-git-submodule-update:
46-
47 .PHONY: git-submodule-update
48-
49-git_module_status := $(shell \
50- cd '$(SRC_PATH)' && \
51- GIT="$(GIT)" ./scripts/git-submodule.sh status $(GIT_SUBMODULES); \
52- echo $$?; \
53-)
54-
55-ifeq (1,$(git_module_status))
56-ifeq (no,$(GIT_UPDATE))
57-git-submodule-update:
58- $(call quiet-command, \
59- echo && \
60- echo "GIT submodule checkout is out of date. Please run" && \
61- echo " scripts/git-submodule.sh update $(GIT_SUBMODULES)" && \
62- echo "from the source directory checkout $(SRC_PATH)" && \
63- echo && \
64- exit 1)
65-else
66 git-submodule-update:
67 $(call quiet-command, \
68- (cd $(SRC_PATH) && GIT="$(GIT)" ./scripts/git-submodule.sh update $(GIT_SUBMODULES)), \
69- "GIT","$(GIT_SUBMODULES)")
70-endif
71-endif
72+ (GIT="$(GIT)" "$(SRC_PATH)/scripts/git-submodule.sh" $(GIT_SUBMODULES_ACTION) $(GIT_SUBMODULES)), \
73+ "GIT","$(GIT_SUBMODULES)")
74
75 .git-submodule-status: git-submodule-update config-host.mak
76
77--- a/configure
78+++ b/configure
79@@ -305,12 +305,12 @@ stack_protector=""
80
81 if test -e "$source_path/.git"
82 then
83- git_update=yes
84+ git_submodules_action="update"
85 git_submodules="ui/keycodemapdb"
86 git_submodules="$git_submodules tests/fp/berkeley-testfloat-3"
87 git_submodules="$git_submodules tests/fp/berkeley-softfloat-3"
88 else
89- git_update=no
90+ git_submodules_action="ignore"
91 git_submodules=""
92
93 if ! test -f "$source_path/ui/keycodemapdb/README"
94@@ -1524,9 +1524,16 @@ for opt do
95 ;;
96 --with-git=*) git="$optarg"
97 ;;
98- --enable-git-update) git_update=yes
99+ --enable-git-update)
100+ git_submodules_action="update"
101+ echo "--enable-git-update deprecated, use --with-git-submodules=update"
102+ ;;
103+ --disable-git-update)
104+ git_submodules_action="validate"
105+ echo "--disable-git-update deprecated, use --with-git-submodules=validate"
106 ;;
107- --disable-git-update) git_update=no
108+ --with-git-submodules=*)
109+ git_submodules_action="$optarg"
110 ;;
111 --enable-debug-mutex) debug_mutex=yes
112 ;;
113@@ -1552,6 +1559,21 @@ for opt do
114 esac
115 done
116
117+case $git_submodules_action in
118+ update|validate)
119+ if test ! -e "$source_path/.git"; then
120+ echo "ERROR: cannot $git_submodules_action git submodules without .git"
121+ exit 1
122+ fi
123+ ;;
124+ ignore)
125+ ;;
126+ *)
127+ echo "ERROR: invalid --with-git-submodules= value '$git_submodules_action'"
128+ exit 1
129+ ;;
130+esac
131+
132 case "$cpu" in
133 ppc)
134 CPU_CFLAGS="-m32"
135@@ -1678,6 +1700,9 @@ Advanced options (experts only):
136 --python=PYTHON use specified python [$python]
137 --smbd=SMBD use specified smbd [$smbd]
138 --with-git=GIT use specified git [$git]
139+ --with-git-submodules=update update git submodules (default if .git dir exists)
140+ --with-git-submodules=validate fail if git submodules are not up to date
141+ --with-git-submodules=ignore do not update or check git submodules (default if no .git dir)
142 --static enable static build [$static]
143 --mandir=PATH install man pages in PATH
144 --datadir=PATH install firmware in PATH$confsuffix
145@@ -1885,7 +1910,7 @@ fi
146 # Consult white-list to determine whether to enable werror
147 # by default. Only enable by default for git builds
148 if test -z "$werror" ; then
149- if test -e "$source_path/.git" && \
150+ if test $git_submodules_action != 'ignore' && \
151 { test "$linux" = "yes" || test "$mingw32" = "yes"; }; then
152 werror="yes"
153 else
154@@ -4148,10 +4173,10 @@ EOF
155 fdt=system
156 else
157 # have GIT checkout, so activate dtc submodule
158- if test -e "${source_path}/.git" ; then
159+ if test $git_submodules_action != 'ignore' ; then
160 git_submodules="${git_submodules} dtc"
161 fi
162- if test -d "${source_path}/dtc/libfdt" || test -e "${source_path}/.git" ; then
163+ if test -d "${source_path}/dtc/libfdt" || test $git_submodules_action != 'ignore' ; then
164 fdt=git
165 mkdir -p dtc
166 if [ "$pwd_is_source_path" != "y" ] ; then
167@@ -5084,7 +5109,7 @@ case "$capstone" in
168 "" | yes)
169 if $pkg_config capstone; then
170 capstone=system
171- elif test -e "${source_path}/.git" && test $git_update = 'yes' ; then
172+ elif test $git_submodules_action != 'ignore' ; then
173 capstone=git
174 elif test -e "${source_path}/capstone/Makefile" ; then
175 capstone=internal
176@@ -6054,7 +6079,7 @@ case "$slirp" in
177 "" | yes)
178 if $pkg_config slirp; then
179 slirp=system
180- elif test -e "${source_path}/.git" && test $git_update = 'yes' ; then
181+ elif test $git_submodules_action != 'ignore' ; then
182 slirp=git
183 elif test -e "${source_path}/slirp/Makefile" ; then
184 slirp=internal
185@@ -6678,7 +6703,7 @@ echo "libs_cpu=$libs_cpu" >> $config_hos
186 echo "libs_softmmu=$libs_softmmu" >> $config_host_mak
187 echo "GIT=$git" >> $config_host_mak
188 echo "GIT_SUBMODULES=$git_submodules" >> $config_host_mak
189-echo "GIT_UPDATE=$git_update" >> $config_host_mak
190+echo "GIT_SUBMODULES_ACTION=$git_submodules_action" >> $config_host_mak
191
192 echo "ARCH=$ARCH" >> $config_host_mak
193
194--- a/scripts/git-submodule.sh
195+++ b/scripts/git-submodule.sh
196@@ -9,9 +9,14 @@ command=$1
197 shift
198 maybe_modules="$@"
199
200+# if --with-git-submodules=ignore, do nothing
201+test "$command" = "ignore" && exit 0
202+
203 test -z "$GIT" && GIT=git
204
205-error() {
206+cd "$(dirname "$0")/.."
207+
208+update_error() {
209 echo "$0: $*"
210 echo
211 echo "Unable to automatically checkout GIT submodules '$modules'."
212@@ -24,7 +29,7 @@ error() {
213 echo "Alternatively you may disable automatic GIT submodule checkout"
214 echo "with:"
215 echo
216- echo " $ ./configure --disable-git-update"
217+ echo " $ ./configure --with-git-submodules=validate"
218 echo
219 echo "and then manually update submodules prior to running make, with:"
220 echo
221@@ -33,6 +38,19 @@ error() {
222 exit 1
223 }
224
225+validate_error() {
226+ if test "$1" = "validate"; then
227+ echo "GIT submodules checkout is out of date, and submodules"
228+ echo "configured for validate only. Please run"
229+ echo " scripts/git-submodule.sh update $maybe_modules"
230+ echo "from the source directory or call configure with"
231+ echo " --with-git-submodules=update"
232+ echo "To disable GIT submodules validation, use"
233+ echo " --with-git-submodules=ignore"
234+ fi
235+ exit 1
236+}
237+
238 modules=""
239 for m in $maybe_modules
240 do
241@@ -52,17 +70,18 @@ then
242 fi
243
244 case "$command" in
245-status)
246+status|validate)
247 if test -z "$maybe_modules"
248 then
249- test -s ${substat} && exit 1 || exit 0
250+ test -s ${substat} && validate_error "$command" || exit 0
251 fi
252
253- test -f "$substat" || exit 1
254+ test -f "$substat" || validate_error "$command"
255 CURSTATUS=$($GIT submodule status $modules)
256 OLDSTATUS=$(cat $substat)
257- test "$CURSTATUS" = "$OLDSTATUS"
258- exit $?
259+ if test "$CURSTATUS" != "$OLDSTATUS"; then
260+ validate_error "$command"
261+ fi
262 ;;
263 update)
264 if test -z "$maybe_modules"
265@@ -72,10 +91,10 @@ update)
266 fi
267
268 $GIT submodule update --init $modules 1>/dev/null
269- test $? -ne 0 && error "failed to update modules"
270+ test $? -ne 0 && update_error "failed to update modules"
271
272 $GIT submodule status $modules > "${substat}"
273- test $? -ne 0 && error "failed to save git submodule status" >&2
274+ test $? -ne 0 && update_error "failed to save git submodule status" >&2
275 ;;
276 esac
277
diff --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
0new file mode 100644278new file mode 100644
index 0000000..1df9421
--- /dev/null
+++ b/debian/patches/ubuntu/lp-1921468-pc-bios-s390-ccw-break-loop-if-a-null-block-number-i.patch
@@ -0,0 +1,40 @@
1From 468184ec9024f4f7b55247f70ec57554e8a500d7 Mon Sep 17 00:00:00 2001
2From: Marc Hartmayer <mhartmay@linux.ibm.com>
3Date: Thu, 24 Sep 2020 10:59:25 +0200
4Subject: [PATCH] pc-bios/s390-ccw: break loop if a null block number is
5 reached
6
7Break the loop if `cur_block_nr` is a null block number because this
8means that the end of chunk is reached. In this case we will try to
9boot the default entry.
10
11Fixes: ba831b25262a ("s390-ccw: read stage2 boot loader data to find menu")
12Reviewed-by: Collin Walling <walling@linux.ibm.com>
13Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
14Message-Id: <20200924085926.21709-3-mhartmay@linux.ibm.com>
15Signed-off-by: Thomas Huth <thuth@redhat.com>
16
17Origin: upstream, https://git.qemu.org/?p=qemu.git;a=commit;h=468184ec9024
18Bug-Ubuntu: https://bugs.launchpad.net/bugs/1921468
19Last-Update: 2021-03-26
20
21---
22 pc-bios/s390-ccw/bootmap.c | 2 +-
23 1 file changed, 1 insertion(+), 1 deletion(-)
24
25diff --git a/pc-bios/s390-ccw/bootmap.c b/pc-bios/s390-ccw/bootmap.c
26index 767bb612db..942fba3fa7 100644
27--- a/pc-bios/s390-ccw/bootmap.c
28+++ b/pc-bios/s390-ccw/bootmap.c
29@@ -192,7 +192,7 @@ static int eckd_get_boot_menu_index(block_number_t s1b_block_nr)
30 for (i = 0; i < STAGE2_BLK_CNT_MAX; i++) {
31 cur_block_nr = eckd_block_num(&s1b->seek[i].chs);
32
33- if (!cur_block_nr) {
34+ if (!cur_block_nr || is_null_block_number(cur_block_nr)) {
35 break;
36 }
37
38--
392.30.0
40
diff --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
0new file mode 10064441new file mode 100644
index 0000000..b59bdad
--- /dev/null
+++ b/debian/patches/ubuntu/lp-1921468-pc-bios-s390-ccw-fix-off-by-one-error.patch
@@ -0,0 +1,41 @@
1From 5f97ba0c74ccace0a4014460de9751ff3c6f454a Mon Sep 17 00:00:00 2001
2From: Marc Hartmayer <mhartmay@linux.ibm.com>
3Date: Thu, 24 Sep 2020 10:59:24 +0200
4Subject: [PATCH] pc-bios/s390-ccw: fix off-by-one error
5
6This error takes effect when the magic value "zIPL" is located at the
7end of a block. For example if s2_cur_blk = 0x7fe18000 and the magic
8value "zIPL" is located at 0x7fe18ffc - 0x7fe18fff.
9
10Fixes: ba831b25262a ("s390-ccw: read stage2 boot loader data to find menu")
11Reviewed-by: Collin Walling <walling@linux.ibm.com>
12Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
13Message-Id: <20200924085926.21709-2-mhartmay@linux.ibm.com>
14Reviewed-by: Thomas Huth <thuth@redhat.com>
15[thuth: Use "<= ... - 4" instead of "< ... - 3"]
16Signed-off-by: Thomas Huth <thuth@redhat.com>
17
18Origin: upstream, https://git.qemu.org/?p=qemu.git;a=commit;h=5f97ba0c74cc
19Bug-Ubuntu: https://bugs.launchpad.net/bugs/1921468
20Last-Update: 2021-03-26
21
22---
23 pc-bios/s390-ccw/bootmap.c | 2 +-
24 1 file changed, 1 insertion(+), 1 deletion(-)
25
26diff --git a/pc-bios/s390-ccw/bootmap.c b/pc-bios/s390-ccw/bootmap.c
27index 0ef6b851f3..767bb612db 100644
28--- a/pc-bios/s390-ccw/bootmap.c
29+++ b/pc-bios/s390-ccw/bootmap.c
30@@ -163,7 +163,7 @@ static bool find_zipl_boot_menu_banner(int *offset)
31 int i;
32
33 /* Menu banner starts with "zIPL" */
34- for (i = 0; i < virtio_get_block_size() - 4; i++) {
35+ for (i = 0; i <= virtio_get_block_size() - 4; i++) {
36 if (magic_match(s2_cur_blk + i, ZIPL_MAGIC_EBCDIC)) {
37 *offset = i;
38 return true;
39--
402.30.0
41
diff --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
0new file mode 10064442new file mode 100644
index 0000000..81dd3fb
--- /dev/null
+++ b/debian/patches/ubuntu/lp-1921665-1-block-Require-aligned-image-size-to-avoid-assert.patch
@@ -0,0 +1,66 @@
1From 9c60a5d1978e6dcf85c0e01b50e6f7f54ca09104 Mon Sep 17 00:00:00 2001
2From: Kevin Wolf <kwolf@redhat.com>
3Date: Thu, 16 Jul 2020 16:26:00 +0200
4Subject: [PATCH] block: Require aligned image size to avoid assertion failure
5
6Unaligned requests will automatically be aligned to bl.request_alignment
7and we can't extend write requests to access space beyond the end of the
8image without resizing the image, so if we have the WRITE permission,
9but not the RESIZE one, it's required that the image size is aligned.
10
11Failing to meet this requirement could cause assertion failures like
12this if RESIZE permissions weren't requested:
13
14qemu-img: block/io.c:1910: bdrv_co_write_req_prepare: Assertion `end_sector <= bs->total_sectors || child->perm & BLK_PERM_RESIZE' failed.
15
16This was e.g. triggered by qemu-img converting to a target image with 4k
17request alignment when the image was only aligned to 512 bytes, but not
18to 4k.
19
20Turn this into a graceful error in bdrv_check_perm() so that WRITE
21without RESIZE can only be taken if the image size is aligned. If a user
22holds both permissions and drops only RESIZE, the function will return
23an error, but bdrv_child_try_set_perm() will ignore the failure silently
24if permissions are only requested to be relaxed and just keep both
25permissions while returning success.
26
27Signed-off-by: Kevin Wolf <kwolf@redhat.com>
28Message-Id: <20200716142601.111237-2-kwolf@redhat.com>
29Reviewed-by: Max Reitz <mreitz@redhat.com>
30Signed-off-by: Kevin Wolf <kwolf@redhat.com>
31
32Origin: backport, https://git.qemu.org/?p=qemu.git;a=commit;h=9c60a5d1978e6dcf85c0e01b50e6f7f54ca09104
33Bug-Ubuntu: https://bugs.launchpad.net/bugs/1921665
34Last-Update: 2021-03-29
35
36---
37 block.c | 16 ++++++++++++++++
38 1 file changed, 16 insertions(+)
39
40Index: qemu-4.2/block.c
41===================================================================
42--- qemu-4.2.orig/block.c 2021-03-29 16:37:44.376599273 +1300
43+++ qemu-4.2/block.c 2021-03-29 16:37:44.372599220 +1300
44@@ -1842,6 +1842,22 @@
45 return -EPERM;
46 }
47
48+ /*
49+ * Unaligned requests will automatically be aligned to bl.request_alignment
50+ * and without RESIZE we can't extend requests to write to space beyond the
51+ * end of the image, so it's required that the image size is aligned.
52+ */
53+ if ((cumulative_perms & (BLK_PERM_WRITE | BLK_PERM_WRITE_UNCHANGED)) &&
54+ !(cumulative_perms & BLK_PERM_RESIZE))
55+ {
56+ if ((bs->total_sectors * BDRV_SECTOR_SIZE) % bs->bl.request_alignment) {
57+ error_setg(errp, "Cannot get 'write' permission without 'resize': "
58+ "Image size is not a multiple of request "
59+ "alignment");
60+ return -EPERM;
61+ }
62+ }
63+
64 /* Check this node */
65 if (!drv) {
66 return 0;
diff --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
0new file mode 10064467new file mode 100644
index 0000000..3eeee86
--- /dev/null
+++ b/debian/patches/ubuntu/lp-1921665-2-file-posix-Allow-byte-aligned-O_DIRECT-with-NFS.patch
@@ -0,0 +1,86 @@
1From 5edc85571e7b7269dce408735eba7507f18ac666 Mon Sep 17 00:00:00 2001
2From: Kevin Wolf <kwolf@redhat.com>
3Date: Thu, 16 Jul 2020 16:26:01 +0200
4Subject: [PATCH] file-posix: Allow byte-aligned O_DIRECT with NFS
5
6Since commit a6b257a08e3 ('file-posix: Handle undetectable alignment'),
7we assume that if we open a file with O_DIRECT and alignment probing
8returns 1, we just couldn't find out the real alignment requirement
9because some filesystems make the requirement only for allocated blocks.
10In this case, a safe default of 4k is used.
11
12This is too strict for NFS, which does actually allow byte-aligned
13requests even with O_DIRECT. Because we can't distinguish both cases
14with generic code, let's just look at the file system magic and disable
15s->needs_alignment for NFS. This way, O_DIRECT can still be used on NFS
16for images that are not aligned to 4k.
17
18Signed-off-by: Kevin Wolf <kwolf@redhat.com>
19Reviewed-by: Eric Blake <eblake@redhat.com>
20Message-Id: <20200716142601.111237-3-kwolf@redhat.com>
21Reviewed-by: Max Reitz <mreitz@redhat.com>
22Signed-off-by: Kevin Wolf <kwolf@redhat.com>
23
24Origin: backport, https://git.qemu.org/?p=qemu.git;a=commit;h=5edc85571e7b7269dce408735eba7507f18ac666
25Bug-Ubuntu: https://bugs.launchpad.net/bugs/1921665
26Last-Update: 2021-03-29
27
28---
29 block/file-posix.c | 26 +++++++++++++++++++++++++-
30 1 file changed, 25 insertions(+), 1 deletion(-)
31
32Index: qemu-4.2/block/file-posix.c
33===================================================================
34--- qemu-4.2.orig/block/file-posix.c 2021-03-29 16:38:00.008804168 +1300
35+++ qemu-4.2/block/file-posix.c 2021-03-29 16:38:00.008804168 +1300
36@@ -61,10 +61,12 @@
37 #include <sys/ioctl.h>
38 #include <sys/param.h>
39 #include <sys/syscall.h>
40+#include <sys/vfs.h>
41 #include <linux/cdrom.h>
42 #include <linux/fd.h>
43 #include <linux/fs.h>
44 #include <linux/hdreg.h>
45+#include <linux/magic.h>
46 #include <scsi/sg.h>
47 #ifdef __s390__
48 #include <asm/dasd.h>
49@@ -298,6 +300,28 @@
50 #endif
51 }
52
53+/*
54+ * Returns true if no alignment restrictions are necessary even for files
55+ * opened with O_DIRECT.
56+ *
57+ * raw_probe_alignment() probes the required alignment and assume that 1 means
58+ * the probing failed, so it falls back to a safe default of 4k. This can be
59+ * avoided if we know that byte alignment is okay for the file.
60+ */
61+static bool dio_byte_aligned(int fd)
62+{
63+#ifdef __linux__
64+ struct statfs buf;
65+ int ret;
66+
67+ ret = fstatfs(fd, &buf);
68+ if (ret == 0 && buf.f_type == NFS_SUPER_MAGIC) {
69+ return true;
70+ }
71+#endif
72+ return false;
73+}
74+
75 /* Check if read is allowed with given memory buffer and length.
76 *
77 * This function is used to check O_DIRECT memory buffer and request alignment.
78@@ -602,7 +626,7 @@
79
80 s->has_discard = true;
81 s->has_write_zeroes = true;
82- if ((bs->open_flags & BDRV_O_NOCACHE) != 0) {
83+ if ((bs->open_flags & BDRV_O_NOCACHE) != 0 && !dio_byte_aligned(s->fd)) {
84 s->needs_alignment = true;
85 }
86
diff --git a/debian/rules b/debian/rules
index e78d27d..6a55d5a 100755
--- a/debian/rules
+++ b/debian/rules
@@ -53,6 +53,7 @@ common_configure_opts = \
53 --disable-strip \53 --disable-strip \
54 --interp-prefix=/etc/qemu-binfmt/%M \54 --interp-prefix=/etc/qemu-binfmt/%M \
55 --localstatedir=/var \55 --localstatedir=/var \
56 --with-git-submodules=ignore \
5657
57# Cross compiling support58# Cross compiling support
58ifneq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))59ifneq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))

Subscribers

People subscribed via source and target branches