[PATCH] apparmor: allow getattr on usb devices
by christian.ehrhardt@canonical.com
From: Christian Ehrhardt <christian.ehrhardt(a)canonical.com>
For the handling of usb we already allow plenty of read access,
but so far /sys/bus/usb/devices only needed read access to the directory
to enumerate the symlinks in there that point to the actual entries via
relative links to ../../../devices/.
But in more recent systemd with updated libraries a program might do
getattr calls on those symlinks. And while symlinks in apparmor usually
do not matter, as it is the effective target of an access that has to be
allowed, here the getattr calls are on the links themselves.
On USB hostdev usage that causes a set of denials like:
apparmor="DENIED" operation="getattr" class="file"
name="/sys/bus/usb/devices/usb1" comm="qemu-system-x86"
requested_mask="r" denied_mask="r" ...
It is safe to read the links, therefore add a rule to allow it to
the block of rules that covers the usb related access.
Signed-off-by: Christian Ehrhardt <christian.ehrhardt(a)canonical.com>
---
src/security/apparmor/libvirt-qemu | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/security/apparmor/libvirt-qemu b/src/security/apparmor/libvirt-qemu
index 02ee273e7e..d0289b8943 100644
--- a/src/security/apparmor/libvirt-qemu
+++ b/src/security/apparmor/libvirt-qemu
@@ -42,6 +42,7 @@
# For hostdev access. The actual devices will be added dynamically
/sys/bus/usb/devices/ r,
+ /sys/bus/usb/devices/* r,
/sys/devices/**/usb[0-9]*/** r,
# libusb needs udev data about usb devices (~equal to content of lsusb -v)
/run/udev/data/+usb* r,
--
2.38.1
2 years
[PATCH v2] coding-style: Use the same style in the 'struct option'
by Jiang Jiacheng
Use same style in the 'struct option' as:
struct option opt[] = {
{ a, b },
{ a, b },
...
{ a, b },
};
diff to v1:
* use the same style in all the 'struct option'
Signed-off-by: Jiang Jiacheng <jiangjiacheng(a)huawei.com>
---
examples/c/domain/domtop.c | 10 +++++-----
examples/c/domain/suspend.c | 10 +++++-----
src/locking/lock_daemon.c | 12 ++++++------
src/logging/log_daemon.c | 12 ++++++------
src/remote/remote_daemon.c | 14 +++++++-------
src/security/virt-aa-helper.c | 22 +++++++++++-----------
tools/virsh.c | 24 ++++++++++++------------
tools/virt-admin.c | 14 +++++++-------
tools/virt-host-validate.c | 8 ++++----
tools/virt-login-shell-helper.c | 6 +++---
tools/virt-pki-query-dn.c | 6 +++---
11 files changed, 69 insertions(+), 69 deletions(-)
diff --git a/examples/c/domain/domtop.c b/examples/c/domain/domtop.c
index 5228445b7c..dd35ec8661 100644
--- a/examples/c/domain/domtop.c
+++ b/examples/c/domain/domtop.c
@@ -86,11 +86,11 @@ parse_argv(int argc, char *argv[],
unsigned long val;
char *p;
struct option opt[] = {
- {"debug", no_argument, NULL, 'd'},
- {"help", no_argument, NULL, 'h'},
- {"connect", required_argument, NULL, 'c'},
- {"delay", required_argument, NULL, 'D'},
- {NULL, 0, NULL, 0}
+ { "debug", no_argument, NULL, 'd' },
+ { "help", no_argument, NULL, 'h' },
+ { "connect", required_argument, NULL, 'c' },
+ { "delay", required_argument, NULL, 'D' },
+ { NULL, 0, NULL, 0 },
};
while ((arg = getopt_long(argc, argv, "+:dhc:D:", opt, NULL)) != -1) {
diff --git a/examples/c/domain/suspend.c b/examples/c/domain/suspend.c
index 3ff24f6861..6e0bbd5597 100644
--- a/examples/c/domain/suspend.c
+++ b/examples/c/domain/suspend.c
@@ -76,11 +76,11 @@ parse_argv(int argc, char *argv[],
unsigned long val;
char *p;
struct option opt[] = {
- {"debug", no_argument, NULL, 'd'},
- {"help", no_argument, NULL, 'h'},
- {"connect", required_argument, NULL, 'c'},
- {"seconds", required_argument, NULL, 's'},
- {NULL, 0, NULL, 0}
+ { "debug", no_argument, NULL, 'd' },
+ { "help", no_argument, NULL, 'h' },
+ { "connect", required_argument, NULL, 'c' },
+ { "seconds", required_argument, NULL, 's' },
+ { NULL, 0, NULL, 0 },
};
while ((arg = getopt_long(argc, argv, "+:dhc:s:", opt, NULL)) != -1) {
diff --git a/src/locking/lock_daemon.c b/src/locking/lock_daemon.c
index c997d327c4..5eed6b7c26 100644
--- a/src/locking/lock_daemon.c
+++ b/src/locking/lock_daemon.c
@@ -809,14 +809,14 @@ int main(int argc, char **argv) {
int rv;
struct option opts[] = {
- { "verbose", no_argument, &verbose, 'v'},
- { "daemon", no_argument, &godaemon, 'd'},
- { "config", required_argument, NULL, 'f'},
- { "timeout", required_argument, NULL, 't'},
- { "pid-file", required_argument, NULL, 'p'},
+ { "verbose", no_argument, &verbose, 'v' },
+ { "daemon", no_argument, &godaemon, 'd' },
+ { "config", required_argument, NULL, 'f' },
+ { "timeout", required_argument, NULL, 't' },
+ { "pid-file", required_argument, NULL, 'p' },
{ "version", no_argument, NULL, 'V' },
{ "help", no_argument, NULL, 'h' },
- {0, 0, 0, 0}
+ { 0, 0, 0, 0 },
};
privileged = geteuid() == 0;
diff --git a/src/logging/log_daemon.c b/src/logging/log_daemon.c
index 00fc4148fd..9b70ffad2f 100644
--- a/src/logging/log_daemon.c
+++ b/src/logging/log_daemon.c
@@ -613,14 +613,14 @@ int main(int argc, char **argv) {
int rv;
struct option opts[] = {
- { "verbose", no_argument, &verbose, 'v'},
- { "daemon", no_argument, &godaemon, 'd'},
- { "config", required_argument, NULL, 'f'},
- { "timeout", required_argument, NULL, 't'},
- { "pid-file", required_argument, NULL, 'p'},
+ { "verbose", no_argument, &verbose, 'v' },
+ { "daemon", no_argument, &godaemon, 'd' },
+ { "config", required_argument, NULL, 'f' },
+ { "timeout", required_argument, NULL, 't' },
+ { "pid-file", required_argument, NULL, 'p' },
{ "version", no_argument, NULL, 'V' },
{ "help", no_argument, NULL, 'h' },
- {0, 0, 0, 0}
+ { 0, 0, 0, 0 },
};
privileged = geteuid() == 0;
diff --git a/src/remote/remote_daemon.c b/src/remote/remote_daemon.c
index f369d09d35..dd9344168b 100644
--- a/src/remote/remote_daemon.c
+++ b/src/remote/remote_daemon.c
@@ -807,17 +807,17 @@ int main(int argc, char **argv) {
mode_t old_umask;
struct option opts[] = {
- { "verbose", no_argument, &verbose, 'v'},
- { "daemon", no_argument, &godaemon, 'd'},
+ { "verbose", no_argument, &verbose, 'v' },
+ { "daemon", no_argument, &godaemon, 'd' },
#if defined(WITH_IP) && defined(LIBVIRTD)
- { "listen", no_argument, &ipsock, 'l'},
+ { "listen", no_argument, &ipsock, 'l' },
#endif /* !(WITH_IP && LIBVIRTD) */
- { "config", required_argument, NULL, 'f'},
- { "timeout", required_argument, NULL, 't'},
- { "pid-file", required_argument, NULL, 'p'},
+ { "config", required_argument, NULL, 'f' },
+ { "timeout", required_argument, NULL, 't' },
+ { "pid-file", required_argument, NULL, 'p' },
{ "version", no_argument, NULL, 'V' },
{ "help", no_argument, NULL, 'h' },
- {0, 0, 0, 0}
+ { 0, 0, 0, 0 },
};
if (virGettextInitialize() < 0 ||
diff --git a/src/security/virt-aa-helper.c b/src/security/virt-aa-helper.c
index a15971b9bb..53a1cd1048 100644
--- a/src/security/virt-aa-helper.c
+++ b/src/security/virt-aa-helper.c
@@ -1337,17 +1337,17 @@ vahParseArgv(vahControl * ctl, int argc, char **argv)
{
int arg, idx = 0;
struct option opt[] = {
- {"add", 0, 0, 'a'},
- {"create", 0, 0, 'c'},
- {"dryrun", 0, 0, 'd'},
- {"delete", 0, 0, 'D'},
- {"add-file", 0, 0, 'f'},
- {"append-file", 0, 0, 'F'},
- {"help", 0, 0, 'h'},
- {"replace", 0, 0, 'r'},
- {"remove", 0, 0, 'R'},
- {"uuid", 1, 0, 'u'},
- {0, 0, 0, 0}
+ { "add", 0, 0, 'a' },
+ { "create", 0, 0, 'c' },
+ { "dryrun", 0, 0, 'd' },
+ { "delete", 0, 0, 'D' },
+ { "add-file", 0, 0, 'f' },
+ { "append-file", 0, 0, 'F' },
+ { "help", 0, 0, 'h' },
+ { "replace", 0, 0, 'r' },
+ { "remove", 0, 0, 'R' },
+ { "uuid", 1, 0, 'u' },
+ { 0, 0, 0, 0 },
};
while ((arg = getopt_long(argc, argv, "acdDhrRH:b:u:p:f:F:", opt,
diff --git a/tools/virsh.c b/tools/virsh.c
index b37d2ce12f..5696941550 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -638,18 +638,18 @@ virshParseArgv(vshControl *ctl, int argc, char **argv)
int longindex = -1;
virshControl *priv = ctl->privData;
struct option opt[] = {
- {"connect", required_argument, NULL, 'c'},
- {"debug", required_argument, NULL, 'd'},
- {"escape", required_argument, NULL, 'e'},
- {"help", no_argument, NULL, 'h'},
- {"keepalive-interval", required_argument, NULL, 'k'},
- {"keepalive-count", required_argument, NULL, 'K'},
- {"log", required_argument, NULL, 'l'},
- {"quiet", no_argument, NULL, 'q'},
- {"readonly", no_argument, NULL, 'r'},
- {"timing", no_argument, NULL, 't'},
- {"version", optional_argument, NULL, 'v'},
- {NULL, 0, NULL, 0}
+ { "connect", required_argument, NULL, 'c' },
+ { "debug", required_argument, NULL, 'd' },
+ { "escape", required_argument, NULL, 'e' },
+ { "help", no_argument, NULL, 'h' },
+ { "keepalive-interval", required_argument, NULL, 'k' },
+ { "keepalive-count", required_argument, NULL, 'K' },
+ { "log", required_argument, NULL, 'l' },
+ { "quiet", no_argument, NULL, 'q' },
+ { "readonly", no_argument, NULL, 'r' },
+ { "timing", no_argument, NULL, 't' },
+ { "version", optional_argument, NULL, 'v' },
+ { NULL, 0, NULL, 0 },
};
/* Standard (non-command) options. The leading + ensures that no
diff --git a/tools/virt-admin.c b/tools/virt-admin.c
index 11ba242742..85b010b95f 100644
--- a/tools/virt-admin.c
+++ b/tools/virt-admin.c
@@ -1318,13 +1318,13 @@ vshAdmParseArgv(vshControl *ctl, int argc, char **argv)
size_t i;
int longindex = -1;
struct option opt[] = {
- {"connect", required_argument, NULL, 'c'},
- {"debug", required_argument, NULL, 'd'},
- {"help", no_argument, NULL, 'h'},
- {"log", required_argument, NULL, 'l'},
- {"quiet", no_argument, NULL, 'q'},
- {"version", optional_argument, NULL, 'v'},
- {NULL, 0, NULL, 0}
+ { "connect", required_argument, NULL, 'c' },
+ { "debug", required_argument, NULL, 'd' },
+ { "help", no_argument, NULL, 'h' },
+ { "log", required_argument, NULL, 'l' },
+ { "quiet", no_argument, NULL, 'q' },
+ { "version", optional_argument, NULL, 'v' },
+ { NULL, 0, NULL, 0 },
};
/* Standard (non-command) options. The leading + ensures that no
diff --git a/tools/virt-host-validate.c b/tools/virt-host-validate.c
index 4dae97910a..52ca729f85 100644
--- a/tools/virt-host-validate.c
+++ b/tools/virt-host-validate.c
@@ -73,10 +73,10 @@ show_version(FILE *out, const char *argv0)
}
static const struct option argOptions[] = {
- { "help", 0, NULL, 'h', },
- { "version", 0, NULL, 'v', },
- { "quiet", 0, NULL, 'q', },
- { NULL, 0, NULL, '\0', }
+ { "help", 0, NULL, 'h' },
+ { "version", 0, NULL, 'v' },
+ { "quiet", 0, NULL, 'q' },
+ { NULL, 0, NULL, '\0' },
};
int
diff --git a/tools/virt-login-shell-helper.c b/tools/virt-login-shell-helper.c
index 3f8757e496..8feeb8f0fe 100644
--- a/tools/virt-login-shell-helper.c
+++ b/tools/virt-login-shell-helper.c
@@ -179,9 +179,9 @@ main(int argc, char **argv)
bool autoshell = false;
struct option opt[] = {
- {"help", no_argument, NULL, 'h'},
- {"version", optional_argument, NULL, 'V'},
- {NULL, 0, NULL, 0}
+ { "help", no_argument, NULL, 'h' },
+ { "version", optional_argument, NULL, 'V' },
+ { NULL, 0, NULL, 0 },
};
if (virInitialize() < 0) {
fprintf(stderr, _("Failed to initialize libvirt error handling"));
diff --git a/tools/virt-pki-query-dn.c b/tools/virt-pki-query-dn.c
index ee3783c1b2..2d7849feb7 100644
--- a/tools/virt-pki-query-dn.c
+++ b/tools/virt-pki-query-dn.c
@@ -61,9 +61,9 @@ main(int argc,
int rv = 0;
struct option opt[] = {
- {"help", no_argument, NULL, 'h'},
- {"version", optional_argument, NULL, 'v'},
- {NULL, 0, NULL, 0}
+ { "help", no_argument, NULL, 'h' },
+ { "version", optional_argument, NULL, 'v' },
+ { NULL, 0, NULL, 0 },
};
if (virGettextInitialize() < 0)
--
2.33.0
2 years
[PATCH] virsh: Add message to terminal when running snapshot-revert
by Haruka Ohata
When running virsh snapshot-* command, such as
snapshot-create-as / snapshot-delete, it prints a result message.
On the other hand virsh snapshot-revert command doesn't print a result
message.
So, This patch fixes to add message when running virsh snapshot-revert
command.
---
# virsh snapshot-create-as vm1 test1
Domain snapshot test01 created
# virsh snapshot-revert vm1 test1
# virsh snapshot-delete vm1 test1
Domain snapshot test01 deleted
#
---
Signed-off-by: Haruka Ohata <ohata.haruka(a)fujitsu.com>
---
tests/virsh-snapshot | 3 +++
tools/virsh-snapshot.c | 1 +
2 files changed, 4 insertions(+)
diff --git a/tests/virsh-snapshot b/tests/virsh-snapshot
index 4c64bb537b..b09273917b 100755
--- a/tests/virsh-snapshot
+++ b/tests/virsh-snapshot
@@ -100,11 +100,14 @@ Domain snapshot s1 created
Domain snapshot s3 created
Domain snapshot s2 created
+Domain snapshot s3 reverted
Domain snapshot s6 created
Domain snapshot s5 created
+Domain snapshot s6 reverted
Domain snapshot s4 created
+Domain snapshot s1 reverted
Domain snapshot s7 created
Domain snapshot s8 created
diff --git a/tools/virsh-snapshot.c b/tools/virsh-snapshot.c
index 8fa64ba903..6a6c92d0a3 100644
--- a/tools/virsh-snapshot.c
+++ b/tools/virsh-snapshot.c
@@ -1783,6 +1783,7 @@ cmdDomainSnapshotRevert(vshControl *ctl, const vshCmd *cmd)
result = virDomainRevertToSnapshot(snapshot, flags);
}
+ vshPrintExtra(ctl, _("Domain snapshot %s reverted\n"), name);
return result >= 0;
}
--
2.38.1
2 years
[libvirt PATCH 0/1] DO NOT MERGE: RFC: targetted usage of clang-format
by Daniel P. Berrangé
While we have a code style, it is not perfectly applied across the code
base because its impossible for humans to manage that without using
automated tooling. clang-format is the closest we'll get to a code
formatter we could use, but still it would reformat quite alot of our
code.
I discovered that '/* clang-format off */' can be used to stop it from
reformatting sections of code. It is not practical to add that comment
around all places we don't want touched. I thought we could perhaps
use it as a way to limit clang-format to merely do sorting & regrouping
of #include statements though.
This change illustrates what that would look like for the src/util
directory, so we can consider whuether it is worth it.
I've included a mark.pl script that I usd to auto-add the magic
comment. It gets it wrong sometimes, so needs inspection. If we
did decide to use this, we would need the magic comment in every
existing source file.
Then there is the question about new source files. If a contributor
forgets to add the comment, then entire new source file will be
processed by clang-format. This might be desirable. If so, we will
need to fully expand the .clang-format config file to match ou4r
desired style. Right now I only recorded include file rules.
Or we could just wrong a dumb script to do #include sorting
ourselves and carry on ignoring clang-format.
I'm pretty undecided myself.
Daniel P. Berrangé (1):
DO NOT MERGE: use clang-format for sorting #include statement
.clang-format | 32 +++++++++++++++++++++++++
mark.pl | 41 ++++++++++++++++++++++++++++++++
src/util/glibcompat.c | 2 ++
src/util/glibcompat.h | 4 +++-
src/util/iohelper.c | 10 ++++----
src/util/viralloc.c | 5 +++-
src/util/viralloc.h | 2 ++
src/util/virarch.c | 4 +++-
src/util/virarch.h | 2 ++
src/util/virarptable.c | 2 ++
src/util/virarptable.h | 2 ++
src/util/viraudit.c | 6 +++--
src/util/viraudit.h | 2 ++
src/util/virauth.c | 13 ++++++----
src/util/virauth.h | 2 ++
src/util/virauthconfig.c | 6 +++--
src/util/virauthconfig.h | 2 ++
src/util/virbitmap.c | 5 +++-
src/util/virbitmap.h | 5 ++--
src/util/virbpf.c | 5 +++-
src/util/virbpf.h | 2 ++
src/util/virbuffer.c | 2 ++
src/util/virbuffer.h | 3 ++-
src/util/virccw.c | 4 ++++
src/util/virccw.h | 2 ++
src/util/vircgroup.c | 15 ++++++------
src/util/vircgroup.h | 2 ++
src/util/vircgroupbackend.c | 2 ++
src/util/vircgroupbackend.h | 3 ++-
src/util/vircgrouppriv.h | 2 ++
src/util/vircgroupv1.c | 11 +++++----
src/util/vircgroupv1.h | 2 ++
src/util/vircgroupv2.c | 5 ++--
src/util/vircgroupv2.h | 2 ++
src/util/vircgroupv2devices.c | 5 ++--
src/util/vircgroupv2devices.h | 3 ++-
src/util/vircommand.c | 10 ++++----
src/util/vircommand.h | 2 ++
src/util/vircommandpriv.h | 2 ++
src/util/virconf.c | 20 +++++++++-------
src/util/virconf.h | 3 +++
src/util/vircrypto.c | 9 ++++---
src/util/vircrypto.h | 2 ++
src/util/virdaemon.c | 14 ++++++-----
src/util/virdaemon.h | 2 ++
src/util/virdevmapper.c | 15 +++++++-----
src/util/virdevmapper.h | 2 ++
src/util/virdnsmasq.c | 17 +++++++------
src/util/virdnsmasq.h | 2 ++
src/util/virebtables.c | 7 ++++--
src/util/virebtables.h | 2 ++
src/util/virendian.h | 3 +++
src/util/virenum.c | 2 ++
src/util/virenum.h | 2 ++
src/util/virerror.c | 5 +++-
src/util/virerror.h | 2 ++
src/util/virerrorpriv.h | 2 ++
src/util/virevent.c | 5 +++-
src/util/virevent.h | 2 ++
src/util/vireventglib.c | 5 +++-
src/util/vireventglib.h | 2 ++
src/util/vireventglibwatch.c | 3 +++
src/util/vireventglibwatch.h | 2 ++
src/util/vireventthread.c | 5 +++-
src/util/vireventthread.h | 5 +++-
src/util/virfcp.c | 7 +++---
src/util/virfcp.h | 2 ++
src/util/virfdstream.c | 19 ++++++++-------
src/util/virfdstream.h | 3 +++
src/util/virfile.c | 13 ++++++----
src/util/virfile.h | 2 ++
src/util/virfilecache.c | 13 +++++-----
src/util/virfilecache.h | 5 ++--
src/util/virfirewall.c | 9 ++++---
src/util/virfirewall.h | 4 +++-
src/util/virfirewalld.c | 11 +++++----
src/util/virfirewalld.h | 2 ++
src/util/virfirewalldpriv.h | 2 ++
src/util/virfirmware.c | 5 +++-
src/util/virfirmware.h | 2 ++
src/util/virgdbus.c | 4 +++-
src/util/virgdbus.h | 2 ++
src/util/virgettext.c | 4 +++-
src/util/virgettext.h | 2 ++
src/util/virgic.c | 6 ++++-
src/util/virgic.h | 2 ++
src/util/virglibutil.c | 2 ++
src/util/virglibutil.h | 2 ++
src/util/virhash.c | 8 ++++---
src/util/virhash.h | 2 ++
src/util/virhashcode.c | 5 +++-
src/util/virhashcode.h | 5 +++-
src/util/virhook.c | 16 ++++++++-----
src/util/virhook.h | 2 ++
src/util/virhostcpu.c | 12 ++++++----
src/util/virhostcpu.h | 1 +
src/util/virhostcpupriv.h | 2 ++
src/util/virhostmem.c | 14 ++++++-----
src/util/virhostmem.h | 2 ++
src/util/virhostuptime.c | 8 ++++---
src/util/virhostuptime.h | 2 ++
src/util/viridentity.c | 13 ++++++----
src/util/viridentity.h | 5 +++-
src/util/viridentitypriv.h | 2 ++
src/util/virinitctl.c | 7 ++++--
src/util/virinitctl.h | 2 ++
src/util/viriptables.c | 15 +++++++-----
src/util/viriptables.h | 4 +++-
src/util/viriscsi.c | 2 ++
src/util/viriscsi.h | 2 ++
src/util/virjson.c | 10 ++++----
src/util/virjson.h | 5 ++--
src/util/virkeycode.c | 6 ++++-
src/util/virkeycode.h | 2 ++
src/util/virkmod.c | 6 ++++-
src/util/virkmod.h | 2 ++
src/util/virlease.c | 8 ++++---
src/util/virlease.h | 2 ++
src/util/virlockspace.c | 13 ++++++----
src/util/virlockspace.h | 2 ++
src/util/virlog.c | 24 +++++++++++--------
src/util/virlog.h | 2 ++
src/util/virmacaddr.c | 4 +++-
src/util/virmacaddr.h | 2 ++
src/util/virmacmap.c | 9 ++++---
src/util/virmacmap.h | 2 ++
src/util/virmdev.c | 7 ++++--
src/util/virmdev.h | 4 +++-
src/util/virmodule.c | 5 +++-
src/util/virmodule.h | 2 ++
src/util/virnetdev.c | 24 +++++++++++--------
src/util/virnetdev.h | 9 ++++---
src/util/virnetdevbandwidth.c | 6 ++++-
src/util/virnetdevbandwidth.h | 2 ++
src/util/virnetdevbridge.c | 15 +++++++-----
src/util/virnetdevbridge.h | 2 ++
src/util/virnetdevip.c | 15 +++++++-----
src/util/virnetdevip.h | 2 ++
src/util/virnetdevmacvlan.c | 5 +++-
src/util/virnetdevmacvlan.h | 6 +++--
src/util/virnetdevmidonet.c | 3 +++
src/util/virnetdevmidonet.h | 1 +
src/util/virnetdevopenvswitch.c | 12 ++++++----
src/util/virnetdevopenvswitch.h | 4 +++-
src/util/virnetdevpriv.h | 2 ++
src/util/virnetdevtap.c | 22 ++++++++++-------
src/util/virnetdevtap.h | 4 +++-
src/util/virnetdevveth.c | 5 +++-
src/util/virnetdevveth.h | 2 ++
src/util/virnetdevvlan.c | 5 +++-
src/util/virnetdevvlan.h | 2 ++
src/util/virnetdevvportprofile.c | 5 +++-
src/util/virnetdevvportprofile.h | 6 +++--
src/util/virnetlink.c | 11 +++++----
src/util/virnetlink.h | 2 ++
src/util/virnodesuspend.c | 12 ++++++----
src/util/virnodesuspend.h | 2 ++
src/util/virnuma.c | 14 ++++++-----
src/util/virnuma.h | 1 +
src/util/virnvme.c | 7 ++++--
src/util/virnvme.h | 2 ++
src/util/virobject.c | 6 +++--
src/util/virobject.h | 4 +++-
src/util/virpci.c | 16 +++++++------
src/util/virpci.h | 4 +++-
src/util/virpcivpd.c | 8 ++++---
src/util/virpcivpd.h | 2 ++
src/util/virpcivpdpriv.h | 2 ++
src/util/virperf.c | 6 +++--
src/util/virperf.h | 2 ++
src/util/virpidfile.c | 11 +++++----
src/util/virpidfile.h | 3 +++
src/util/virpolkit.c | 10 +++++---
src/util/virpolkit.h | 2 ++
src/util/virportallocator.c | 9 ++++---
src/util/virportallocator.h | 2 ++
src/util/virprobe.h | 2 ++
src/util/virprocess.c | 13 +++++-----
src/util/virprocess.h | 2 ++
src/util/virqemu.c | 8 ++++---
src/util/virqemu.h | 2 ++
src/util/virrandom.c | 11 +++++----
src/util/virrandom.h | 2 ++
src/util/virresctrl.c | 8 ++++---
src/util/virresctrl.h | 5 ++--
src/util/virresctrlpriv.h | 2 ++
src/util/virrotatingfile.c | 3 +++
src/util/virrotatingfile.h | 2 ++
src/util/virscsi.c | 11 +++++----
src/util/virscsi.h | 2 ++
src/util/virscsihost.c | 6 ++++-
src/util/virscsihost.h | 2 ++
src/util/virscsivhost.c | 8 +++++--
src/util/virscsivhost.h | 2 ++
src/util/virseclabel.c | 5 +++-
src/util/virseclabel.h | 2 ++
src/util/virsecret.c | 5 +++-
src/util/virsecret.h | 5 ++--
src/util/virsecureerase.c | 2 ++
src/util/virsecureerase.h | 2 ++
src/util/virsocket.c | 9 ++++---
src/util/virsocket.h | 2 ++
src/util/virsocketaddr.c | 5 +++-
src/util/virsocketaddr.h | 2 ++
src/util/virstoragefile.c | 5 +++-
src/util/virstoragefile.h | 2 ++
src/util/virstring.c | 6 +++--
src/util/virstring.h | 2 ++
src/util/virsysinfo.c | 9 ++++---
src/util/virsysinfo.h | 2 ++
src/util/virsysinfopriv.h | 2 ++
src/util/virsystemd.c | 17 ++++++-------
src/util/virsystemd.h | 2 ++
src/util/virsystemdpriv.h | 2 ++
src/util/virthread.c | 3 ++-
src/util/virthread.h | 4 +++-
src/util/virthreadjob.c | 5 +++-
src/util/virthreadjob.h | 2 ++
src/util/virthreadpool.c | 5 +++-
src/util/virthreadpool.h | 2 ++
src/util/virtime.c | 5 +++-
src/util/virtime.h | 2 ++
src/util/virtpm.c | 11 +++++----
src/util/virtpm.h | 2 ++
src/util/virtypedparam-public.c | 4 +++-
src/util/virtypedparam.c | 5 +++-
src/util/virtypedparam.h | 2 ++
src/util/viruri.c | 4 +++-
src/util/viruri.h | 2 ++
src/util/virusb.c | 9 ++++---
src/util/virusb.h | 2 ++
src/util/virutil.c | 14 ++++++-----
src/util/virutil.h | 6 +++--
src/util/viruuid.c | 10 ++++----
src/util/viruuid.h | 1 +
src/util/virvhba.c | 5 +++-
src/util/virvhba.h | 2 ++
src/util/virvsock.c | 4 ++--
src/util/virvsock.h | 2 ++
src/util/virxdrdefs.h | 2 ++
src/util/virxml.c | 13 ++++++----
src/util/virxml.h | 7 +++---
242 files changed, 986 insertions(+), 367 deletions(-)
create mode 100644 .clang-format
create mode 100644 mark.pl
--
2.37.3
2 years
[PATCH 0/2] Fix some coding issues
by Jiang Jiacheng
*** BLURB HERE ***
Jiang Jiacheng (2):
qemu: convert the flags type to unsigned long
coding-style: Use the same style in the same structure
src/locking/lock_daemon.c | 12 ++++++------
src/logging/log_daemon.c | 12 ++++++------
src/qemu/qemu_migration.c | 4 ++--
src/remote/remote_daemon.c | 14 +++++++-------
4 files changed, 21 insertions(+), 21 deletions(-)
--
2.33.0
2 years
[PATCH] virmockstathelpers: Load aliases for 64-bit time
by Michal Privoznik
On 32-bit arches, it's possible not only to request
-D_FILE_OFFSET_BITS=64 (which is always done with meson) but also
-D_TIME_BITS=64. With glibc, both of these affect what variant of
stat() or lstat() is called. With 64 bit time it's:
__stat64_time64() or __lstat64_time64(), respectively.
Fortunately, no other variant (__xstat(), __xstat64()) has
_time64 alternative and thus does not need similar treatment.
Similarly, musl is not affected by this.
Resolves: https://gitlab.com/libvirt/libvirt/-/issues/404
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
Mind you, after this I still see two tests failing:
1) virnettlscontexttest
2) virnettlssessiontest
But I believe the problem is that GnuTLS on my 32bit RPi was not built
with -D_TIME_BITS=64 and thus when generating certificates and setting
their activation/expiry times I get the following errors:
TEST: virnettlscontexttest
1) TLS Context cacertreq.filename + servercertreq.filename ... libvirt: XML-RPC error : The server certificate servercertreq-ctx.pem is not yet active
FAILED
TEST: virnettlssessiontest
1) TLS Session servercertreq.filename + clientcertreq.filename ... libvirt: XML-RPC error : authentication failed: Failed to verify peer's certificate
FAILED
Setting of activation/expiry times is done by calling:
1) gnutls_x509_crt_set_activation_time(..., time_t act_time)
2) gnutls_x509_crt_set_expiration_time(..., time_t exp_time)
And this is how calling the first looks under disassembly:
7428: e51b1128 ldr r1, [fp, #-296] ; 0xfffffed8
742c: e14b2dd4 ldrd r2, [fp, #-212] ; 0xffffff2c
7430: e1a00001 mov r0, r1
7434: ebfff23d bl 3d30 <gnutls_x509_crt_set_activation_time@plt>
Now, ldrd instruction modifies both r2 and r3 by loading 4+4 bytes from
a memory address [1]. But the first thing that
gnutls_x509_crt_set_activation_time() does is overwriting r3 register:
000fb4a0 <gnutls_x509_crt_set_activation_time>:
fb4a0: e52de004 push {lr} ; (str lr, [sp, #-4]!)
fb4a4: e250c000 subs ip, r0, #0
fb4a8: e59f3080 ldr r3, [pc, #128] ; fb530 <gnutls_x509_crt_set_activation_time+0x90>
fb4ac: e24dd00c sub sp, sp, #12
fb4b0: e08f3003 add r3, pc, r3
fb4b4: 0a000009 beq fb4e0 <gnutls_x509_crt_set_activation_time+0x40>
With 32-bit time_t the disassembly looks a bit different:
73e4: e51b3114 ldr r3, [fp, #-276] ; 0xfffffeec
73e8: e51b10f4 ldr r1, [fp, #-244] ; 0xffffff0c
73ec: e1a00003 mov r0, r3
73f0: ebfff250 bl 3d38 <gnutls_x509_crt_set_activation_time@plt>
1: It should be 'ldrd r2, r3, $memAddr' but the second register is
implied by the first one, so it can be shortened:
https://developer.arm.com/documentation/ddi0406/c/Application-Level-Archi...
tests/virmockstathelpers.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/tests/virmockstathelpers.c b/tests/virmockstathelpers.c
index 39e270eaac..5b1f3b08a7 100644
--- a/tests/virmockstathelpers.c
+++ b/tests/virmockstathelpers.c
@@ -54,6 +54,10 @@
* Unfortunately, because we are trying to mock replace the C library,
* we need to know about this internal impl detail.
*
+ * Furthermore, support for 64-bit time can be enabled, which on 32-bit
+ * systems with glibc overwrites stat64() to __stat64_time64() and lstat64()
+ * to __lstat64_time64().
+ *
* On macOS stat() and lstat() are resolved to _stat$INODE64 and
* _lstat$INODE64, respectively. stat(2) man page also declares that
* stat64(), lstat64() and fstat64() are deprecated, and when
@@ -168,7 +172,11 @@ static void virMockStatInit(void)
fdebug("real stat %p\n", real_stat);
#endif
#ifdef MOCK_STAT64
+# if defined(__GLIBC__) && defined(_TIME_BITS) && _TIME_BITS == 64
+ VIR_MOCK_REAL_INIT_ALIASED(stat64, "__stat64_time64");
+# else
VIR_MOCK_REAL_INIT(stat64);
+# endif
fdebug("real stat64 %p\n", real_stat64);
#endif
#ifdef MOCK___XSTAT
@@ -188,7 +196,11 @@ static void virMockStatInit(void)
fdebug("real lstat %p\n", real_lstat);
#endif
#ifdef MOCK_LSTAT64
+# if defined(__GLIBC__) && defined(_TIME_BITS) && _TIME_BITS == 64
+ VIR_MOCK_REAL_INIT_ALIASED(lstat64, "__lstat64_time64");
+# else
VIR_MOCK_REAL_INIT(lstat64);
+# endif
fdebug("real lstat64 %p\n", real_lstat64);
#endif
#ifdef MOCK___LXSTAT
--
2.37.4
2 years
[PATCH 0/3] docs: drvqemu: Fixes for device property overriding docs
by Peter Krempa
Peter Krempa (3):
docs: drvqemu: Fix and improve docs about device override types
docs: drvqemu: Give example how to query device properties for
overriding
docs: drvqemu: Remove inaccuate limitations statement
docs/drvqemu.rst | 41 ++++++++++++++++++++++++++++++++++-------
1 file changed, 34 insertions(+), 7 deletions(-)
--
2.37.3
2 years
[PATCH] tests: Drop needless virrandom mock from two tests
by Michal Privoznik
Nothing in virnettlscontexttest nor virnettlssessiontest calls
any of random number generator functions overridden
virrandommock. GnuTLS handles RNG within itself.
Therefore, there's no need to preload the mock.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
tests/virnettlscontexttest.c | 2 +-
tests/virnettlssessiontest.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/tests/virnettlscontexttest.c b/tests/virnettlscontexttest.c
index 403cd8d0ac..2311524db8 100644
--- a/tests/virnettlscontexttest.c
+++ b/tests/virnettlscontexttest.c
@@ -627,7 +627,7 @@ mymain(void)
return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
}
-VIR_TEST_MAIN_PRELOAD(mymain, VIR_TEST_MOCK("virrandom"))
+VIR_TEST_MAIN(mymain);
#else
diff --git a/tests/virnettlssessiontest.c b/tests/virnettlssessiontest.c
index 5b98a6de3e..285cde57d8 100644
--- a/tests/virnettlssessiontest.c
+++ b/tests/virnettlssessiontest.c
@@ -482,7 +482,7 @@ mymain(void)
return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
}
-VIR_TEST_MAIN_PRELOAD(mymain, VIR_TEST_MOCK("virrandom"))
+VIR_TEST_MAIN(mymain);
#else
--
2.37.4
2 years
[libvirt PATCH 0/2] A few post-copy related fixes
by Jiri Denemark
*** BLURB EVERYWHERE ***
Jiri Denemark (2):
qemu: Always restore post-copy migration job on reconnect
qemu: Ignore failure in post-copy migration when QEMU says completed
src/qemu/qemu_migration.c | 8 ++++++++
src/qemu/qemu_process.c | 15 ++++++++++-----
2 files changed, 18 insertions(+), 5 deletions(-)
--
2.38.1
2 years
Plans for the next release
by Jiri Denemark
We are getting close to the last release of libvirt in 2022. To aim for
the release on Dec 01 I suggest entering the freeze on Thursday Nov 24
and tagging RC2 on Tuesday Nov 29.
I hope this works for everyone.
Jirka
2 years