[PATCH V2 3/4] Apparmor: Allow reading libnl's classid file

2021-06-22 Thread Jim Fehlig
I noticed the following denial messages from apparmor in audit.log when starting confined VMs via the QEMU driver type=AVC msg=audit(1623864006.370:837): apparmor="DENIED" operation="open" \ profile="virt-aa-helper" name="/etc/libnl/classid" pid=11265 \ comm="virt-aa-helper" requested_mask="r"

[PATCH V2 2/4] Apparmor: Add profile for virtxend

2021-06-22 Thread Jim Fehlig
A new apparmor profile initially derived from the libvirtd profile. All rules were prefixed with the 'audit' qualifier to verify they are actually used by virtxend. It turns out that several, beyond the obvious ones, can be dropped in the resulting virtxend profile. Signed-off-by: Jim Fehlig ---

[PATCH V2 0/4] Apparmor: Add profiles for hypervisor daemons

2021-06-22 Thread Jim Fehlig
and other improvements. V2 of https://listman.redhat.com/archives/libvir-list/2021-June/msg00456.html Changes since V1: Removed many unneeded capabilities. I used the 'audit' qualifier as suggested by cboltz to verify which capabilities were actually used. It's a difficult task though, as it is

[PATCH V2 4/4] Apparmor: Allow reading /etc/ssl/openssl.cnf

2021-06-22 Thread Jim Fehlig
I noticed the following denial when running confined VMs with the QEMU driver type=AVC msg=audit(1623865089.263:865): apparmor="DENIED" operation="open" \ profile="virt-aa-helper" name="/etc/ssl/openssl.cnf" pid=12503 \ comm="virt-aa-helper" requested_mask="r" denied_mask="r" fsuid=0 ouid=0

[PATCH V2 1/4] Apparmor: Add profile for virtqemud

2021-06-22 Thread Jim Fehlig
A new apparmor profile derived from the libvirtd profile, with non-QEMU related rules removed. Adopt the libvirt-qemu abstraction to work with the new profile. Signed-off-by: Jim Fehlig --- src/security/apparmor/libvirt-qemu | 3 + src/security/apparmor/meson.build | 1 +

Re: [PATCH] test_driver: Implement virDomainGetMessages

2021-06-22 Thread Martin Kletzander
[Another one of those lost e-mails] On Wed, Jun 16, 2021 at 05:23:36PM +0800, Luke Yue wrote: On Tue, 2021-06-15 at 10:09 +0200, Martin Kletzander wrote: On Mon, Jun 14, 2021 at 09:13:17PM +0800, Luke Yue wrote: > Signed-off-by: Luke Yue > --- > src/test/test_driver.c | 53 >

Re: [PATCH] test_driver: Implement virDomainGetSecurityLabelList

2021-06-22 Thread Martin Kletzander
[Just found out I got couple of mails lost, so resending even though it was sent a week ago] On Wed, Jun 16, 2021 at 05:21:17PM +0800, Luke Yue wrote: On Tue, 2021-06-15 at 10:08 +0200, Martin Kletzander wrote: On Mon, Jun 14, 2021 at 09:12:57PM +0800, Luke Yue wrote: > Signed-off-by: Luke

[libvirt PATCH v2 0/5] mdev tweaks

2021-06-22 Thread Jonathon Jongsma
A few minor fixes to mdev support in the nodedev driver Changes in v2: - split out the error-reporting macro into a separate commit as recommended by Peter - Since virCommandRun() may report an error, ensure that the virMdevctl$COMMAND() functions always set an error to make error-handling

[libvirt PATCH v2 5/5] nodedev: improve error message when destroying an inactive device

2021-06-22 Thread Jonathon Jongsma
When trying to destroy a node device that is not active, we end up with a confusing error message: # nodedev-destroy mdev_88a6b868_46bd_4015_8e5b_26107f82da38 error: Failed to destroy node device 'mdev_88a6b868_46bd_4015_8e5b_26107f82da38' error: failed to access

[libvirt PATCH v2 2/5] nodedev: Handle NULL command variable

2021-06-22 Thread Jonathon Jongsma
In commit 68580a51, I removed the checks for NULL cmd variables because virCommandRun() already handles the case where it is called with a NULL cmd. Unfortunately, it handles this case by raising a generic error which is both unhelpful and overwrites our existing error message. So for example,

