runc/patch/0011-runc-do-not-setup-sysctl-in-runc-when-userns-enable.patch

34 lines
1.2 KiB
Diff
Raw Normal View History

2023-07-26 17:09:55 +08:00
From 8094649c861a0b6ca408caa38611f3e235378206 Mon Sep 17 00:00:00 2001
2023-01-05 17:11:59 +08:00
From: zhongjiawei <zhongjiawei1@huawei.com>
2023-07-26 17:09:55 +08:00
Date: Mon, 24 Jul 2023 19:25:06 +0800
2022-10-26 16:13:47 +08:00
Subject: [PATCH] runc:do not setup sysctl in runc when userns enable
---
2023-01-05 17:11:59 +08:00
libcontainer/standard_init_linux.go | 10 ++++++----
2022-10-26 16:13:47 +08:00
1 file changed, 6 insertions(+), 4 deletions(-)
2023-01-05 17:11:59 +08:00
diff --git a/libcontainer/standard_init_linux.go b/libcontainer/standard_init_linux.go
2023-07-26 17:09:55 +08:00
index 84883c2..542edba 100644
2023-01-05 17:11:59 +08:00
--- a/libcontainer/standard_init_linux.go
+++ b/libcontainer/standard_init_linux.go
2022-10-26 16:13:47 +08:00
@@ -130,10 +130,12 @@ func (l *linuxStandardInit) Init() error {
if err := apparmor.ApplyProfile(l.config.AppArmorProfile); err != nil {
return fmt.Errorf("unable to apply apparmor profile: %w", err)
}
-
- for key, value := range l.config.Config.Sysctl {
- if err := writeSystemProperty(key, value); err != nil {
- return err
+ // when userns enabled, write to sysctl will fail, let docker-hooks do this job
+ if len(l.config.Config.UidMappings) == 0 && len(l.config.Config.GidMappings) == 0 {
+ for key, value := range l.config.Config.Sysctl {
+ if err := writeSystemProperty(key, value); err != nil {
+ return err
+ }
}
}
for _, path := range l.config.Config.ReadonlyPaths {
--
2023-07-26 17:09:55 +08:00
2.33.0
2022-10-26 16:13:47 +08:00