[libvirt PATCH 0/2] qemu: support kvm-poll-control performance hint
by Tim Wiederhake
See the commit message of the first patch and
https://bugzilla.redhat.com/show_bug.cgi?id=1895204
Tim Wiederhake (2):
qemu: support kvm-poll-control performance hint
tests: Add tests for kvm-poll-control feature
docs/formatdomain.rst | 14 ++++++++------
docs/schemas/domaincommon.rng | 5 +++++
src/conf/domain_conf.c | 4 ++++
src/conf/domain_conf.h | 1 +
src/qemu/qemu_command.c | 5 +++++
tests/qemuxml2argvdata/kvm-features-off.xml | 1 +
tests/qemuxml2argvdata/kvm-features.args | 2 +-
tests/qemuxml2argvdata/kvm-features.xml | 1 +
tests/qemuxml2xmloutdata/kvm-features-off.xml | 1 +
tests/qemuxml2xmloutdata/kvm-features.xml | 1 +
10 files changed, 28 insertions(+), 7 deletions(-)
--
2.26.2
4 years
[PATCH] node_device: Use "udev" monitor source
by Michal Privoznik
In v6.3.0-rc1~67 I've made a switch: instead of listening on udev
events the nodedev driver started listening for kernel events.
This was because when a device changes its name (e.g. NICs) we
will get "move" event with DEVPATH_OLD property set, which we can
then use to remove the old device and thus keep our internal list
up to date. The switch to "kernel" source was made because if the
old NICs naming (eth0, eth1, ...) is enabled (e.g. via
net.ifnames=0 on the kernel cmd line) then udev overwrites the
property with the new name making our internal list go out of
sync. Interestingly, when the od NICs naming is not enabled then
the DEVPATH_OLD contains the correct value.
But as it turns out, "kernel" source might be missing some other
important properties, e.g. USB vendor/product IDs. Therefore,
switch back to "udev" source and wish the best of luck to users
using the old NICs naming.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1897625
Fixes: 9a13704818e4a018723e0ec5b9e97b176f1c8584
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/node_device/node_device_udev.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c
index 65f312d8f4..dec19a3166 100644
--- a/src/node_device/node_device_udev.c
+++ b/src/node_device/node_device_udev.c
@@ -1983,7 +1983,7 @@ nodeStateInitialize(bool privileged,
virObjectLock(priv);
- priv->udev_monitor = udev_monitor_new_from_netlink(udev, "kernel");
+ priv->udev_monitor = udev_monitor_new_from_netlink(udev, "udev");
if (!priv->udev_monitor) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("udev_monitor_new_from_netlink returned NULL"));
--
2.26.2
4 years
[Question] sg_persist failed when using qemu-pr-helper
by Zihao Chang
Hi all,
When using qemu-pr-helper,"sg_persist" in guest return Aborted Command after iscsiadm logout & login.
My confusion:
Is this problem caused by bugs of libvirt/qemu-pr-helper?
Or iscsiadm logout & login should be forbidden when using qemu-pr-helper?
Or There is something wrong with my config.
Steps to Reproduce:
1. setup multipath env
1) set /etc/iscsi/initiatorname.iscsi
2) iscsiadm discovery & login
3) start multipathd
2. add the following xml to guest
<disk type='block' device='lun'>
<driver name='qemu' type='raw' cache='none' io='native'/>
<source dev='/dev/mapper/XXXXXXXXXXXXXXXXX'>
**<reservations managed='yes'/>**
</source>
<target dev='sdc' bus='scsi'/>
</disk>
3. start the guest
1) "sg_persist -v -i -n -k -d /dev/sdc" works well in the guest
2) here /dev/sdc(guest) -> /dev/sdht(host)
4. iscsiadm logout & login on host
1) iscsiadm -m node -u (host)
2) iscsiadm -m node -l (host)
3) here /dev/sdc(guest) -(change)-> /dev/sdfo(host)
5. exec "sg_persist -v -i -n -k -d /dev/sdc" in the guest
1) command return:
Persistent Reservation In cmd: 5e 00 00 00 00 00 00 20 00 00
persistent reservation in:
Fixed format, current; Sense key: Aborted Command
Additional sense: Logical unit communication failure
PR in (Read keys): Aborted command sense key, other than protection related (asc=0x10)
2) strace qemu-pr-helper show:
openat(AT_FDCWD, "/dev/sdht", O_RDONLY) = -1 ENOENT (No such file or directory)
Additional info:
1. strace qemu-pr-helper show:
openat(AT_FDCWD, "/dev/sdht", O_RDONLY) = -1 ENOENT (No such file or directory)
2. This problem may be related to mnt(namespace). I try to set mnt of qemu-pr-helper as pid 1, sg_persist works well after logout & login.
4 years
[libvirt PATCH 0/3] Define and enable Snowridge model
by Tim Wiederhake
This series adds a CPU model for Snowridge to libvirt. Snowridge was
added to QEMU in v4.1.0.
Tim Wiederhake (3):
cpu_map: Add support for core-capability CPU feature
cpu_map: Add support for split-lock-detect CPU feature
cpu_map: Define and enable Snowridge model
src/cpu_map/index.xml | 1 +
src/cpu_map/meson.build | 1 +
src/cpu_map/x86_Snowridge.xml | 71 +++++++++++++++++++
src/cpu_map/x86_features.xml | 8 +++
.../domaincapsdata/qemu_4.1.0-q35.x86_64.xml | 1 +
.../domaincapsdata/qemu_4.1.0-tcg.x86_64.xml | 1 +
tests/domaincapsdata/qemu_4.1.0.x86_64.xml | 1 +
.../domaincapsdata/qemu_4.2.0-q35.x86_64.xml | 1 +
.../domaincapsdata/qemu_4.2.0-tcg.x86_64.xml | 1 +
tests/domaincapsdata/qemu_4.2.0.x86_64.xml | 1 +
.../domaincapsdata/qemu_5.0.0-q35.x86_64.xml | 1 +
.../domaincapsdata/qemu_5.0.0-tcg.x86_64.xml | 1 +
tests/domaincapsdata/qemu_5.0.0.x86_64.xml | 1 +
.../domaincapsdata/qemu_5.1.0-q35.x86_64.xml | 1 +
.../domaincapsdata/qemu_5.1.0-tcg.x86_64.xml | 1 +
tests/domaincapsdata/qemu_5.1.0.x86_64.xml | 1 +
.../domaincapsdata/qemu_5.2.0-q35.x86_64.xml | 1 +
.../domaincapsdata/qemu_5.2.0-tcg.x86_64.xml | 1 +
tests/domaincapsdata/qemu_5.2.0.x86_64.xml | 1 +
19 files changed, 96 insertions(+)
create mode 100644 src/cpu_map/x86_Snowridge.xml
--
2.26.2
4 years
[libvirt PATCH v3] Do not disable incompatible-pointer-types-discards-qualifiers
by Martin Kletzander
This reverts commit b3710e9a2af402a2b620de570b062294e11190eb.
That check is very valuable for our code, but it causes issue with glib >=
2.67.0 when building with clang.
The reason is a combination of two commits in glib, firstly fdda405b6b1b which
adds a g_atomic_pointer_{set,get} variants that enforce stricter type
checking (by removing an extra cast) for compilers that support __typeof__, and
commit dce24dc4492d which effectively enabled the new variant of glib's atomic
code for clang. This will not be necessary when glib's issue #600 [0] (8 years
old) is fixed. Thankfully, MR #1719 [1], which is supposed to deal with this
issue was opened 3 weeks ago, so there is a slight sliver of hope.
[0] https://gitlab.gnome.org/GNOME/glib/-/issues/600
[1] https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1719
Signed-off-by: Martin Kletzander <mkletzan(a)redhat.com>
---
v3:
- added check for glib version
v2:
- override _G_DEFINE_TYPE_EXTENDED_BEGIN in gcompat.h
meson.build | 3 ---
src/util/glibcompat.h | 24 ++++++++++++++++++++++++
2 files changed, 24 insertions(+), 3 deletions(-)
diff --git a/meson.build b/meson.build
index cecaad199d4c..04646e3a078c 100644
--- a/meson.build
+++ b/meson.build
@@ -405,9 +405,6 @@ cc_flags += [
# so use this Clang-specific arg to keep it quiet
'-Wno-typedef-redefinition',
- # Clang complains about casts in G_DEFINE_TYPE(...)
- '-Wno-incompatible-pointer-types-discards-qualifiers',
-
# We don't use -Wc++-compat so we have to enable it explicitly
'-Wjump-misses-init',
diff --git a/src/util/glibcompat.h b/src/util/glibcompat.h
index 6f50a76f3c2b..457f6ba797f3 100644
--- a/src/util/glibcompat.h
+++ b/src/util/glibcompat.h
@@ -20,6 +20,30 @@
#include <glib.h>
#include <glib/gstdio.h>
+#include <glib-object.h>
+
+#if defined(__clang__) && GLIB_CHECK_VERSION(2, 67, 0)
+/*
+ * Clang detects (valid) issue in G_DEFINE_TYPE and derivatives starting with
+ * glib >= 2.67.0. See https://gitlab.gnome.org/GNOME/glib/-/issues/600
+ *
+ * For that we need to disable the one check that produces an error in our
+ * builds when using any G_DEFINE_TYPE* macro. Thankfully all those macros end
+ * up using _G_DEFINE_TYPE_EXTENDED_BEGIN. Because with that we can redefine
+ * this one macro to cover all use cases. The macro is defined the same way it
+ * is defined in glib (with a very low probability of being changed thanks to a
+ * comment above it).
+ */
+# undef _G_DEFINE_TYPE_EXTENDED_BEGIN
+
+# define _G_DEFINE_TYPE_EXTENDED_BEGIN(TypeName, type_name, TYPE_PARENT, flags) \
+ _Pragma("GCC diagnostic push") \
+ _Pragma("GCC diagnostic ignored \"-Wincompatible-pointer-types-discards-qualifiers\"") \
+ _G_DEFINE_TYPE_EXTENDED_BEGIN_PRE(TypeName, type_name, TYPE_PARENT) \
+ _G_DEFINE_TYPE_EXTENDED_BEGIN_REGISTER(TypeName, type_name, TYPE_PARENT, flags) \
+ _Pragma("GCC diagnostic pop")
+
+#endif /* __clang__ */
gchar * vir_g_canonicalize_filename(const gchar *filename,
const gchar *relative_to);
--
2.29.2
4 years
[libvirt] improve security by adjusting the privileges of libvirtd processes
by yebiaoxiang
Hi Team
The daemon libvirtd runs as root user, which against the least privilege
security model.
root 567642 1.2 0.0 2856020 47576 ? Ssl 15:49 0:02 /usr/sbin/libvirtd --listen
In addition, the "--listen" parameter exposes TCP or TLS ports on the network,
it increasing the attack surface.
tcp 0 0 0.0.0.0:16509 0.0.0.0:* LISTEN 647824/libvirtd
tcp 0 0 0.0.0.0:16514 0.0.0.0:* LISTEN 647824/libvirtd
I have the following puzzles:
1. Whether root is the least privilege required for libvirtd to manage
virtualization platforms, it's possible to run libvirtd as a non-root user?
2. Is there any plan to resolve this security weaknesses?
(like move the function of "--listen" to an independent non-root process,
or other good idea)
Regards,
BiaoXiang
4 years
nwfilter issue with new ebtables
by Christian Ehrhardt
Hi,
I have last week discussed breakage in nwfilter usage on IRC
<filterref filter='clean-traffic'>
<parameter name='CTRL_IP_LEARNING' value='dhcp'/>
</filterref>
virsh start <guest>
error: Failed to start domain <guest>
error: internal error: applyDHCPOnlyRules failed - spoofing not protect
With debug in the logs enabled I got confirmation by Daniel (thanks!)
that the command sequence libvirt issued looked kind of "normal".
Hereby I wanted to let you know that some further debugging identified
a part of the sequence that libvirt issues as being broken in recent
ebtables versions.
# ebtables --concurrent -t nat -N testrule3
# ebtables --concurrent -t nat -E testrule3 testrule3-renamed
ebtables v1.8.6 (nf_tables): Chain 'testrule3' doesn't exists
This led to upstream ebtables bug [1] - for now just FYI in case you
want/need to subscribe for your own tracking.
[1]: https://bugzilla.netfilter.org/show_bug.cgi?id=1481
--
Christian Ehrhardt
Staff Engineer, Ubuntu Server
Canonical Ltd
4 years
[libvirt PATCH v2] qemu_command: fix FD usage in qemuBuildInterfaceCommandLine
by Pavel Hrdina
If virCommandPassFD() is called with VIR_COMMAND_PASS_FD_CLOSE_PARENT
the passed FD is closed. If qemuVirCommandGetFDSet() returns NULL we
would jump to cleanup where the vdpafd is closed again if not set to -1.
In order to fix it use a different variable where we will copy FD
number.
Signed-off-by: Pavel Hrdina <phrdina(a)redhat.com>
---
src/qemu/qemu_command.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 0eec35da16..2a786e34dd 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -8141,18 +8141,20 @@ qemuBuildInterfaceCommandLine(virQEMUDriverPtr driver,
if (vdpafd > 0) {
g_autofree char *fdset = NULL;
g_autofree char *addfdarg = NULL;
+ int vdpafd_copy = vdpafd;
virCommandPassFD(cmd, vdpafd, VIR_COMMAND_PASS_FD_CLOSE_PARENT);
- fdset = qemuVirCommandGetFDSet(cmd, vdpafd);
+ vdpafd = -1;
+
+ fdset = qemuVirCommandGetFDSet(cmd, vdpafd_copy);
if (!fdset)
goto cleanup;
- vdpafdName = qemuVirCommandGetDevSet(cmd, vdpafd);
+ vdpafdName = qemuVirCommandGetDevSet(cmd, vdpafd_copy);
/* set opaque to the devicepath so that we can look up the fdset later
* if necessary */
addfdarg = g_strdup_printf("%s,opaque=%s", fdset,
net->data.vdpa.devicepath);
virCommandAddArgList(cmd, "-add-fd", addfdarg, NULL);
- vdpafd = -1;
}
if (chardev)
--
2.26.2
4 years
[libvirt PATCH v2] Do not disable incompatible-pointer-types-discards-qualifiers
by Martin Kletzander
This reverts commit b3710e9a2af402a2b620de570b062294e11190eb.
That check is very valuable for our code, but it causes issue with glib >=
2.67.0 when building with clang.
The reason is a combination of two commits in glib, firstly fdda405b6b1b which
adds a g_atomic_pointer_{set,get} variants that enforce stricter type
checking (by removing an extra cast) for compilers that support __typeof__, and
commit dce24dc4492d which effectively enabled the new variant of glib's atomic
code for clang. This will not be necessary when glib's issue #600 [0] (8 years
old) is fixed. Thankfully, MR #1719 [1], which is supposed to deal with this
issue was opened 3 weeks ago, so there is a slight sliver of hope.
[0] https://gitlab.gnome.org/GNOME/glib/-/issues/600
[1] https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1719
Signed-off-by: Martin Kletzander <mkletzan(a)redhat.com>
---
meson.build | 3 ---
src/util/glibcompat.h | 24 ++++++++++++++++++++++++
2 files changed, 24 insertions(+), 3 deletions(-)
diff --git a/meson.build b/meson.build
index cecaad199d4c..04646e3a078c 100644
--- a/meson.build
+++ b/meson.build
@@ -405,9 +405,6 @@ cc_flags += [
# so use this Clang-specific arg to keep it quiet
'-Wno-typedef-redefinition',
- # Clang complains about casts in G_DEFINE_TYPE(...)
- '-Wno-incompatible-pointer-types-discards-qualifiers',
-
# We don't use -Wc++-compat so we have to enable it explicitly
'-Wjump-misses-init',
diff --git a/src/util/glibcompat.h b/src/util/glibcompat.h
index 6f50a76f3c2b..f4867f3eadbc 100644
--- a/src/util/glibcompat.h
+++ b/src/util/glibcompat.h
@@ -20,6 +20,30 @@
#include <glib.h>
#include <glib/gstdio.h>
+#include <glib-object.h>
+
+#ifdef __clang__
+/*
+ * Clang detects (valid) issue in G_DEFINE_TYPE and derivatives starting with
+ * glib >= 2.67.0. See https://gitlab.gnome.org/GNOME/glib/-/issues/600
+ *
+ * For that we need to disable the one check that produces an error in our
+ * builds when using any G_DEFINE_TYPE* macro. Thankfully all those macros end
+ * up using _G_DEFINE_TYPE_EXTENDED_BEGIN. Because with that we can redefine
+ * this one macro to cover all use cases. The macro is defined the same way it
+ * is defined in glib (with a very low probability of being changed thanks to a
+ * comment above it).
+ */
+# undef _G_DEFINE_TYPE_EXTENDED_BEGIN
+
+# define _G_DEFINE_TYPE_EXTENDED_BEGIN(TypeName, type_name, TYPE_PARENT, flags) \
+ _Pragma("GCC diagnostic push") \
+ _Pragma("GCC diagnostic ignored \"-Wincompatible-pointer-types-discards-qualifiers\"") \
+ _G_DEFINE_TYPE_EXTENDED_BEGIN_PRE(TypeName, type_name, TYPE_PARENT) \
+ _G_DEFINE_TYPE_EXTENDED_BEGIN_REGISTER(TypeName, type_name, TYPE_PARENT, flags) \
+ _Pragma("GCC diagnostic pop")
+
+#endif /* __clang__ */
gchar * vir_g_canonicalize_filename(const gchar *filename,
const gchar *relative_to);
--
2.29.2
4 years
[PATCH 1/1] qemu_tmp.c: fix 'shortName' leak
by Daniel Henrique Barboza
This is a Coverity fix pointed out by John in IRC. This code
was introduced in 19d74fdf0eb, when the TPM Proxy device for
for ppc64 was introduced.
This will leak in case we have 2 TPMs in the same domain, a
possible scenario with the protected Ultravisor execution in
PowerPC guests.
Fixes: 19d74fdf0eb5d2e89e80ceedea736425160ffccb
Reported-by: John Ferlan <jferlan(a)redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413(a)gmail.com>
---
src/qemu/qemu_tpm.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu_tpm.c b/src/qemu/qemu_tpm.c
index 8adb0e42b8..872be16570 100644
--- a/src/qemu/qemu_tpm.c
+++ b/src/qemu/qemu_tpm.c
@@ -841,10 +841,11 @@ qemuExtTPMStop(virQEMUDriverPtr driver,
virDomainObjPtr vm)
{
g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
- g_autofree char *shortName = NULL;
size_t i;
for (i = 0; i < vm->def->ntpms; i++) {
+ g_autofree char *shortName = NULL;
+
if (vm->def->tpms[i]->type != VIR_DOMAIN_TPM_TYPE_EMULATOR)
continue;
@@ -866,12 +867,13 @@ qemuExtTPMSetupCgroup(virQEMUDriverPtr driver,
virCgroupPtr cgroup)
{
g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
- g_autofree char *shortName = NULL;
int rc;
pid_t pid;
size_t i;
for (i = 0; i < def->ntpms; i++) {
+ g_autofree char *shortName = NULL;
+
if (def->tpms[i]->type != VIR_DOMAIN_TPM_TYPE_EMULATOR)
continue;
--
2.26.2
4 years