[libvirt PATCH v2 4/5] nodedev: handle mdevctl errors consistently

2021-06-22 Thread Jonathon Jongsma
Currently, we have three different types of mdevctl errors: 1. the command cannot be constructed ecause of unsatisfied preconditions 2. the command cannot be executed due to some error 3. the command is executed, but returns an error status These different failures are handled differently.

[libvirt PATCH v2 3/5] nodedev: add macro to handle command errors

2021-06-22 Thread Jonathon Jongsma
This macro will be utilized in the following patch. Since mdevctl commands can fail with or without an error message, this macro makes it easy to print a fallback error in the case that the error message is not set. Signed-off-by: Jonathon Jongsma --- src/node_device/node_device_driver.c | 7

[libvirt PATCH v2 1/5] nodedev: Remove useless device name from error message

2021-06-22 Thread Jonathon Jongsma
At the point where the error message is emitted, the field def->name is still set to "new device", so the error message becomes: Unable to start mediated device 'new device': ... Since the name doesn't contain anything useful, just omit it from the error message altogether. Signed-off-by:

Re: [PATCH] ci: Also perform `brew upgrade` on MacOS

2021-06-22 Thread Martin Kletzander
On Wed, Jun 16, 2021 at 06:21:00AM -0700, Andrea Bolognani wrote: On Tue, Jun 15, 2021 at 12:43:39PM +0200, Martin Kletzander wrote: ci: Also perform `brew upgrade` on MacOS s/MacOS/macOS/ But see below for why we might have to change the subject even further. @Andrea: if you have a good

Re: [PATCH v3 1/6] schemas: Make SEV policy on launch security optional

2021-06-22 Thread Daniel Henrique Barboza
On 6/22/21 10:10 AM, Boris Fiuczynski wrote: Change launch security policy of type SEV from required to optional and add a test to ensure the required launch security policy remains required when launch security type is SEV. Signed-off-by: Boris Fiuczynski --- Reviewed-by: Daniel Henrique

Re: [PATCH v3 3/6] conf: refactor launch security to allow more types

2021-06-22 Thread Daniel Henrique Barboza
On 6/22/21 10:10 AM, Boris Fiuczynski wrote: Adding virDomainSecDef for general launch security data and moving virDomainSEVDef as an element for SEV data. Signed-off-by: Boris Fiuczynski --- Reviewed-by: Daniel Henrique Barboza src/conf/domain_conf.c | 127

Re: [PATCH v3 2/6] conf: modernize SEV XML parse and format methods

2021-06-22 Thread Daniel Henrique Barboza
On 6/22/21 10:10 AM, Boris Fiuczynski wrote: Make use of virDomainLaunchSecurity enum and automatic memory freeing. Signed-off-by: Boris Fiuczynski --- Reviewed-by: Daniel Henrique Barboza src/conf/domain_conf.c | 123 + src/conf/domain_conf.h

Re: [libvirt PATCH 6/7] nodedev: Implement virNodeDeviceIsPersistent()/IsActive()

2021-06-22 Thread Boris Fiuczynski
On 6/22/21 5:08 PM, Jonathon Jongsma wrote: On Tue, Jun 22, 2021 at 10:03 AM Boris Fiuczynski wrote: On 6/22/21 4:33 PM, Jonathon Jongsma wrote: So it appears that there is a bug where an mdev is still marked as autostart even after it's undefined. Was there anything else you were trying to

Re: [libvirt PATCH 6/7] nodedev: Implement virNodeDeviceIsPersistent()/IsActive()

2021-06-22 Thread Jonathon Jongsma
On Tue, Jun 22, 2021 at 10:03 AM Boris Fiuczynski wrote: > > On 6/22/21 4:33 PM, Jonathon Jongsma wrote: > > So it appears that there is a bug where an mdev is still marked as > > autostart even after it's undefined. Was there anything else you were > > trying to demonstrate? > > > > Jonathon > >

Re: [libvirt PATCH] nodedev: handle mdevs from multiple parents

2021-06-22 Thread Jonathon Jongsma
ping On Thu, Jun 10, 2021 at 1:18 PM Jonathon Jongsma wrote: > > Due to a rather unfortunate misunderstanding, we were parsing the list > of defined devices from mdevctl incorrectly. Since my primary > development machine only has a single device capable of mdevs, I > apparently neglected to

Re: [libvirt PATCH 6/7] nodedev: Implement virNodeDeviceIsPersistent()/IsActive()

2021-06-22 Thread Boris Fiuczynski
On 6/22/21 4:33 PM, Jonathon Jongsma wrote: So it appears that there is a bug where an mdev is still marked as autostart even after it's undefined. Was there anything else you were trying to demonstrate? Jonathon Don't you need to resync with mdevctl on nodedev-info? If you would resync and

Re: [libvirt PATCH 6/7] nodedev: Implement virNodeDeviceIsPersistent()/IsActive()

2021-06-22 Thread Jonathon Jongsma
On Tue, Jun 22, 2021 at 2:08 AM Boris Fiuczynski wrote: > > On 6/14/21 10:46 PM, Jonathon Jongsma wrote: > > On Mon, Jun 14, 2021 at 12:27 PM Boris Fiuczynski > > wrote: > >> > >> On 6/3/21 10:11 PM, Jonathon Jongsma wrote: > >>> Implement these new API functions in the nodedev driver. > >>> >

Re: [libvirt PATCH] docs: Fix some typos

2021-06-22 Thread Jano Tomko
On 6/22/21 3:54 PM, Tim Wiederhake wrote: > Signed-off-by: Tim Wiederhake > --- > docs/kbase/live_full_disk_backup.rst | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > Reviewed-by: Ján Tomko and pushed. Jano

[libvirt PATCH] docs: Fix some typos

2021-06-22 Thread Tim Wiederhake
Signed-off-by: Tim Wiederhake --- docs/kbase/live_full_disk_backup.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/kbase/live_full_disk_backup.rst b/docs/kbase/live_full_disk_backup.rst index 1605ec05d2..562a9e87b0 100644 ---

[PATCH v3 2/6] conf: modernize SEV XML parse and format methods

2021-06-22 Thread Boris Fiuczynski
Make use of virDomainLaunchSecurity enum and automatic memory freeing. Signed-off-by: Boris Fiuczynski --- src/conf/domain_conf.c | 123 + src/conf/domain_conf.h | 2 + 2 files changed, 64 insertions(+), 61 deletions(-) diff --git

[PATCH v3 1/6] schemas: Make SEV policy on launch security optional

2021-06-22 Thread Boris Fiuczynski
Change launch security policy of type SEV from required to optional and add a test to ensure the required launch security policy remains required when launch security type is SEV. Signed-off-by: Boris Fiuczynski --- docs/schemas/domaincommon.rng | 12 ---

[PATCH v3 5/6] conf: add s390-pv as launch security type

2021-06-22 Thread Boris Fiuczynski
Add launch security type 's390-pv' as well as some tests. Signed-off-by: Boris Fiuczynski Reviewed-by: Daniel Henrique Barboza --- docs/schemas/domaincommon.rng | 1 + src/conf/domain_conf.c| 8 + src/conf/domain_conf.h| 1

[PATCH v3 4/6] qemu: add s390-pv-guest capability

2021-06-22 Thread Boris Fiuczynski
Add s390-pv-guest capability. Signed-off-by: Boris Fiuczynski Reviewed-by: Daniel Henrique Barboza --- src/qemu/qemu_capabilities.c| 2 ++ src/qemu/qemu_capabilities.h| 1 + tests/qemucapabilitiesdata/caps_6.0.0.s390x.xml | 1 + 3 files changed, 4

[PATCH v3 0/6] Support for launchSecurity type s390-pv

2021-06-22 Thread Boris Fiuczynski
This patch series introduces the launch security type s390-pv. Specifying s390-pv as launch security type in an s390 domain prepares for running the guest in protected virtualization secure mode, also known as IBM Secure Execution. diff to v2: - Broke up previous patch one into three patches

[PATCH v3 6/6] docs: add s390-pv documentation

2021-06-22 Thread Boris Fiuczynski
Add documentation for launch security type s390-pv. Signed-off-by: Boris Fiuczynski Reviewed-by: Daniel Henrique Barboza --- docs/formatdomain.rst | 7 docs/kbase/s390_protected_virt.rst | 55 +- 2 files changed, 54 insertions(+), 8 deletions(-)

[PATCH v3 3/6] conf: refactor launch security to allow more types

2021-06-22 Thread Boris Fiuczynski
Adding virDomainSecDef for general launch security data and moving virDomainSEVDef as an element for SEV data. Signed-off-by: Boris Fiuczynski --- src/conf/domain_conf.c | 127 +++- src/conf/domain_conf.h | 11 +++- src/conf/virconftypes.h | 2 +

