Compare commits
8 Commits
master
...
f33-riscv6
Author | SHA1 | Date | |
---|---|---|---|
56ec336b9a | |||
|
95cc694fb2 | ||
|
598ad396bd | ||
3df5453514 | |||
60b7351118 | |||
|
0d7eae515e | ||
|
4289f9c187 | ||
|
a3604ac316 |
@ -1,7 +1,6 @@
|
||||
From 44716867275c9a5cdead2d70e6187b5af4087f07 Mon Sep 17 00:00:00 2001
|
||||
From: Laurent Vivier <laurent@vivier.eu>
|
||||
Date: Thu, 3 Sep 2020 01:26:53 +0200
|
||||
Subject: [PATCH 1/9] linux-user: fix implicit conversion from enumeration type
|
||||
Subject: [PATCH] linux-user: fix implicit conversion from enumeration type
|
||||
error
|
||||
|
||||
MK_ARRAY(type,size) is used to fill the field_types buffer, and if the
|
||||
@ -30,6 +29,3 @@ index 7992475c9f..2099482cff 100644
|
||||
#define MK_STRUCT(id) TYPE_STRUCT, id
|
||||
|
||||
#define THUNK_TARGET 0
|
||||
--
|
||||
2.26.2
|
||||
|
||||
|
@ -1,8 +1,7 @@
|
||||
From e0eab99255d34c9dbaac7b73a1a2a79f823a7da9 Mon Sep 17 00:00:00 2001
|
||||
From: Filip Bozuta <Filip.Bozuta@syrmia.com>
|
||||
Date: Thu, 3 Sep 2020 01:26:54 +0200
|
||||
Subject: [PATCH 2/9] linux-user: Add support for a group of btrfs ioctls used
|
||||
for subvolumes
|
||||
Subject: [PATCH] linux-user: Add support for a group of btrfs ioctls used for
|
||||
subvolumes
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
@ -259,6 +258,3 @@ index 3f1f033464..db61dbc1b3 100644
|
||||
STRUCT(rtc_time,
|
||||
TYPE_INT, /* tm_sec */
|
||||
TYPE_INT, /* tm_min */
|
||||
--
|
||||
2.26.2
|
||||
|
||||
|
@ -1,8 +1,7 @@
|
||||
From 40fdd783ec707e61c285e081816bd2df54dfede4 Mon Sep 17 00:00:00 2001
|
||||
From: Filip Bozuta <Filip.Bozuta@syrmia.com>
|
||||
Date: Thu, 3 Sep 2020 01:26:55 +0200
|
||||
Subject: [PATCH 3/9] linux-user: Add support for a group of btrfs ioctls used
|
||||
for snapshots
|
||||
Subject: [PATCH] linux-user: Add support for a group of btrfs ioctls used for
|
||||
snapshots
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
@ -93,6 +92,3 @@ index db61dbc1b3..038cd7869b 100644
|
||||
STRUCT(btrfs_ioctl_vol_args,
|
||||
TYPE_LONGLONG, /* fd */
|
||||
MK_ARRAY(TYPE_CHAR, BTRFS_PATH_NAME_MAX + 1)) /* name */
|
||||
--
|
||||
2.26.2
|
||||
|
||||
|
@ -1,8 +1,7 @@
|
||||
From ead1cdc1e4bb9fa4d09ca4d8af94c2687e7f5d36 Mon Sep 17 00:00:00 2001
|
||||
From: Filip Bozuta <Filip.Bozuta@syrmia.com>
|
||||
Date: Thu, 3 Sep 2020 01:26:56 +0200
|
||||
Subject: [PATCH 4/9] linux-user: Add support for btrfs ioctls used to
|
||||
manipulate with devices
|
||||
Subject: [PATCH] linux-user: Add support for btrfs ioctls used to manipulate
|
||||
with devices
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
@ -217,6 +216,3 @@ index 038cd7869b..ea6898979b 100644
|
||||
STRUCT(rtc_time,
|
||||
TYPE_INT, /* tm_sec */
|
||||
TYPE_INT, /* tm_min */
|
||||
--
|
||||
2.26.2
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
From 5793eb73d4d6d37293c6ca95ed85414fcccb9662 Mon Sep 17 00:00:00 2001
|
||||
From: Filip Bozuta <Filip.Bozuta@syrmia.com>
|
||||
Date: Thu, 3 Sep 2020 01:26:57 +0200
|
||||
Subject: [PATCH 5/9] linux-user: Add support for btrfs ioctls used to get/set
|
||||
Subject: [PATCH] linux-user: Add support for btrfs ioctls used to get/set
|
||||
features
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
@ -115,6 +114,3 @@ index ea6898979b..925054cfd4 100644
|
||||
STRUCT(rtc_time,
|
||||
TYPE_INT, /* tm_sec */
|
||||
TYPE_INT, /* tm_min */
|
||||
--
|
||||
2.26.2
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
From 79116330e3eea392dec9a1f38fddf3449ad0195a Mon Sep 17 00:00:00 2001
|
||||
From: Filip Bozuta <Filip.Bozuta@syrmia.com>
|
||||
Date: Thu, 3 Sep 2020 01:26:58 +0200
|
||||
Subject: [PATCH 6/9] linux-user: Add support for a group of btrfs inode ioctls
|
||||
Subject: [PATCH] linux-user: Add support for a group of btrfs inode ioctls
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
@ -231,6 +230,3 @@ index 925054cfd4..b84e14235f 100644
|
||||
#ifdef BTRFS_IOC_DEV_INFO
|
||||
STRUCT(btrfs_ioctl_dev_info_args,
|
||||
TYPE_ULONGLONG, /* devid */
|
||||
--
|
||||
2.26.2
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
From 58252f756d7fb2a8516c0815034c0bded4697852 Mon Sep 17 00:00:00 2001
|
||||
From: Filip Bozuta <Filip.Bozuta@syrmia.com>
|
||||
Date: Thu, 3 Sep 2020 01:26:59 +0200
|
||||
Subject: [PATCH 7/9] linux-user: Add support for two btrfs ioctls used for
|
||||
Subject: [PATCH] linux-user: Add support for two btrfs ioctls used for
|
||||
subvolume
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
@ -127,6 +126,3 @@ index b84e14235f..5566d101c2 100644
|
||||
#ifdef BTRFS_IOC_GET_DEV_STATS
|
||||
STRUCT(btrfs_ioctl_get_dev_stats,
|
||||
TYPE_ULONGLONG, /* devid */
|
||||
--
|
||||
2.26.2
|
||||
|
||||
|
@ -1,8 +1,6 @@
|
||||
From d62c16ff35a17743c2a0f8ebfb39f84064afcb3c Mon Sep 17 00:00:00 2001
|
||||
From: Filip Bozuta <Filip.Bozuta@syrmia.com>
|
||||
Date: Thu, 3 Sep 2020 01:27:00 +0200
|
||||
Subject: [PATCH 8/9] linux-user: Add support for btrfs ioctls used to manage
|
||||
quota
|
||||
Subject: [PATCH] linux-user: Add support for btrfs ioctls used to manage quota
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
@ -230,6 +228,3 @@ index 5566d101c2..d9b7106a69 100644
|
||||
STRUCT(btrfs_ioctl_feature_flags,
|
||||
TYPE_ULONGLONG, /* compat_flags */
|
||||
TYPE_ULONGLONG, /* compat_ro_flags */
|
||||
--
|
||||
2.26.2
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
From 5695918e7c599f21fd6913a61160c482a0e41639 Mon Sep 17 00:00:00 2001
|
||||
From: Filip Bozuta <Filip.Bozuta@syrmia.com>
|
||||
Date: Thu, 3 Sep 2020 01:27:01 +0200
|
||||
Subject: [PATCH 9/9] linux-user: Add support for btrfs ioctls used to scrub a
|
||||
Subject: [PATCH] linux-user: Add support for btrfs ioctls used to scrub a
|
||||
filesystem
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
@ -137,6 +136,3 @@ index d9b7106a69..789723cfb9 100644
|
||||
#ifdef BTRFS_IOC_DEV_INFO
|
||||
STRUCT(btrfs_ioctl_dev_info_args,
|
||||
TYPE_ULONGLONG, /* devid */
|
||||
--
|
||||
2.26.2
|
||||
|
||||
|
35
0101-virtiofsd-drop-CAP_DAC_READ_SEARCH.patch
Normal file
35
0101-virtiofsd-drop-CAP_DAC_READ_SEARCH.patch
Normal file
@ -0,0 +1,35 @@
|
||||
From: Stefan Hajnoczi <stefanha@redhat.com>
|
||||
Date: Mon, 27 Jul 2020 20:02:21 +0100
|
||||
Subject: [PATCH] virtiofsd: drop CAP_DAC_READ_SEARCH
|
||||
|
||||
virtiofsd does not need CAP_DAC_READ_SEARCH because it already has
|
||||
the more powerful CAP_DAC_OVERRIDE. Drop it from the list of
|
||||
capabilities.
|
||||
|
||||
This is important because container runtimes may not include
|
||||
CAP_DAC_READ_SEARCH by default. This patch allows virtiofsd to reduce
|
||||
its capabilities when running inside a Docker container.
|
||||
|
||||
Note that CAP_DAC_READ_SEARCH may be necessary again in the future if
|
||||
virtiofsd starts using open_by_handle_at(2).
|
||||
|
||||
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
|
||||
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
|
||||
Message-Id: <20200727190223.422280-2-stefanha@redhat.com>
|
||||
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
|
||||
---
|
||||
tools/virtiofsd/passthrough_ll.c | 1 -
|
||||
1 file changed, 1 deletion(-)
|
||||
|
||||
diff --git a/tools/virtiofsd/passthrough_ll.c b/tools/virtiofsd/passthrough_ll.c
|
||||
index 94e0de2d2b..50a164a599 100644
|
||||
--- a/tools/virtiofsd/passthrough_ll.c
|
||||
+++ b/tools/virtiofsd/passthrough_ll.c
|
||||
@@ -2596,7 +2596,6 @@ static void setup_capabilities(char *modcaps_in)
|
||||
if (capng_updatev(CAPNG_ADD, CAPNG_PERMITTED | CAPNG_EFFECTIVE,
|
||||
CAP_CHOWN,
|
||||
CAP_DAC_OVERRIDE,
|
||||
- CAP_DAC_READ_SEARCH,
|
||||
CAP_FOWNER,
|
||||
CAP_FSETID,
|
||||
CAP_SETGID,
|
118
0102-virtiofsd-avoid-proc-self-fd-tempdir.patch
Normal file
118
0102-virtiofsd-avoid-proc-self-fd-tempdir.patch
Normal file
@ -0,0 +1,118 @@
|
||||
From: Stefan Hajnoczi <stefanha@redhat.com>
|
||||
Date: Tue, 6 Oct 2020 10:58:26 +0100
|
||||
Subject: [PATCH] virtiofsd: avoid /proc/self/fd tempdir
|
||||
|
||||
In order to prevent /proc/self/fd escapes a temporary directory is
|
||||
created where /proc/self/fd is bind-mounted. This doesn't work on
|
||||
read-only file systems.
|
||||
|
||||
Avoid the temporary directory by bind-mounting /proc/self/fd over /proc.
|
||||
This does not affect other processes since we remounted / with MS_REC |
|
||||
MS_SLAVE. /proc must exist and virtiofsd does not use it so it's safe to
|
||||
do this.
|
||||
|
||||
Path traversal can be tested with the following function:
|
||||
|
||||
static void test_proc_fd_escape(struct lo_data *lo)
|
||||
{
|
||||
int fd;
|
||||
int level = 0;
|
||||
ino_t last_ino = 0;
|
||||
|
||||
fd = lo->proc_self_fd;
|
||||
for (;;) {
|
||||
struct stat st;
|
||||
|
||||
if (fstat(fd, &st) != 0) {
|
||||
perror("fstat");
|
||||
return;
|
||||
}
|
||||
if (last_ino && st.st_ino == last_ino) {
|
||||
fprintf(stderr, "inode number unchanged, stopping\n");
|
||||
return;
|
||||
}
|
||||
last_ino = st.st_ino;
|
||||
|
||||
fprintf(stderr, "Level %d dev %lu ino %lu\n", level,
|
||||
(unsigned long)st.st_dev,
|
||||
(unsigned long)last_ino);
|
||||
fd = openat(fd, "..", O_PATH | O_DIRECTORY | O_NOFOLLOW);
|
||||
level++;
|
||||
}
|
||||
}
|
||||
|
||||
Before and after this patch only Level 0 is displayed. Without
|
||||
/proc/self/fd bind-mount protection it is possible to traverse parent
|
||||
directories.
|
||||
|
||||
Fixes: 397ae982f4df4 ("virtiofsd: jail lo->proc_self_fd")
|
||||
Cc: Miklos Szeredi <mszeredi@redhat.com>
|
||||
Cc: Jens Freimann <jfreimann@redhat.com>
|
||||
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
|
||||
Message-Id: <20201006095826.59813-1-stefanha@redhat.com>
|
||||
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
|
||||
Tested-by: Jens Freimann <jfreimann@redhat.com>
|
||||
Reviewed-by: Jens Freimann <jfreimann@redhat.com>
|
||||
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
|
||||
---
|
||||
tools/virtiofsd/passthrough_ll.c | 34 +++++++++++---------------------
|
||||
1 file changed, 11 insertions(+), 23 deletions(-)
|
||||
|
||||
diff --git a/tools/virtiofsd/passthrough_ll.c b/tools/virtiofsd/passthrough_ll.c
|
||||
index 50a164a599..b865dc564b 100644
|
||||
--- a/tools/virtiofsd/passthrough_ll.c
|
||||
+++ b/tools/virtiofsd/passthrough_ll.c
|
||||
@@ -2386,8 +2386,6 @@ static void setup_wait_parent_capabilities(void)
|
||||
static void setup_namespaces(struct lo_data *lo, struct fuse_session *se)
|
||||
{
|
||||
pid_t child;
|
||||
- char template[] = "virtiofsd-XXXXXX";
|
||||
- char *tmpdir;
|
||||
|
||||
/*
|
||||
* Create a new pid namespace for *child* processes. We'll have to
|
||||
@@ -2451,33 +2449,23 @@ static void setup_namespaces(struct lo_data *lo, struct fuse_session *se)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
- tmpdir = mkdtemp(template);
|
||||
- if (!tmpdir) {
|
||||
- fuse_log(FUSE_LOG_ERR, "tmpdir(%s): %m\n", template);
|
||||
- exit(1);
|
||||
- }
|
||||
-
|
||||
- if (mount("/proc/self/fd", tmpdir, NULL, MS_BIND, NULL) < 0) {
|
||||
- fuse_log(FUSE_LOG_ERR, "mount(/proc/self/fd, %s, MS_BIND): %m\n",
|
||||
- tmpdir);
|
||||
+ /*
|
||||
+ * We only need /proc/self/fd. Prevent ".." from accessing parent
|
||||
+ * directories of /proc/self/fd by bind-mounting it over /proc. Since / was
|
||||
+ * previously remounted with MS_REC | MS_SLAVE this mount change only
|
||||
+ * affects our process.
|
||||
+ */
|
||||
+ if (mount("/proc/self/fd", "/proc", NULL, MS_BIND, NULL) < 0) {
|
||||
+ fuse_log(FUSE_LOG_ERR, "mount(/proc/self/fd, MS_BIND): %m\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
- /* Now we can get our /proc/self/fd directory file descriptor */
|
||||
- lo->proc_self_fd = open(tmpdir, O_PATH);
|
||||
+ /* Get the /proc (actually /proc/self/fd, see above) file descriptor */
|
||||
+ lo->proc_self_fd = open("/proc", O_PATH);
|
||||
if (lo->proc_self_fd == -1) {
|
||||
- fuse_log(FUSE_LOG_ERR, "open(%s, O_PATH): %m\n", tmpdir);
|
||||
+ fuse_log(FUSE_LOG_ERR, "open(/proc, O_PATH): %m\n");
|
||||
exit(1);
|
||||
}
|
||||
-
|
||||
- if (umount2(tmpdir, MNT_DETACH) < 0) {
|
||||
- fuse_log(FUSE_LOG_ERR, "umount2(%s, MNT_DETACH): %m\n", tmpdir);
|
||||
- exit(1);
|
||||
- }
|
||||
-
|
||||
- if (rmdir(tmpdir) < 0) {
|
||||
- fuse_log(FUSE_LOG_ERR, "rmdir(%s): %m\n", tmpdir);
|
||||
- }
|
||||
}
|
||||
|
||||
/*
|
141
0103-virtio-skip-legacy-support-check-on-machine-types-le.patch
Normal file
141
0103-virtio-skip-legacy-support-check-on-machine-types-le.patch
Normal file
@ -0,0 +1,141 @@
|
||||
From: Stefano Garzarella <sgarzare@redhat.com>
|
||||
Date: Mon, 21 Sep 2020 14:25:03 +0200
|
||||
Subject: [PATCH] virtio: skip legacy support check on machine types less than
|
||||
5.1
|
||||
|
||||
Commit 9b3a35ec82 ("virtio: verify that legacy support is not accidentally
|
||||
on") added a check that returns an error if legacy support is on, but the
|
||||
device does not support legacy.
|
||||
|
||||
Unfortunately some devices were wrongly declared legacy capable even if
|
||||
they were not (e.g vhost-vsock).
|
||||
|
||||
To avoid migration issues, we add a virtio-device property
|
||||
(x-disable-legacy-check) to skip the legacy error, printing a warning
|
||||
instead, for machine types < 5.1.
|
||||
|
||||
Cc: qemu-stable@nongnu.org
|
||||
Fixes: 9b3a35ec82 ("virtio: verify that legacy support is not accidentally on")
|
||||
Suggested-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
|
||||
Suggested-by: Cornelia Huck <cohuck@redhat.com>
|
||||
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
|
||||
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
|
||||
Message-Id: <20200921122506.82515-2-sgarzare@redhat.com>
|
||||
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
|
||||
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
|
||||
(cherry picked from commit d55f518248f263bb8d0852f98e47102ea09d4f89)
|
||||
---
|
||||
hw/core/machine.c | 1 +
|
||||
hw/s390x/virtio-ccw.c | 15 ++++++++++++---
|
||||
hw/virtio/virtio-pci.c | 14 ++++++++++++--
|
||||
hw/virtio/virtio.c | 7 +++++++
|
||||
include/hw/virtio/virtio.h | 2 ++
|
||||
5 files changed, 34 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/hw/core/machine.c b/hw/core/machine.c
|
||||
index 8d1a90c6cf..0af18af593 100644
|
||||
--- a/hw/core/machine.c
|
||||
+++ b/hw/core/machine.c
|
||||
@@ -35,6 +35,7 @@ GlobalProperty hw_compat_5_0[] = {
|
||||
{ "vmport", "x-signal-unsupported-cmd", "off" },
|
||||
{ "vmport", "x-report-vmx-type", "off" },
|
||||
{ "vmport", "x-cmds-v2", "off" },
|
||||
+ { "virtio-device", "x-disable-legacy-check", "true" },
|
||||
};
|
||||
const size_t hw_compat_5_0_len = G_N_ELEMENTS(hw_compat_5_0);
|
||||
|
||||
diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c
|
||||
index 0e60270297..3dfc93d4f6 100644
|
||||
--- a/hw/s390x/virtio-ccw.c
|
||||
+++ b/hw/s390x/virtio-ccw.c
|
||||
@@ -1122,9 +1122,18 @@ static void virtio_ccw_device_plugged(DeviceState *d, Error **errp)
|
||||
}
|
||||
|
||||
if (!virtio_ccw_rev_max(dev) && !virtio_legacy_allowed(vdev)) {
|
||||
- error_setg(errp, "Invalid value of property max_rev "
|
||||
- "(is %d expected >= 1)", virtio_ccw_rev_max(dev));
|
||||
- return;
|
||||
+ /*
|
||||
+ * To avoid migration issues, we allow legacy mode when legacy
|
||||
+ * check is disabled in the old machine types (< 5.1).
|
||||
+ */
|
||||
+ if (virtio_legacy_check_disabled(vdev)) {
|
||||
+ warn_report("device requires revision >= 1, but for backward "
|
||||
+ "compatibility max_revision=0 is allowed");
|
||||
+ } else {
|
||||
+ error_setg(errp, "Invalid value of property max_rev "
|
||||
+ "(is %d expected >= 1)", virtio_ccw_rev_max(dev));
|
||||
+ return;
|
||||
+ }
|
||||
}
|
||||
|
||||
if (virtio_get_num_queues(vdev) > VIRTIO_QUEUE_MAX) {
|
||||
diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c
|
||||
index ccdf54e81c..4211565f2c 100644
|
||||
--- a/hw/virtio/virtio-pci.c
|
||||
+++ b/hw/virtio/virtio-pci.c
|
||||
@@ -1596,8 +1596,18 @@ static void virtio_pci_device_plugged(DeviceState *d, Error **errp)
|
||||
|
||||
if (legacy) {
|
||||
if (!virtio_legacy_allowed(vdev)) {
|
||||
- error_setg(errp, "device is modern-only, use disable-legacy=on");
|
||||
- return;
|
||||
+ /*
|
||||
+ * To avoid migration issues, we allow legacy mode when legacy
|
||||
+ * check is disabled in the old machine types (< 5.1).
|
||||
+ */
|
||||
+ if (virtio_legacy_check_disabled(vdev)) {
|
||||
+ warn_report("device is modern-only, but for backward "
|
||||
+ "compatibility legacy is allowed");
|
||||
+ } else {
|
||||
+ error_setg(errp,
|
||||
+ "device is modern-only, use disable-legacy=on");
|
||||
+ return;
|
||||
+ }
|
||||
}
|
||||
if (virtio_host_has_feature(vdev, VIRTIO_F_IOMMU_PLATFORM)) {
|
||||
error_setg(errp, "VIRTIO_F_IOMMU_PLATFORM was supported by"
|
||||
diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
|
||||
index e983025217..b85277da67 100644
|
||||
--- a/hw/virtio/virtio.c
|
||||
+++ b/hw/virtio/virtio.c
|
||||
@@ -3304,6 +3304,11 @@ bool virtio_legacy_allowed(VirtIODevice *vdev)
|
||||
}
|
||||
}
|
||||
|
||||
+bool virtio_legacy_check_disabled(VirtIODevice *vdev)
|
||||
+{
|
||||
+ return vdev->disable_legacy_check;
|
||||
+}
|
||||
+
|
||||
hwaddr virtio_queue_get_desc_addr(VirtIODevice *vdev, int n)
|
||||
{
|
||||
return vdev->vq[n].vring.desc;
|
||||
@@ -3713,6 +3718,8 @@ static Property virtio_properties[] = {
|
||||
DEFINE_VIRTIO_COMMON_FEATURES(VirtIODevice, host_features),
|
||||
DEFINE_PROP_BOOL("use-started", VirtIODevice, use_started, true),
|
||||
DEFINE_PROP_BOOL("use-disabled-flag", VirtIODevice, use_disabled_flag, true),
|
||||
+ DEFINE_PROP_BOOL("x-disable-legacy-check", VirtIODevice,
|
||||
+ disable_legacy_check, false),
|
||||
DEFINE_PROP_END_OF_LIST(),
|
||||
};
|
||||
|
||||
diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h
|
||||
index e424df12cf..c50f5a9dfe 100644
|
||||
--- a/include/hw/virtio/virtio.h
|
||||
+++ b/include/hw/virtio/virtio.h
|
||||
@@ -105,6 +105,7 @@ struct VirtIODevice
|
||||
bool use_started;
|
||||
bool started;
|
||||
bool start_on_kick; /* when virtio 1.0 feature has not been negotiated */
|
||||
+ bool disable_legacy_check;
|
||||
VMChangeStateEntry *vmstate;
|
||||
char *bus_name;
|
||||
uint8_t device_endian;
|
||||
@@ -398,5 +399,6 @@ static inline bool virtio_device_disabled(VirtIODevice *vdev)
|
||||
}
|
||||
|
||||
bool virtio_legacy_allowed(VirtIODevice *vdev);
|
||||
+bool virtio_legacy_check_disabled(VirtIODevice *vdev);
|
||||
|
||||
#endif
|
71
0104-vhost-vsock-pci-force-virtio-version-1.patch
Normal file
71
0104-vhost-vsock-pci-force-virtio-version-1.patch
Normal file
@ -0,0 +1,71 @@
|
||||
From: Stefano Garzarella <sgarzare@redhat.com>
|
||||
Date: Mon, 21 Sep 2020 14:25:04 +0200
|
||||
Subject: [PATCH] vhost-vsock-pci: force virtio version 1
|
||||
|
||||
Commit 9b3a35ec82 ("virtio: verify that legacy support is not
|
||||
accidentally on") added a safety check that requires to set
|
||||
'disable-legacy=on' on vhost-vsock-pci device:
|
||||
|
||||
$ ./qemu-system-x86_64 ... -device vhost-vsock-pci,guest-cid=5
|
||||
qemu-system-x86_64: -device vhost-vsock-pci,guest-cid=5:
|
||||
device is modern-only, use disable-legacy=on
|
||||
|
||||
virtio-vsock was introduced after the release of VIRTIO 1.0
|
||||
specifications, so it should be 'modern-only'.
|
||||
In addition Cornelia verified that forcing a legacy mode on
|
||||
vhost-vsock-pci device using x86-64 host and s390x guest, so with
|
||||
different endianness, produces strange behaviours.
|
||||
|
||||
This patch forces virtio version 1 and removes the 'transitional_name'
|
||||
property removing the need to specify 'disable-legacy=on' on
|
||||
vhost-vsock-pci device.
|
||||
|
||||
To avoid migration issues, we force virtio version 1 only when
|
||||
legacy check is enabled in the new machine types (>= 5.1).
|
||||
|
||||
As the transitional device name is not commonly used, we do not
|
||||
provide compatibility handling for it.
|
||||
|
||||
Cc: qemu-stable@nongnu.org
|
||||
Reported-by: Qian Cai <caiqian@redhat.com>
|
||||
Reported-by: Qinghua Cheng <qcheng@redhat.com>
|
||||
Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=1868449
|
||||
Suggested-by: Cornelia Huck <cohuck@redhat.com>
|
||||
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
|
||||
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
|
||||
Message-Id: <20200921122506.82515-3-sgarzare@redhat.com>
|
||||
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
|
||||
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
|
||||
(cherry picked from commit 6209070503989cf4f28549f228989419d4f0b236)
|
||||
---
|
||||
hw/virtio/vhost-vsock-pci.c | 10 +++++++++-
|
||||
1 file changed, 9 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/hw/virtio/vhost-vsock-pci.c b/hw/virtio/vhost-vsock-pci.c
|
||||
index a815278e69..f11a38292f 100644
|
||||
--- a/hw/virtio/vhost-vsock-pci.c
|
||||
+++ b/hw/virtio/vhost-vsock-pci.c
|
||||
@@ -43,6 +43,15 @@ static void vhost_vsock_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp)
|
||||
{
|
||||
VHostVSockPCI *dev = VHOST_VSOCK_PCI(vpci_dev);
|
||||
DeviceState *vdev = DEVICE(&dev->vdev);
|
||||
+ VirtIODevice *virtio_dev = VIRTIO_DEVICE(vdev);
|
||||
+
|
||||
+ /*
|
||||
+ * To avoid migration issues, we force virtio version 1 only when
|
||||
+ * legacy check is enabled in the new machine types (>= 5.1).
|
||||
+ */
|
||||
+ if (!virtio_legacy_check_disabled(virtio_dev)) {
|
||||
+ virtio_pci_force_virtio_1(vpci_dev);
|
||||
+ }
|
||||
|
||||
qdev_realize(vdev, BUS(&vpci_dev->bus), errp);
|
||||
}
|
||||
@@ -72,7 +81,6 @@ static void vhost_vsock_pci_instance_init(Object *obj)
|
||||
static const VirtioPCIDeviceTypeInfo vhost_vsock_pci_info = {
|
||||
.base_name = TYPE_VHOST_VSOCK_PCI,
|
||||
.generic_name = "vhost-vsock-pci",
|
||||
- .transitional_name = "vhost-vsock-pci-transitional",
|
||||
.non_transitional_name = "vhost-vsock-pci-non-transitional",
|
||||
.instance_size = sizeof(VHostVSockPCI),
|
||||
.instance_init = vhost_vsock_pci_instance_init,
|
55
0105-vhost-user-vsock-pci-force-virtio-version-1.patch
Normal file
55
0105-vhost-user-vsock-pci-force-virtio-version-1.patch
Normal file
@ -0,0 +1,55 @@
|
||||
From: Stefano Garzarella <sgarzare@redhat.com>
|
||||
Date: Mon, 21 Sep 2020 14:25:05 +0200
|
||||
Subject: [PATCH] vhost-user-vsock-pci: force virtio version 1
|
||||
|
||||
Commit 9b3a35ec82 ("virtio: verify that legacy support is not
|
||||
accidentally on") added a safety check that requires to set
|
||||
'disable-legacy=on' on vhost-user-vsock-pci device:
|
||||
|
||||
$ ./qemu-system-x86_64 ... \
|
||||
-chardev socket,id=char0,reconnect=0,path=/tmp/vhost4.socket \
|
||||
-device vhost-user-vsock-pci,chardev=char0
|
||||
qemu-system-x86_64: -device vhost-user-vsock-pci,chardev=char0:
|
||||
device is modern-only, use disable-legacy=on
|
||||
|
||||
virtio-vsock was introduced after the release of VIRTIO 1.0
|
||||
specifications, so it should be 'modern-only'.
|
||||
|
||||
This patch forces virtio version 1 and removes the 'transitional_name'
|
||||
property, as done for vhost-vsock-pci, removing the need to specify
|
||||
'disable-legacy=on' on vhost-user-vsock-pci device.
|
||||
|
||||
Cc: qemu-stable@nongnu.org
|
||||
Suggested-by: Cornelia Huck <cohuck@redhat.com>
|
||||
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
|
||||
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
|
||||
Message-Id: <20200921122506.82515-4-sgarzare@redhat.com>
|
||||
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
|
||||
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
|
||||
(cherry picked from commit 27eda699f59d430c33fc054a36a17251992e70dc)
|
||||
---
|
||||
hw/virtio/vhost-user-vsock-pci.c | 4 +++-
|
||||
1 file changed, 3 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/hw/virtio/vhost-user-vsock-pci.c b/hw/virtio/vhost-user-vsock-pci.c
|
||||
index f4cf95873d..492df6418a 100644
|
||||
--- a/hw/virtio/vhost-user-vsock-pci.c
|
||||
+++ b/hw/virtio/vhost-user-vsock-pci.c
|
||||
@@ -40,6 +40,9 @@ static void vhost_user_vsock_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp)
|
||||
VHostUserVSockPCI *dev = VHOST_USER_VSOCK_PCI(vpci_dev);
|
||||
DeviceState *vdev = DEVICE(&dev->vdev);
|
||||
|
||||
+ /* unlike vhost-vsock, we do not need to care about pre-5.1 compat */
|
||||
+ virtio_pci_force_virtio_1(vpci_dev);
|
||||
+
|
||||
qdev_realize(vdev, BUS(&vpci_dev->bus), errp);
|
||||
}
|
||||
|
||||
@@ -68,7 +71,6 @@ static void vhost_user_vsock_pci_instance_init(Object *obj)
|
||||
static const VirtioPCIDeviceTypeInfo vhost_user_vsock_pci_info = {
|
||||
.base_name = TYPE_VHOST_USER_VSOCK_PCI,
|
||||
.generic_name = "vhost-user-vsock-pci",
|
||||
- .transitional_name = "vhost-user-vsock-pci-transitional",
|
||||
.non_transitional_name = "vhost-user-vsock-pci-non-transitional",
|
||||
.instance_size = sizeof(VHostUserVSockPCI),
|
||||
.instance_init = vhost_user_vsock_pci_instance_init,
|
50
0106-vhost-vsock-ccw-force-virtio-version-1.patch
Normal file
50
0106-vhost-vsock-ccw-force-virtio-version-1.patch
Normal file
@ -0,0 +1,50 @@
|
||||
From: Stefano Garzarella <sgarzare@redhat.com>
|
||||
Date: Mon, 21 Sep 2020 14:25:06 +0200
|
||||
Subject: [PATCH] vhost-vsock-ccw: force virtio version 1
|
||||
|
||||
virtio-vsock was introduced after the release of VIRTIO 1.0
|
||||
specifications, so it should be 'modern-only'.
|
||||
|
||||
This patch forces virtio version 1 as done for vhost-vsock-pci.
|
||||
|
||||
To avoid migration issues, we force virtio version 1 only when
|
||||
legacy check is enabled in the new machine types (>= 5.1).
|
||||
|
||||
Cc: qemu-stable@nongnu.org
|
||||
Suggested-by: Cornelia Huck <cohuck@redhat.com>
|
||||
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
|
||||
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
|
||||
Message-Id: <20200921122506.82515-5-sgarzare@redhat.com>
|
||||
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
|
||||
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
|
||||
(cherry picked from commit a6704a34cf02add13964149e0de6453ae62bd9db)
|
||||
---
|
||||
hw/s390x/vhost-vsock-ccw.c | 12 ++++++++++++
|
||||
1 file changed, 12 insertions(+)
|
||||
|
||||
diff --git a/hw/s390x/vhost-vsock-ccw.c b/hw/s390x/vhost-vsock-ccw.c
|
||||
index 0822ecca89..246416a8f9 100644
|
||||
--- a/hw/s390x/vhost-vsock-ccw.c
|
||||
+++ b/hw/s390x/vhost-vsock-ccw.c
|
||||
@@ -40,9 +40,21 @@ static void vhost_vsock_ccw_class_init(ObjectClass *klass, void *data)
|
||||
static void vhost_vsock_ccw_instance_init(Object *obj)
|
||||
{
|
||||
VHostVSockCCWState *dev = VHOST_VSOCK_CCW(obj);
|
||||
+ VirtioCcwDevice *ccw_dev = VIRTIO_CCW_DEVICE(obj);
|
||||
+ VirtIODevice *virtio_dev;
|
||||
|
||||
virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev),
|
||||
TYPE_VHOST_VSOCK);
|
||||
+
|
||||
+ virtio_dev = VIRTIO_DEVICE(&dev->vdev);
|
||||
+
|
||||
+ /*
|
||||
+ * To avoid migration issues, we force virtio version 1 only when
|
||||
+ * legacy check is enabled in the new machine types (>= 5.1).
|
||||
+ */
|
||||
+ if (!virtio_legacy_check_disabled(virtio_dev)) {
|
||||
+ ccw_dev->force_revision_1 = true;
|
||||
+ }
|
||||
}
|
||||
|
||||
static const TypeInfo vhost_vsock_ccw_info = {
|
10
qemu-kvm.sh
10
qemu-kvm.sh
@ -1,10 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Libvirt introspects the binary using -M none. In that case, don't try
|
||||
# to init KVM, which will fail and be noisy if the host has kvm disabled
|
||||
opts="-machine accel=kvm"
|
||||
if echo "$@" | grep -q " -M none "; then
|
||||
opts=
|
||||
fi
|
||||
|
||||
exec /usr/bin/qemu-system-x86_64 $opts "$@"
|
67
qemu.spec
67
qemu.spec
@ -23,6 +23,9 @@
|
||||
%ifarch %{mips}
|
||||
%global kvm_package system-mips
|
||||
%endif
|
||||
%ifarch riscv64
|
||||
%global kvm_package system-riscv
|
||||
%endif
|
||||
|
||||
%global user_static 1
|
||||
|
||||
@ -33,7 +36,7 @@
|
||||
|
||||
# Matches numactl ExcludeArch
|
||||
%global have_numactl 1
|
||||
%ifarch %{arm}
|
||||
%ifarch %{arm} riscv64
|
||||
%global have_numactl 0
|
||||
%endif
|
||||
|
||||
@ -184,23 +187,13 @@
|
||||
Summary: QEMU is a FAST! processor emulator
|
||||
Name: qemu
|
||||
Version: 5.1.0
|
||||
Release: 5%{?rcrel}%{?dist}
|
||||
Release: 9%{?rcrel}.0.riscv64%{?dist}
|
||||
Epoch: 2
|
||||
License: GPLv2 and BSD and MIT and CC-BY
|
||||
URL: http://www.qemu.org/
|
||||
|
||||
Source0: http://wiki.qemu-project.org/download/%{name}-%{version}%{?rcstr}.tar.xz
|
||||
|
||||
Patch1: 0001-linux-user-fix-implicit-conversion-from-enumeration-.patch
|
||||
Patch2: 0002-linux-user-Add-support-for-a-group-of-btrfs-ioctls-u.patch
|
||||
Patch3: 0003-linux-user-Add-support-for-a-group-of-btrfs-ioctls-u.patch
|
||||
Patch4: 0004-linux-user-Add-support-for-btrfs-ioctls-used-to-mani.patch
|
||||
Patch5: 0005-linux-user-Add-support-for-btrfs-ioctls-used-to-get-.patch
|
||||
Patch6: 0006-linux-user-Add-support-for-a-group-of-btrfs-inode-io.patch
|
||||
Patch7: 0007-linux-user-Add-support-for-two-btrfs-ioctls-used-for.patch
|
||||
Patch8: 0008-linux-user-Add-support-for-btrfs-ioctls-used-to-mana.patch
|
||||
Patch9: 0009-linux-user-Add-support-for-btrfs-ioctls-used-to-scru.patch
|
||||
|
||||
# guest agent service
|
||||
Source10: qemu-guest-agent.service
|
||||
Source17: qemu-ga.sysconfig
|
||||
@ -208,8 +201,6 @@ Source17: qemu-ga.sysconfig
|
||||
Source11: 99-qemu-guest-agent.rules
|
||||
# /etc/qemu/bridge.conf
|
||||
Source12: bridge.conf
|
||||
# qemu-kvm back compat wrapper installed as /usr/bin/qemu-kvm
|
||||
Source13: qemu-kvm.sh
|
||||
# PR manager service
|
||||
Source14: qemu-pr-helper.service
|
||||
Source15: qemu-pr-helper.socket
|
||||
@ -218,6 +209,26 @@ Source20: kvm-x86.modprobe.conf
|
||||
# /etc/security/limits.d/95-kvm-ppc64-memlock.conf
|
||||
Source21: 95-kvm-ppc64-memlock.conf
|
||||
|
||||
# Add btrfs ioctls to linux-user (bz #1872918)
|
||||
Patch0001: 0001-linux-user-fix-implicit-conversion-from-enumeration-.patch
|
||||
Patch0002: 0002-linux-user-Add-support-for-a-group-of-btrfs-ioctls-u.patch
|
||||
Patch0003: 0003-linux-user-Add-support-for-a-group-of-btrfs-ioctls-u.patch
|
||||
Patch0004: 0004-linux-user-Add-support-for-btrfs-ioctls-used-to-mani.patch
|
||||
Patch0005: 0005-linux-user-Add-support-for-btrfs-ioctls-used-to-get-.patch
|
||||
Patch0006: 0006-linux-user-Add-support-for-a-group-of-btrfs-inode-io.patch
|
||||
Patch0007: 0007-linux-user-Add-support-for-two-btrfs-ioctls-used-for.patch
|
||||
Patch0008: 0008-linux-user-Add-support-for-btrfs-ioctls-used-to-mana.patch
|
||||
Patch0009: 0009-linux-user-Add-support-for-btrfs-ioctls-used-to-scru.patch
|
||||
|
||||
# virtiofsd caps fixes
|
||||
Patch0101: 0101-virtiofsd-drop-CAP_DAC_READ_SEARCH.patch
|
||||
Patch0102: 0102-virtiofsd-avoid-proc-self-fd-tempdir.patch
|
||||
# vhost-vsock-pci regressions (bz #1902057)
|
||||
Patch0103: 0103-virtio-skip-legacy-support-check-on-machine-types-le.patch
|
||||
Patch0104: 0104-vhost-vsock-pci-force-virtio-version-1.patch
|
||||
Patch0105: 0105-vhost-user-vsock-pci-force-virtio-version-1.patch
|
||||
Patch0106: 0106-vhost-vsock-ccw-force-virtio-version-1.patch
|
||||
|
||||
|
||||
BuildRequires: gcc
|
||||
# documentation deps
|
||||
@ -334,7 +345,9 @@ BuildRequires: virglrenderer-devel
|
||||
# qemu 2.6: Needed for gtk GL support, vhost-user-gpu
|
||||
BuildRequires: mesa-libgbm-devel
|
||||
# qemu 2.11: preferred disassembler for TCG
|
||||
%ifnarch riscv64
|
||||
BuildRequires: capstone-devel
|
||||
%endif
|
||||
# qemu 2.12: parallels disk images require libxml2 now
|
||||
BuildRequires: libxml2-devel
|
||||
%ifarch x86_64
|
||||
@ -366,6 +379,10 @@ BuildRequires: hostname
|
||||
BuildRequires: daxctl-devel
|
||||
|
||||
BuildRequires: glibc-static pcre-static glib2-static zlib-static
|
||||
# if -pthread is used GCC SPEC will add --as-needed -latomic --no-as-needed for linker
|
||||
%ifarch riscv64
|
||||
BuildRequires: libatomic-static
|
||||
%endif
|
||||
|
||||
|
||||
Requires: %{name}-user = %{epoch}:%{version}-%{release}
|
||||
@ -1300,7 +1317,7 @@ done
|
||||
# Install kvm specific source bits, and qemu-kvm manpage
|
||||
%if 0%{?need_qemu_kvm}
|
||||
ln -sf qemu.1.gz %{buildroot}%{_mandir}/man1/qemu-kvm.1.gz
|
||||
install -m 0755 %{_sourcedir}/qemu-kvm.sh %{buildroot}%{_bindir}/qemu-kvm
|
||||
ln -sf qemu-system-x86_64 %{buildroot}%{_bindir}/qemu-kvm
|
||||
install -D -p -m 0644 %{_sourcedir}/kvm-x86.modprobe.conf %{buildroot}%{_sysconfdir}/modprobe.d/kvm.conf
|
||||
%endif
|
||||
|
||||
@ -1401,6 +1418,9 @@ chmod +x %{buildroot}%{_libdir}/qemu/*.so
|
||||
%global tests_skip 0
|
||||
# Enable this temporarily if tests are broken
|
||||
%global tests_nofail 0
|
||||
%ifarch riscv64
|
||||
%global tests_nofail 1
|
||||
%endif
|
||||
|
||||
# 2020-08-31: tests passing, but s390x fails due to
|
||||
# spurious warning breaking an iotest case
|
||||
@ -1905,6 +1925,21 @@ getent passwd qemu >/dev/null || \
|
||||
|
||||
|
||||
%changelog
|
||||
* Tue May 04 2021 David Abdurachmanov <david.abdurachmanov@gmail.com> - 5.1.0-9.0.riscv64
|
||||
- Enable riscv64
|
||||
|
||||
* Mon Jan 11 2021 Paolo Bonzini <pbonzini@redhat.com> - 5.1.0-9
|
||||
- Use symlink for qemu-kvm.
|
||||
|
||||
* Thu Dec 03 2020 Richard W.M. Jones <rjones@redhat.com> - 5.1.0-8
|
||||
- Enable qemu-kvm-core package on riscv64.
|
||||
|
||||
* Thu Dec 03 2020 Cole Robinson <crobinso@redhat.com> - 5.1.0-7
|
||||
- vhost-vsock-pci regressions (bz #1902057)
|
||||
|
||||
* Mon Nov 09 2020 Cole Robinson <aintdiscole@gmail.com> - 5.1.0-6
|
||||
- virtiofsd caps fixes
|
||||
|
||||
* Fri Sep 4 2020 Daniel P. Berrangé <berrange@redhat.com> - 5.1.0-5
|
||||
- Drop conditions for ppc, ppc64, mips64 and s390 arches
|
||||
- Fix host qemu binary path for aarch64
|
||||
@ -1915,7 +1950,7 @@ getent passwd qemu >/dev/null || \
|
||||
- Make QEMU sanity check a build blocker
|
||||
|
||||
* Thu Sep 3 2020 Daniel P. Berrangé <berrange@redhat.com> - 5.1.0-4
|
||||
- Add btrfs ioctls to linux-user (rhbz #1872918)
|
||||
- Add btrfs ioctls to linux-user (bz #1872918)
|
||||
|
||||
* Tue Aug 18 2020 Tom Stellard <tstellar@redhat.com> - 5.1.0-3
|
||||
- Add BuildRequires: gcc
|
||||
|
Loading…
Reference in New Issue
Block a user