Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
L
libvirt
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Libvirt Packaging Team
libvirt
Commits
6568c681
Verified
Commit
6568c681
authored
4 years ago
by
Christian Ehrhardt
Browse files
Options
Downloads
Patches
Plain Diff
apparmor: allow hot-plug for qcow backing chains
Closes: #981001
parent
561e347a
No related branches found
No related tags found
1 merge request
!90
apparmor: allow hot-plug for qcow backing chains
Pipeline
#223652
passed
4 years ago
Stage: build
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
debian/patches/backport/apparmor-let-image-label-setting-loop-over-backing-files.patch
+81
-0
81 additions, 0 deletions
...mor-let-image-label-setting-loop-over-backing-files.patch
debian/patches/series
+1
-0
1 addition, 0 deletions
debian/patches/series
with
82 additions
and
0 deletions
debian/patches/backport/apparmor-let-image-label-setting-loop-over-backing-files.patch
0 → 100644
+
81
−
0
View file @
6568c681
From: Christian Ehrhardt <christian.ehrhardt@canonical.com>
Date: Wed, 13 Jan 2021 12:32:18 +0100
Subject: apparmor: let image label setting loop over backing files
When adding a rule for an image file and that image file has a chain
of backing files then we need to add a rule for each of those files.
To get that iterate over the backing file chain the same way as
dac/selinux already do and add a label for each.
Fixes: https://gitlab.com/libvirt/libvirt/-/issues/118
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
(cherry picked from commit d51ad0008dc2df0257f69e767ab3e3c5fd1457ff)
---
src/security/security_apparmor.c | 39 +++++++++++++++++++++++++++------------
1 file changed, 27 insertions(+), 12 deletions(-)
diff --git a/src/security/security_apparmor.c b/src/security/security_apparmor.c
index c2d86c6..a840d36 100644
--- a/src/security/security_apparmor.c
+++ b/src/security/security_apparmor.c
@@ -764,22 +764,13 @@
AppArmorRestoreInputLabel(virSecurityManagerPtr mgr,
/* Called when hotplugging */
static int
-AppArmorSetSecurityImageLabel(virSecurityManagerPtr mgr,
- virDomainDefPtr def,
- virStorageSourcePtr src,
- virSecurityDomainImageLabelFlags flags G_GNUC_UNUSED)
+AppArmorSetSecurityImageLabelInternal(virSecurityManagerPtr mgr,
+ virDomainDefPtr def,
+ virStorageSourcePtr src)
{
- virSecurityLabelDefPtr secdef;
g_autofree char *vfioGroupDev = NULL;
const char *path;
- secdef = virDomainDefGetSecurityLabelDef(def, SECURITY_APPARMOR_NAME);
- if (!secdef || !secdef->relabel)
- return 0;
-
- if (!secdef->imagelabel)
- return 0;
-
if (src->type == VIR_STORAGE_TYPE_NVME) {
const virStorageSourceNVMeDef *nvme = src->nvme;
@@ -805,6 +796,30 @@
AppArmorSetSecurityImageLabel(virSecurityManagerPtr mgr,
return reload_profile(mgr, def, path, true);
}
+static int
+AppArmorSetSecurityImageLabel(virSecurityManagerPtr mgr,
+ virDomainDefPtr def,
+ virStorageSourcePtr src,
+ virSecurityDomainImageLabelFlags flags G_GNUC_UNUSED)
+{
+ virSecurityLabelDefPtr secdef;
+ virStorageSourcePtr n;
+
+ secdef = virDomainDefGetSecurityLabelDef(def, SECURITY_APPARMOR_NAME);
+ if (!secdef || !secdef->relabel)
+ return 0;
+
+ if (!secdef->imagelabel)
+ return 0;
+
+ for (n = src; virStorageSourceIsBacking(n); n = n->backingStore) {
+ if (AppArmorSetSecurityImageLabelInternal(mgr, def, n) < 0)
+ return -1;
+ }
+
+ return 0;
+}
+
static int
AppArmorSecurityVerify(virSecurityManagerPtr mgr G_GNUC_UNUSED,
virDomainDefPtr def)
This diff is collapsed.
Click to expand it.
debian/patches/series
+
1
−
0
View file @
6568c681
backport/apparmor-let-image-label-setting-loop-over-backing-files.patch
forward/Skip-vircgrouptest.patch
forward/Reduce-udevadm-settle-timeout-to-10-seconds.patch
forward/Pass-GPG_TTY-env-var-to-the-ssh-binary.patch
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment