Merge ~sergiodj/ubuntu/+source/qemu:fix-virtiofsd-jammy into ubuntu/+source/qemu:ubuntu/jammy-devel

Proposed by Sergio Durigan Junior
Status: Merged
Approved by: git-ubuntu bot
Approved revision: not available
Merged at revision: 20e2b1e1f2b38be5e5e411cc6dc3577c387ffb3a
Proposed branch: ~sergiodj/ubuntu/+source/qemu:fix-virtiofsd-jammy
Merge into: ubuntu/+source/qemu:ubuntu/jammy-devel
Diff against target: 84 lines (+62/-0)
3 files modified
debian/changelog (+9/-0)
debian/patches/series (+1/-0)
debian/patches/ubuntu/lp-2033957-virtiofsd-Fix-breakage-due-to-fuse_init_in.patch (+52/-0)
Reviewer Review Type Date Requested Status
git-ubuntu bot Approve
Athos Ribeiro (community) Approve
Canonical Server Core Reviewers Pending
Canonical Server Reporter Pending
Review via email: mp+450752@code.launchpad.net

Description of the change

This is the fix for bug #2033957.

virtiofsd is failing to serve mountpoints due to a change in the Linux kernel headers we carry inside qemu. These headers were updated as part of the fix for bug #1853307, but virtiofsd relies on the fixed size of "struct fuse_init_in", but this size has changed.

The fix is simple (instead of parsing the whole binary struct, only parse the initial 16 bytes), and I opted to cherry-pick only the patch that implements this workaround, instead of backporting more commits from the following upstream merge:

https://gitlab.com/qemu-project/qemu/-/commit/242f2cae782d433d69d195e14564b6437ec9f7e6

The reason is because the commits from the merge above actually implement more virtiofsd features, which is not suitable for an SRU.

dep8 & qemu-migration-test results pending.

To post a comment you must log in.
Revision history for this message
Sergio Durigan Junior (sergiodj) wrote :
Revision history for this message
Sergio Durigan Junior (sergiodj) wrote :

I'll write the SRU template tomorrow; gotta get some sleep first.

Revision history for this message
Athos Ribeiro (athos-ribeiro) wrote :

DEP8 test results:

* Results:
  - qemu/1:6.2+dfsg-2ubuntu6.14~ppa1
    + ✅ qemu on jammy for amd64 @ 06.09.23 14:49:41 Log️ 🗒️
    + ✅ qemu on jammy for arm64 @ 06.09.23 14:54:59 Log️ 🗒️
    + ✅ qemu on jammy for armhf @ 06.09.23 15:03:37 Log️ 🗒️
    + ✅ qemu on jammy for ppc64el @ 06.09.23 14:52:35 Log️ 🗒️
    + ✅ qemu on jammy for s390x @ 06.09.23 15:05:55 Log️ 🗒️

LGTM! Thanks, Sergio :)

review: Approve
Revision history for this message
git-ubuntu bot (git-ubuntu-bot) wrote :

Approvers: sergiodj, athos-ribeiro
Uploaders: sergiodj, athos-ribeiro
MP auto-approved

review: Approve
Revision history for this message
Sergio Durigan Junior (sergiodj) wrote :

Thanks, Athos.

Uploaded:

$ dput qemu_6.2+dfsg-2ubuntu6.14_source.changes
Trying to upload package to ubuntu
Checking signature on .changes
gpg: /home/sergio/work/qemu/qemu_6.2+dfsg-2ubuntu6.14_source.changes: Valid signature from 106DA1C8C3CBBF14
Checking signature on .dsc
gpg: /home/sergio/work/qemu/qemu_6.2+dfsg-2ubuntu6.14.dsc: Valid signature from 106DA1C8C3CBBF14
Uploading to ubuntu (via ftp to upload.ubuntu.com):
  Uploading qemu_6.2+dfsg-2ubuntu6.14.dsc: done.
  Uploading qemu_6.2+dfsg-2ubuntu6.14.debian.tar.xz: done.
  Uploading qemu_6.2+dfsg-2ubuntu6.14_source.buildinfo: done.
  Uploading qemu_6.2+dfsg-2ubuntu6.14_source.changes: done.
Successfully uploaded packages.

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 0a8434d..25778c5 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,12 @@
6+qemu (1:6.2+dfsg-2ubuntu6.14) jammy; urgency=medium
7+
8+ * d/u/lp-2033957-virtiofsd-Fix-breakage-due-to-fuse_init_in.patch:
9+ Fix virtiofsd breakage due to fuse_init_in size change, which
10+ happened because of the Linux kernel 5.17 headers that were
11+ imported in a previous patch. (LP: #2033957)
12+
13+ -- Sergio Durigan Junior <sergio.durigan@canonical.com> Tue, 05 Sep 2023 22:58:36 -0400
14+
15 qemu (1:6.2+dfsg-2ubuntu6.13) jammy; urgency=medium
16
17 * d/p/u/lp-1853307-*.patch: Backport patches to implement Enhanced
18diff --git a/debian/patches/series b/debian/patches/series
19index d7cebc7..8a036e2 100644
20--- a/debian/patches/series
21+++ b/debian/patches/series
22@@ -88,3 +88,4 @@ ubuntu/lp-1853307-s390x-pci-reflect-proper-maxstbl-for-groups-of-inter.patch
23 ubuntu/lp-1853307-s390x-pci-RPCIT-second-pass-when-mappings-exhausted.patch
24 ubuntu/lp-1853307-s390x-pci-shrink-DMA-aperture-to-be-bound-by-vfio-DM.patch
25 ubuntu/lp-1853307-s390x-pci-reset-ISM-passthrough-devices-on-shutdown-.patch
26+ubuntu/lp-2033957-virtiofsd-Fix-breakage-due-to-fuse_init_in.patch
27diff --git a/debian/patches/ubuntu/lp-2033957-virtiofsd-Fix-breakage-due-to-fuse_init_in.patch b/debian/patches/ubuntu/lp-2033957-virtiofsd-Fix-breakage-due-to-fuse_init_in.patch
28new file mode 100644
29index 0000000..478aa8f
30--- /dev/null
31+++ b/debian/patches/ubuntu/lp-2033957-virtiofsd-Fix-breakage-due-to-fuse_init_in.patch
32@@ -0,0 +1,52 @@
33+From: Vivek Goyal <vgoyal@redhat.com>
34+Date: Tue, 8 Feb 2022 15:48:04 -0500
35+Subject: virtiofsd: Fix breakage due to fuse_init_in size change
36+
37+Kernel version 5.17 has increased the size of "struct fuse_init_in" struct.
38+Previously this struct was 16 bytes and now it has been extended to
39+64 bytes in size.
40+
41+Once qemu headers are updated to latest, it will expect to receive 64 byte
42+size struct (for protocol version major 7 and minor > 6). But if guest is
43+booting older kernel (older than 5.17), then it still sends older
44+fuse_init_in of size 16 bytes. And do_init() fails. It is expecting
45+64 byte struct. And this results in mount of virtiofs failing.
46+
47+Fix this by parsing 16 bytes only for now. Separate patches will be
48+posted which will parse rest of the bytes and enable new functionality.
49+Right now we don't support any of the new functionality, so we don't
50+lose anything by not parsing bytes beyond 16.
51+
52+Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
53+Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
54+Message-Id: <20220208204813.682906-2-vgoyal@redhat.com>
55+Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
56+
57+Origin: upstream, https://gitlab.com/qemu-project/qemu/-/commit/a086d54c6ffa38f7e71f182b63a25315304a3392
58+Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/qemu/+bug/2033957
59+---
60+ tools/virtiofsd/fuse_lowlevel.c | 4 +++-
61+ 1 file changed, 3 insertions(+), 1 deletion(-)
62+
63+diff --git a/tools/virtiofsd/fuse_lowlevel.c b/tools/virtiofsd/fuse_lowlevel.c
64+index e4679c7..5d431a7 100644
65+--- a/tools/virtiofsd/fuse_lowlevel.c
66++++ b/tools/virtiofsd/fuse_lowlevel.c
67+@@ -1880,6 +1880,8 @@ static void do_init(fuse_req_t req, fuse_ino_t nodeid,
68+ struct fuse_mbuf_iter *iter)
69+ {
70+ size_t compat_size = offsetof(struct fuse_init_in, max_readahead);
71++ size_t compat2_size = offsetof(struct fuse_init_in, flags) +
72++ sizeof(uint32_t);
73+ struct fuse_init_in *arg;
74+ struct fuse_init_out outarg;
75+ struct fuse_session *se = req->se;
76+@@ -1897,7 +1899,7 @@ static void do_init(fuse_req_t req, fuse_ino_t nodeid,
77+
78+ /* ...and now consume the new fields. */
79+ if (arg->major == 7 && arg->minor >= 6) {
80+- if (!fuse_mbuf_iter_advance(iter, sizeof(*arg) - compat_size)) {
81++ if (!fuse_mbuf_iter_advance(iter, compat2_size - compat_size)) {
82+ fuse_reply_err(req, EINVAL);
83+ return;
84+ }

Subscribers

People subscribed via source and target branches