Skip to content

Commit 54c829f

Browse files
authored
Merge pull request #745 from bcressey/docker-29-selinux-fix
docker-engine-29: set label for containerd overlayfs mounts
2 parents 644820a + b1a1059 commit 54c829f

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
From 3c241eeee132271e665bb29f2d1cb480a308c921 Mon Sep 17 00:00:00 2001
2+
From: Ben Cressey <[email protected]>
3+
Date: Thu, 13 Nov 2025 03:43:25 +0000
4+
Subject: [PATCH] Set label for containerd overlayfs mounts
5+
6+
---
7+
daemon/containerd/image_snapshot.go | 11 +++++++++--
8+
1 file changed, 9 insertions(+), 2 deletions(-)
9+
10+
diff --git a/daemon/containerd/image_snapshot.go b/daemon/containerd/image_snapshot.go
11+
index 3c61d98..f8154a1 100644
12+
--- a/daemon/containerd/image_snapshot.go
13+
+++ b/daemon/containerd/image_snapshot.go
14+
@@ -151,13 +151,20 @@ func (l *rwLayer) mounts(ctx context.Context) ([]mount.Mount, error) {
15+
func (l *rwLayer) Mount(mountLabel string) (string, error) {
16+
ctx := context.TODO()
17+
18+
- // TODO: Investigate how we can handle mountLabel
19+
- _ = mountLabel
20+
mounts, err := l.mounts(ctx)
21+
if err != nil {
22+
return "", err
23+
}
24+
25+
+ // Apply SELinux mount label to overlay mounts (rootfs) only
26+
+ if mountLabel != "" {
27+
+ for i := range mounts {
28+
+ if mounts[i].Type == "overlay" {
29+
+ mounts[i].Options = append(mounts[i].Options, "context=\""+mountLabel+"\"")
30+
+ }
31+
+ }
32+
+ }
33+
+
34+
var root string
35+
if root, err = l.refCountMounter.Mount(mounts, l.id); err != nil {
36+
return "", fmt.Errorf("failed to mount %s: %w", root, err)
37+
--
38+
2.51.0
39+

packages/docker-engine-29/docker-engine-29.spec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ Source1000: clarify.toml
3434
Patch0001: 0001-Change-default-capabilities-using-daemon-config.patch
3535
Patch0002: 0002-oci-inject-kmod-in-all-containers.patch
3636
Patch0003: 0003-Switch-containerd-image-backend-s-image-pull-to-tran.patch
37+
Patch0004: 0004-Set-label-for-containerd-overlayfs-mounts.patch
3738

3839
BuildRequires: git
3940
BuildRequires: %{_cross_os}glibc-devel

0 commit comments

Comments
 (0)