[libvirt PATCH 16/16] virDomainFeaturesDefParse: Simplify APIC parsing

2021-06-22 Thread Tim Wiederhake
Signed-off-by: Tim Wiederhake --- src/conf/domain_conf.c | 23 ++- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 50717c4f44..d78f846a52 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@

[libvirt PATCH 13/16] virDomainFeaturesDefParse: Inline MSRS parsing

2021-06-22 Thread Tim Wiederhake
Signed-off-by: Tim Wiederhake --- src/conf/domain_conf.c | 26 -- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index b411c1fb8c..915303adcd 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c

[libvirt PATCH 11/16] virDomainFeaturesXENDefParse: Remove tautological "if"

2021-06-22 Thread Tim Wiederhake
Signed-off-by: Tim Wiederhake --- src/conf/domain_conf.c | 58 -- 1 file changed, 28 insertions(+), 30 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 45c4b9cedf..02c06d5ab9 100644 --- a/src/conf/domain_conf.c +++

[libvirt PATCH 10/16] virDomainFeaturesXENDefParse: Remove ctxt

2021-06-22 Thread Tim Wiederhake
Iterating over all child elements of a node does not require xpath. By doing away with xpath for this code, the code can be simplified. Signed-off-by: Tim Wiederhake --- src/conf/domain_conf.c | 25 ++--- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git

[libvirt PATCH 03/16] virDomainFeaturesHyperVDefParse: Remove ctxt

2021-06-22 Thread Tim Wiederhake
Iterating over all child elements of a node does not require xpath. By doing away with xpath for this code, the code can be simplified. Signed-off-by: Tim Wiederhake --- src/conf/domain_conf.c | 27 --- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git

[libvirt PATCH 02/16] virDomainFeaturesHyperVDefParse: Inline hyperv/stimer parsing

2021-06-22 Thread Tim Wiederhake
Iterating over all child elements of a node does not require xpath. By doing away with xpath for this code, the code can be inlined and simplified. This also removes the re-use of `nodes`, elimininating two VIR_FREEs. Signed-off-by: Tim Wiederhake --- src/conf/domain_conf.c | 46

[libvirt PATCH 14/16] virDomainFeaturesDefParse: Factor out capabilities parsing into separate function

2021-06-22 Thread Tim Wiederhake
Cleanup to follow. This removes the last re-use of `nodes` in this function, eliminating two VIR_FREEs. Signed-off-by: Tim Wiederhake --- src/conf/domain_conf.c | 78 +- 1 file changed, 46 insertions(+), 32 deletions(-) diff --git

[libvirt PATCH 07/16] virDomainFeaturesKVMDefParse: Remove tautological "switch"

2021-06-22 Thread Tim Wiederhake
`feature` is always one of the values listed in the switch, ensured by `virDomainKVMTypeFromString` above. Signed-off-by: Tim Wiederhake --- src/conf/domain_conf.c | 18 -- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/src/conf/domain_conf.c

[libvirt PATCH 15/16] virDomainFeaturesCapabilitiesDefParse: Remove ctxt

2021-06-22 Thread Tim Wiederhake
Iterating over all child elements of a node does not require xpath. By doing away with xpath for this code, the code can be simplified. Signed-off-by: Tim Wiederhake --- src/conf/domain_conf.c | 22 -- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git

[libvirt PATCH 05/16] virDomainFeaturesDefParse: Factor out KVM parsing into separate function

2021-06-22 Thread Tim Wiederhake
Only moving code, cleanup to follow. Signed-off-by: Tim Wiederhake --- src/conf/domain_conf.c | 88 +- 1 file changed, 53 insertions(+), 35 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 3ba41869ec..384740c364 100644 ---

[libvirt PATCH 12/16] virDomainFeaturesDefParse: Inline SMM parsing

2021-06-22 Thread Tim Wiederhake
Signed-off-by: Tim Wiederhake --- src/conf/domain_conf.c | 41 ++--- 1 file changed, 26 insertions(+), 15 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 02c06d5ab9..b411c1fb8c 100644 --- a/src/conf/domain_conf.c +++

[libvirt PATCH 06/16] virDomainFeaturesKVMDefParse: Remove ctxt

