[lxc-devel] [lxd/master] lxd/apparmor: Workaround socket handling
stgraber on Github
lxc-bot at linuxcontainers.org
Tue Nov 10 23:07:04 UTC 2020
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 496 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20201110/6bcc71e0/attachment.bin>
-------------- next part --------------
From c6d7f2a92bafa217593f482611fd98e941e2ce30 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Tue, 10 Nov 2020 18:05:39 -0500
Subject: [PATCH] lxd/apparmor: Workaround socket handling
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
It appears that on some kernel at least, the connect operation is
evaluated against the non-dereference path when dealing with a symlink.
Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
lxd/apparmor/instance_forkproxy.go | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/lxd/apparmor/instance_forkproxy.go b/lxd/apparmor/instance_forkproxy.go
index 7b320f0056..5518e53b2d 100644
--- a/lxd/apparmor/instance_forkproxy.go
+++ b/lxd/apparmor/instance_forkproxy.go
@@ -77,7 +77,7 @@ profile "{{ .name }}" flags=(attach_disconnected,mediate_deleted) {
/snap/lxd/*/lib/**.so* mr,
{{- end }}
-{{if .libraryPath -}}
+{{if .libraryPath }}
# Entries from LD_LIBRARY_PATH
{{range $index, $element := .libraryPath}}
{{$element}}/** mr,
@@ -138,7 +138,9 @@ func forkproxyProfile(state *state.State, inst instance, dev device) (string, er
return "", err
}
- sockets[k] = v
+ if !shared.StringInSlice(v, sockets) {
+ sockets = append(sockets, v)
+ }
}
// Render the profile.
More information about the lxc-devel
mailing list