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

Subscribers

People subscribed via source and target branches