2021-06-22 Thread Tim Wiederhake
Iterating over all child elements of a node does not require xpath. By doing away with xpath for this code, the code can be simplified. Signed-off-by: Tim Wiederhake --- src/conf/domain_conf.c | 22 +- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git

[libvirt PATCH 01/16] virDomainFeaturesDefParse: Factor out HyperV parsing into separate function

2021-06-22 Thread Tim Wiederhake
Only moving code, cleanup to follow. Signed-off-by: Tim Wiederhake --- src/conf/domain_conf.c | 236 ++--- 1 file changed, 127 insertions(+), 109 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index f65509d8ec..8cf57db7ba 100644

[libvirt PATCH 09/16] virDomainFeaturesDefParse: Factor out XEN parsing into separate function

2021-06-22 Thread Tim Wiederhake
Only moving code, cleanup to follow. Signed-off-by: Tim Wiederhake --- src/conf/domain_conf.c | 108 - 1 file changed, 63 insertions(+), 45 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 24529f3093..e687f18afe 100644 ---

[libvirt PATCH 00/16] Refactor virDomainFeaturesDefParse

2021-06-22 Thread Tim Wiederhake
Some refactoring in preparation for adding support for qemu's "hv-passthrough" and the yet-to-be-merged "hv-defaults". Tim Wiederhake (16): virDomainFeaturesDefParse: Factor out HyperV parsing into separate function virDomainFeaturesHyperVDefParse: Inline hyperv/stimer parsing

[libvirt PATCH 08/16] virDomainFeaturesKVMDefParse: Remove tautological "if"

2021-06-22 Thread Tim Wiederhake
Signed-off-by: Tim Wiederhake --- src/conf/domain_conf.c | 30 ++ 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 62565601ab..24529f3093 100644 --- a/src/conf/domain_conf.c +++

[libvirt PATCH 04/16] virDomainFeaturesHyperVDefParse: Remove tautological "if"

2021-06-22 Thread Tim Wiederhake
Fix some line wrapping in the process. Signed-off-by: Tim Wiederhake --- src/conf/domain_conf.c | 163 +++-- 1 file changed, 77 insertions(+), 86 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index b778dfe463..3ba41869ec 100644

[PATCH] tests: qemucapabilities: Bump test data for qemu-6.1 on x86_64

2021-06-22 Thread Peter Krempa
Update the caps data for the upcoming qemu version. Notable changes are: - 'query-sev-attestation-report' command added - 'sample-pages' members for dirty rate calculation added - 'qtest' device added - 'share' member added to query-memdev and 'reserve' members added to

RE: [RFC PATCH 0/7] LIBVIRT: X86: TDX support

2021-06-22 Thread Yamahata, Isaku
> -Original Message- > From: Peter Krempa > Sent: Monday, June 21, 2021 1:06 AM > To: Duan, Zhenzhong > Cc: libvir-list@redhat.com; Yamahata, Isaku ; Tian, > Jun J ; Qiang, Chenyi > > Subject: Re: [RFC PATCH 0/7] LIBVIRT: X86: TDX support ... > > > > Using these patches we have

[PATCH] qemu: Don't use memory-backend-memfd for NVDIMMs

2021-06-22 Thread Michal Privoznik
If guest is configured to use memfd then the function that build memory-backend-* part of command line will put memory-backend-memfd, always. Even for NVDIMMs. This is not correct, because NVDIMMs need a backing path (usually to a real host NVDIMM device). Therefore, regardless of memfd being

Re: [libvirt PATCH 6/7] nodedev: Implement virNodeDeviceIsPersistent()/IsActive()

2021-06-22 Thread Boris Fiuczynski
On 6/14/21 10:46 PM, Jonathon Jongsma wrote: On Mon, Jun 14, 2021 at 12:27 PM Boris Fiuczynski wrote: On 6/3/21 10:11 PM, Jonathon Jongsma wrote: Implement these new API functions in the nodedev driver. Signed-off-by: Jonathon Jongsma --- src/node_device/node_device_driver.c | 50

Re: [RFC PATCH 0/7] LIBVIRT: X86: TDX support

2021-06-22 Thread Peter Krempa
On Mon, Jun 21, 2021 at 19:28:26 +, Yamahata, Isaku wrote: [...] > > > Sorry, seems qemu patches link is missed in [1]. List all links below for > > > your reference. > > > > > > kvm TDX branch: https://github.com/intel/tdx/tree/kvm > > > TDX guest branch: