[lxc-devel] [lxd/master] lxd/containers: Add configfs and tracefs

stgraber on Github lxc-bot at linuxcontainers.org
Thu Mar 19 20:03:05 UTC 2020


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 370 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20200319/e59bfd9c/attachment.bin>
-------------- next part --------------
From ea0b3219cc0a1d2270605708388ff0dc7167b5b8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Thu, 19 Mar 2020 15:51:45 -0400
Subject: [PATCH] lxd/containers: Add configfs and tracefs
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Closes #7059

Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
 lxd/apparmor/apparmor.go           | 8 ++++++++
 lxd/instance/drivers/driver_lxc.go | 5 ++++-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/lxd/apparmor/apparmor.go b/lxd/apparmor/apparmor.go
index 3c395baebd..abeb15bf0f 100644
--- a/lxd/apparmor/apparmor.go
+++ b/lxd/apparmor/apparmor.go
@@ -53,6 +53,10 @@ const profileBase = `
   # Handle cgroupfs
   mount options=(ro, nosuid, nodev, noexec, remount, strictatime) -> /sys/fs/cgroup/,
 
+  # Handle configfs
+  mount fstype=configfs -> /sys/kernel/config/,
+  deny /sys/kernel/config/{,**} rwklx,
+
   # Handle debugfs
   mount fstype=debugfs -> /sys/kernel/debug/,
   deny /sys/kernel/debug/{,**} rwklx,
@@ -61,6 +65,10 @@ const profileBase = `
   mount fstype=efivarfs -> /sys/firmware/efi/efivars/,
   deny /sys/firmware/efi/efivars/{,**} rwklx,
 
+  # Handle tracefs
+  mount fstype=tracefs -> /sys/kernel/tracing/,
+  deny /sys/kernel/tracing/{,**} rwklx,
+
   # Handle fuse
   mount fstype=fuse,
   mount fstype=fuse.*,
diff --git a/lxd/instance/drivers/driver_lxc.go b/lxd/instance/drivers/driver_lxc.go
index a633044140..1d08e49f82 100644
--- a/lxd/instance/drivers/driver_lxc.go
+++ b/lxd/instance/drivers/driver_lxc.go
@@ -815,8 +815,11 @@ func (c *lxc) initLXC(config bool) error {
 		"/sys/firmware/efi/efivars",
 		"/sys/fs/fuse/connections",
 		"/sys/fs/pstore",
+		"/sys/kernel/config",
 		"/sys/kernel/debug",
-		"/sys/kernel/security"}
+		"/sys/kernel/security",
+		"/sys/kernel/tracing",
+	}
 
 	if c.IsPrivileged() && !c.state.OS.RunningInUserNS {
 		err = lxcSetConfigItem(cc, "lxc.mount.entry", "mqueue dev/mqueue mqueue rw,relatime,create=dir,optional 0 0")


More information about the lxc-devel mailing list