File tree 1 file changed +16
-0
lines changed
1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -85,6 +85,22 @@ impl Container {
85
85
}
86
86
} ) ;
87
87
88
+ // runc configures systemd to also perform device filtering.
89
+ // The removal of systemd's filtering is insufficient since after daemon-reload (or maybe
90
+ // some other triggers as well), systemd will reconcile and add it back, which disrupts
91
+ // container-hotplug's operation.
92
+ // So we'll also go ahead and remove these configuration files. Ignore errors if any since
93
+ // the cgroup might be handled by runc directly if `--cgroup-manager=cgroupfs` is used.
94
+ let cgroup_name = state
95
+ . cgroup_paths
96
+ . unified
97
+ . file_name ( )
98
+ . context ( "cgroup doesn't have file name" ) ?
99
+ . to_str ( )
100
+ . context ( "cgroup name is not UTF-8" ) ?;
101
+ let _ = std:: fs:: remove_file ( format ! ( "/run/systemd/transient/{cgroup_name}.d/50-DeviceAllow.conf" ) ) ;
102
+ let _ = std:: fs:: remove_file ( format ! ( "/run/systemd/transient/{cgroup_name}.d/50-DevicePolicy.conf" ) ) ;
103
+
88
104
let cgroup_device_filter: Box < dyn DeviceAccessController + Send > =
89
105
if let Some ( device_cgroup) = & state. cgroup_paths . devices {
90
106
Box :: new ( DeviceAccessControllerV1 :: new ( device_cgroup) ?)
You can’t perform that action at this time.
0 commit comments