[libvirt] [PATCH] qemu: fix UNIX socket chardevs operating in client mode
by Daniel P. Berrangé
When support was adding for passing a pre-opened listener socket to UNIX
chardevs, it accidentally passed the listener socket for client mode
chardevs too with predictable amounts of fail resulting.
Expand the unit test coverage to validate that we are only doing FD
passing when operating in server mode.
Reported-by: Richard W.M. Jones <rjones(a)redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
src/qemu/qemu_command.c | 3 +-
.../qemuxml2argvdata/serial-unix-chardev.args | 2 ++
.../serial-unix-chardev.x86_64-latest.args | 36 +++++++++++++++++++
.../qemuxml2argvdata/serial-unix-chardev.xml | 4 +++
tests/qemuxml2argvtest.c | 1 +
5 files changed, 45 insertions(+), 1 deletion(-)
create mode 100644 tests/qemuxml2argvdata/serial-unix-chardev.x86_64-latest.args
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 82d8030a33..32eb59b6ab 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -5083,7 +5083,8 @@ qemuBuildChrChardevStr(virLogManagerPtr logManager,
break;
case VIR_DOMAIN_CHR_TYPE_UNIX:
- if ((flags & QEMU_BUILD_CHARDEV_UNIX_FD_PASS) &&
+ if (dev->data.nix.listen &&
+ (flags & QEMU_BUILD_CHARDEV_UNIX_FD_PASS) &&
virQEMUCapsGet(qemuCaps, QEMU_CAPS_CHARDEV_FD_PASS)) {
if (qemuSecuritySetSocketLabel(secManager, (virDomainDefPtr)def) < 0)
goto cleanup;
diff --git a/tests/qemuxml2argvdata/serial-unix-chardev.args b/tests/qemuxml2argvdata/serial-unix-chardev.args
index 584f4a1dd1..873d3263c6 100644
--- a/tests/qemuxml2argvdata/serial-unix-chardev.args
+++ b/tests/qemuxml2argvdata/serial-unix-chardev.args
@@ -26,4 +26,6 @@ server,nowait \
-device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \
-chardev socket,id=charserial0,path=/tmp/serial.sock \
-device isa-serial,chardev=charserial0,id=serial0 \
+-chardev socket,id=charserial1,path=/tmp/serial-server.sock,server,nowait \
+-device isa-serial,chardev=charserial1,id=serial1 \
-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3
diff --git a/tests/qemuxml2argvdata/serial-unix-chardev.x86_64-latest.args b/tests/qemuxml2argvdata/serial-unix-chardev.x86_64-latest.args
new file mode 100644
index 0000000000..ce7a7f80d7
--- /dev/null
+++ b/tests/qemuxml2argvdata/serial-unix-chardev.x86_64-latest.args
@@ -0,0 +1,36 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/home/test \
+USER=test \
+LOGNAME=test \
+QEMU_AUDIO_DRV=none \
+/usr/bin/qemu-system-i686 \
+-name guest=QEMUGuest1,debug-threads=on \
+-S \
+-object secret,id=masterKey0,format=raw,\
+file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
+-machine pc,accel=tcg,usb=off,dump-guest-core=off \
+-m 214 \
+-realtime mlock=off \
+-smp 1,sockets=1,cores=1,threads=1 \
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
+-display none \
+-no-user-config \
+-nodefaults \
+-chardev socket,id=charmonitor,fd=1729,server,nowait \
+-mon chardev=charmonitor,id=monitor,mode=control \
+-rtc base=utc \
+-no-shutdown \
+-no-acpi \
+-boot strict=on \
+-device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \
+-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \
+-device ide-hd,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,bootindex=1 \
+-chardev socket,id=charserial0,path=/tmp/serial.sock \
+-device isa-serial,chardev=charserial0,id=serial0 \
+-chardev socket,id=charserial1,fd=1729,server,nowait \
+-device isa-serial,chardev=charserial1,id=serial1 \
+-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x2 \
+-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\
+resourcecontrol=deny \
+-msg timestamp=on
diff --git a/tests/qemuxml2argvdata/serial-unix-chardev.xml b/tests/qemuxml2argvdata/serial-unix-chardev.xml
index 04f83779ce..af513d6445 100644
--- a/tests/qemuxml2argvdata/serial-unix-chardev.xml
+++ b/tests/qemuxml2argvdata/serial-unix-chardev.xml
@@ -25,6 +25,10 @@
<source mode='connect' path='/tmp/serial.sock'/>
<target port='0'/>
</serial>
+ <serial type='unix'>
+ <source mode='bind' path='/tmp/serial-server.sock'/>
+ <target port='1'/>
+ </serial>
<console type='unix'>
<source mode='connect' path='/tmp/serial.sock'/>
<target port='0'/>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 2d52f352b0..3be5af03aa 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1335,6 +1335,7 @@ mymain(void)
QEMU_CAPS_CHARDEV_FILE_APPEND);
DO_TEST("serial-unix-chardev",
QEMU_CAPS_DEVICE_ISA_SERIAL);
+ DO_TEST_CAPS_LATEST("serial-unix-chardev");
DO_TEST("serial-tcp-chardev",
QEMU_CAPS_DEVICE_ISA_SERIAL);
DO_TEST("serial-udp-chardev",
--
2.17.1
6 years, 4 months
[libvirt] [PATCH 0/1] Changed LPC slot from 1 to 31
by Ivan Mishonov
From: Ivan Mishonov <ivan(a)conquex.com>
There was no keyboard input on Graphical UEFI guests running Windows
2016. Changed slot number according to the example given in the FreeBSD
Handbook section related to bhyve and Graphical UEFI guests
Ivan Mishonov (1):
Changed LPC slot from 1 to 31
src/bhyve/bhyve_command.c | 2 +-
src/bhyve/bhyve_device.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
--
2.18.0
6 years, 4 months
[libvirt] [PATCH 0/3] Fix regression with vhostuser and chardev FD passing
by Daniel P. Berrangé
QEMU has a validation bug which prevents vhostuser accepting the chardev
when it uses FD passing, despite it being functionally correct.
While the QEMU bug is being fixed, we need to avoid hitting this
problem with existing QEMU releases.
The easiest way todo this is to simply disable FD passing for the
chardev used with vhostuser only.
Daniel P. Berrangé (3):
qemu: remove chardevStdioLogd param from vhostuser code path
qemu: consolidate parameters of qemuBuildChrChardevStr into flags
qemu: don't use chardev FD passing for vhostuser backend
src/qemu/qemu_command.c | 117 ++++++++++++++--------
tests/qemuxml2argvdata/net-vhostuser.args | 3 +-
tests/qemuxml2argvtest.c | 2 +-
3 files changed, 75 insertions(+), 47 deletions(-)
--
2.17.1
6 years, 4 months
[libvirt] [PATCH v3] Loop through all resolved addresses in virNetSocketNewListenTCP
by Olaf Hering
Currently virNetSocketNewListenTCP bails out early under the following
conditions:
- the hostname resolves to at least one IPv4 and at least one IPv6
address
- the local interfaces have that one IPv4 address assigned, but not any
of the IPv6 addresses
- the local interfaces have just IPv6 link-local addresses
In this case the resolver returns not only the IPv4 addresses but also
IPv6. Binding the IPv6 address will obviously fail. But this terminates
the entire loop, even if binding to IPv4 succeeded.
To fix this error, just keep going and loop through all returned
addresses. In case none of the attempts to bind to some address
succeeded, try to report some appropriate error.
Signed-off-by: Olaf Hering <olaf(a)aepfle.de>
---
v3:
more whitespace fixes, as suggested by Daniel P. Berrang��
v2:
whitespace fixes, as suggested by John Ferlan
src/rpc/virnetsocket.c | 23 ++++++++++-------------
1 file changed, 10 insertions(+), 13 deletions(-)
diff --git a/src/rpc/virnetsocket.c b/src/rpc/virnetsocket.c
index 7087abec9c..3a055acd39 100644
--- a/src/rpc/virnetsocket.c
+++ b/src/rpc/virnetsocket.c
@@ -382,11 +382,8 @@ int virNetSocketNewListenTCP(const char *nodename,
#endif
if (bind(fd, runp->ai_addr, runp->ai_addrlen) < 0) {
- if (errno != EADDRINUSE) {
- virReportSystemError(errno, "%s", _("Unable to bind to port"));
- goto error;
- }
- addrInUse = true;
+ if (errno == EADDRINUSE)
+ addrInUse = true;
VIR_FORCE_CLOSE(fd);
runp = runp->ai_next;
continue;
@@ -409,14 +406,14 @@ int virNetSocketNewListenTCP(const char *nodename,
fd = -1;
}
- if (nsocks == 0 && familyNotSupported) {
- virReportSystemError(EAFNOSUPPORT, "%s", _("Unable to bind to port"));
- goto error;
- }
-
- if (nsocks == 0 &&
- addrInUse) {
- virReportSystemError(EADDRINUSE, "%s", _("Unable to bind to port"));
+ if (nsocks == 0) {
+ if (familyNotSupported)
+ errno = EAFNOSUPPORT;
+ else if (addrInUse)
+ errno = EADDRINUSE;
+ else
+ errno = EDESTADDRREQ;
+ virReportSystemError(errno, "%s", _("Unable to bind to port"));
goto error;
}
6 years, 4 months
[libvirt] [PATCH 0/5] AUTHORS: Cleanups and fixes
by Andrea Bolognani
Comparing the generated AUTHORS file before and after these
changes:
AUTHORS | 51 +--------------------------------------------------
1 file changed, 1 insertion(+), 50 deletions(-)
There would be plenty of room for additional deduplication,
but that's how far I can get based on concrete data as opposed
to relying on (more or less educated) guesses.
Andrea Bolognani (5):
AUTHORS: Remove unnecessary remark
AUTHORS: Fix entries disagreeing with mailmap
mailmap: Fix consolidation rules
mailmap: Consolidate current and past maintainers
AUTHORS: Avoid duplicated entries
.mailmap | 16 +++++++++++++---
AUTHORS.in | 6 ++----
Makefile.am | 18 +++++++++++++-----
3 files changed, 28 insertions(+), 12 deletions(-)
--
2.17.1
6 years, 4 months
[libvirt] [PATCH] conf: initialize character pointer xml value to avoid random crash
by Luyao Huang
If the code jump to the cleanup before assagin value to xml pointer,
libvirtd may get crashed when try to free an uninitialized pointer.
backtrace:
0 0x00007ffff428d59c in free () from /lib64/libc.so.6
1 0x00007ffff721314a in virFree (ptrptr=ptrptr@entry=0x7fffc67f1b00) at util/viralloc.c:582
2 0x00007ffff7345ac4 in virDomainConfNWFilterInstantiate (vmname=<optimized out>,
vmuuid=vmuuid@entry=0x7fffc0181ca8 "߉\237\\۔H\262\206z\340\302f\265\233z", net=<optimized out>,
ignoreExists=ignoreExists@entry=true) at conf/domain_nwfilter.c:122
3 0x00007fffca5a77f6 in qemuProcessFiltersInstantiate (ignoreExists=true, def=0x7fffc0181ca0) at qemu/qemu_process.c:3028
4 qemuProcessReconnect (opaque=<optimized out>) at qemu/qemu_process.c:7653
5 0x00007ffff72c4895 in virThreadHelper (data=<optimized out>) at util/virthread.c:206
6 0x00007ffff45dcdd5 in start_thread () from /lib64/libpthread.so.0
7 0x00007ffff4305ead in clone () from /lib64/libc.so.6
Signed-off-by: Luyao Huang <lhuang(a)redhat.com>
---
src/conf/domain_nwfilter.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/conf/domain_nwfilter.c b/src/conf/domain_nwfilter.c
index 948b324..24b5f42 100644
--- a/src/conf/domain_nwfilter.c
+++ b/src/conf/domain_nwfilter.c
@@ -90,7 +90,7 @@ virDomainConfNWFilterInstantiate(const char *vmname,
virConnectPtr conn = virGetConnectNWFilter();
virNWFilterBindingDefPtr def = NULL;
virNWFilterBindingPtr binding = NULL;
- char *xml;
+ char *xml = NULL;
int ret = -1;
VIR_DEBUG("vmname=%s portdev=%s filter=%s ignoreExists=%d",
--
1.8.3.1
6 years, 4 months
[libvirt] [PATCH] virsh.pod: Drop --persistent for detach-device-alias
by Michal Privoznik
https://bugzilla.redhat.com/show_bug.cgi?id=1598087
The detach-device-alias never supported --persistent argument.
Drop it from the man page.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
Pushed under trivial rule.
tools/virsh.pod | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/virsh.pod b/tools/virsh.pod
index dc100db9f3..003becb7c3 100644
--- a/tools/virsh.pod
+++ b/tools/virsh.pod
@@ -3197,7 +3197,7 @@ Note that older versions of virsh used I<--config> as an alias for
I<--persistent>.
=item B<detach-device-alias> I<domain> I<alias>
-[[[I<--live>] [I<--config>] | [I<--current>]] | [I<--persistent>]]
+[[[I<--live>] [I<--config>] | [I<--current>]]]]
Detach a device with given I<alias> from the I<domain>.
--
2.16.4
6 years, 4 months
Re: [libvirt] [PATCH] conf: initialize character pointer xml value to avoid random crash
by Luyao Huang
What !! This can not be true :D
Okay, looks like that github offline in a short time.
BTW, CC libvirt-ci@ maybe better than libvirt-list@ (does this mail-list ever exist ?)
BR,
Luyao
----- Original Message -----
From: no-reply(a)patchew.org
To: famz(a)redhat.com, lhuang(a)redhat.com
Cc: libvir-list(a)redhat.com, lhuang(a)redhat.com
Sent: Thursday, July 5, 2018 12:43:16 PM
Subject: Re: [libvirt] [PATCH] conf: initialize character pointer xml value to avoid random crash
Hi,
This series was run against 'syntax-check' test by patchew.org, which failed, please find the details below:
Type: series
Message-id: 1530765251-5291-1-git-send-email-lhuang(a)redhat.com
Subject: [libvirt] [PATCH] conf: initialize character pointer xml value to avoid random crash
=== TEST SCRIPT BEGIN ===
#!/bin/bash
# Testing script will be invoked under the git checkout with
# HEAD pointing to a commit that has the patches applied on top of "base"
# branch
time bash -c './autogen.sh && make syntax-check'
=== TEST SCRIPT END ===
Updating bcb55ab053bc79561b55d0394490f4b64e0f2d01
fatal: unable to access 'https://github.com/patchew-project/libvirt/': Failed to connect to github.com port 443: Connection timed out
error: Could not fetch bcb55ab053bc79561b55d0394490f4b64e0f2d01
Traceback (most recent call last):
File "./patchew-cli", line 514, in test_one
git_clone_repo(clone, r["repo"], r["head"], logf)
File "./patchew-cli", line 48, in git_clone_repo
stdout=logf, stderr=logf)
File "/usr/lib64/python3.6/subprocess.py", line 291, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['git', 'remote', 'add', '-f', '--mirror=fetch', 'bcb55ab053bc79561b55d0394490f4b64e0f2d01', 'https://github.com/patchew-project/libvirt']' returned non-zero exit status 1.
---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to patchew-devel(a)redhat.com
6 years, 4 months
[libvirt] [PATCH] util:Fix with process number and pid file do not match
by dubo163
From: dubobo <dubobo(a)didichuxing.com>
the libvirtd pid file is not match the os process pid number
which is smaller than before.
this would be exist if the libvirtd process coredump or the os
process was killed which the next pid number is smaller.
you can be also edit the pid file to write the longer number than
before,then restart the libvirtd service.
Signed-off-by: dubobo <dubobo(a)didichuxing.com>
---
src/util/virpidfile.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/util/virpidfile.c b/src/util/virpidfile.c
index 58ab29f..8b0ff99 100644
--- a/src/util/virpidfile.c
+++ b/src/util/virpidfile.c
@@ -445,6 +445,12 @@ int virPidFileAcquirePath(const char *path,
}
snprintf(pidstr, sizeof(pidstr), "%lld", (long long) pid);
+ if (ftruncate(fd, 0) < 0) {
+ VIR_FORCE_CLOSE(fd);
+ return -1;
+ }
+
+ lseek(fd, 0, SEEK_SET);
if (safewrite(fd, pidstr, strlen(pidstr)) < 0) {
virReportSystemError(errno,
--
1.8.3.1
6 years, 4 months