1 |
commit: b62f94ccfc0280f70856fe11a44f68008f5145c8 |
2 |
Author: Michael Mair-Keimberger <mmk <AT> levelnine <DOT> at> |
3 |
AuthorDate: Thu Mar 3 06:25:01 2022 +0000 |
4 |
Commit: Florian Schmaus <flow <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Mar 3 07:35:00 2022 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b62f94cc |
7 |
|
8 |
sys-process/below: remove unused patches |
9 |
|
10 |
Package-Manager: Portage-3.0.30, Repoman-3.0.3 |
11 |
Signed-off-by: Michael Mair-Keimberger <mmk <AT> levelnine.at> |
12 |
Closes: https://github.com/gentoo/gentoo/pull/24392 |
13 |
Signed-off-by: Florian Schmaus <flow <AT> gentoo.org> |
14 |
|
15 |
.../files/below-0.3.0-cgroup-parse-fixes-01.patch | 86 -------------------- |
16 |
.../files/below-0.3.0-cgroup-parse-fixes-02.patch | 92 ---------------------- |
17 |
2 files changed, 178 deletions(-) |
18 |
|
19 |
diff --git a/sys-process/below/files/below-0.3.0-cgroup-parse-fixes-01.patch b/sys-process/below/files/below-0.3.0-cgroup-parse-fixes-01.patch |
20 |
deleted file mode 100644 |
21 |
index 0a30a2df7152..000000000000 |
22 |
--- a/sys-process/below/files/below-0.3.0-cgroup-parse-fixes-01.patch |
23 |
+++ /dev/null |
24 |
@@ -1,86 +0,0 @@ |
25 |
-From c3af8c1f8b0da050a7c4c8fb5083ff44885fa959 Mon Sep 17 00:00:00 2001 |
26 |
-From: Brian Chen <brianc118@××.com> |
27 |
-Date: Mon, 23 Aug 2021 11:45:01 -0700 |
28 |
-Subject: [PATCH] Fix procfs when reading cgroup membership (#8106) |
29 |
- |
30 |
-Summary: |
31 |
-When reading cgroup membership, we currently assume that the cgroup v2 |
32 |
-line will be first in /proc/[pid]/cgroup. This is not necessarily the |
33 |
-case. Instead let's take the first line that starts with "0::". |
34 |
- |
35 |
-Tested on ubuntu where |
36 |
- |
37 |
-``` |
38 |
-$ cat /proc/1/cgroup |
39 |
-12:blkio:/init.scope |
40 |
-11:pids:/init.scope |
41 |
-8:memory:/init.scope |
42 |
-7:freezer:/ |
43 |
-4:devices:/init.scope |
44 |
-2:cpu,cpuacct:/init.scope |
45 |
-1:name=systemd:/init.scope |
46 |
-0::/init.scope |
47 |
-``` |
48 |
- |
49 |
-This should fix https://github.com/facebookincubator/below/issues/8105. |
50 |
- |
51 |
-Pull Request resolved: https://github.com/facebookincubator/below/pull/8106 |
52 |
- |
53 |
-Test Plan: Existing procfs tests should pass |
54 |
- |
55 |
-Reviewed By: lnyng |
56 |
- |
57 |
-Differential Revision: D30476031 |
58 |
- |
59 |
-Pulled By: brianc118 |
60 |
- |
61 |
-fbshipit-source-id: e0352fb039bebf44a0d5584120ea0a0a82c0cd01 |
62 |
---- |
63 |
- below/procfs/src/lib.rs | 33 ++++++++++++++++++--------------- |
64 |
- 1 file changed, 18 insertions(+), 15 deletions(-) |
65 |
- |
66 |
---- a/below/procfs/src/lib.rs |
67 |
-+++ b/below/procfs/src/lib.rs |
68 |
-@@ -556,24 +556,27 @@ impl ProcReader { |
69 |
- let path = path.as_ref().join("cgroup"); |
70 |
- let file = File::open(&path).map_err(|e| Error::IoError(path.clone(), e))?; |
71 |
- let buf_reader = BufReader::new(file); |
72 |
-- let pid_line = buf_reader.lines().next().map_or_else( |
73 |
-- || Err(Error::InvalidFileFormat(path.clone())), |
74 |
-- |line| line.map_err(|e| Error::IoError(path.clone(), e)), |
75 |
-- )?; |
76 |
-- |
77 |
-- // cgroup V2 |
78 |
-- if pid_line.len() > 3 && pid_line.starts_with("0::") { |
79 |
-- return Ok(pid_line[3..].to_string()); |
80 |
-- } |
81 |
- |
82 |
-- // legacy cgroup will have multiple lines with the first line of [0-9]+:pids:PATH |
83 |
-- if let Some(pid_idx) = pid_line.find(":pids:") { |
84 |
-- if pid_idx + 6 < pid_line.len() { |
85 |
-- return Ok(pid_line[pid_idx + 6..].to_string()); |
86 |
-+ let mut cgroup_path = None; |
87 |
-+ for line in buf_reader.lines() { |
88 |
-+ let line = line.map_err(|e| Error::IoError(path.clone(), e))?; |
89 |
-+ // Lines contain three colon separated fields: |
90 |
-+ // hierarchy-ID:controller-list:cgroup-path |
91 |
-+ // A line starting with "0::" would be an entry for cgroup v2. |
92 |
-+ // Otherwise, the line containing "pids" controller is what we want |
93 |
-+ // for cgroup v1. |
94 |
-+ let parts: Vec<_> = line.split(':').collect(); |
95 |
-+ if parts.len() == 3 { |
96 |
-+ if parts[0] == "0" && parts[1] == "" { |
97 |
-+ cgroup_path = Some(parts[2].to_owned()); |
98 |
-+ // cgroup v2 takes precedence |
99 |
-+ break; |
100 |
-+ } else if parts[1].split(',').any(|c| c == "pids") { |
101 |
-+ cgroup_path = Some(parts[2].to_owned()); |
102 |
-+ } |
103 |
- } |
104 |
- } |
105 |
-- |
106 |
-- Err(Error::InvalidFileFormat(path)) |
107 |
-+ cgroup_path.ok_or_else(|| Error::InvalidFileFormat(path)) |
108 |
- } |
109 |
- |
110 |
- pub fn read_pid_cgroup(&self, pid: u32) -> Result<String> { |
111 |
|
112 |
diff --git a/sys-process/below/files/below-0.3.0-cgroup-parse-fixes-02.patch b/sys-process/below/files/below-0.3.0-cgroup-parse-fixes-02.patch |
113 |
deleted file mode 100644 |
114 |
index f8c15b6d49e7..000000000000 |
115 |
--- a/sys-process/below/files/below-0.3.0-cgroup-parse-fixes-02.patch |
116 |
+++ /dev/null |
117 |
@@ -1,92 +0,0 @@ |
118 |
-From 80fb95e06ddc5f311e0c9dc20b19d00058ca39af Mon Sep 17 00:00:00 2001 |
119 |
-From: Brian Chen <brianc118@××.com> |
120 |
-Date: Tue, 31 Aug 2021 14:59:57 -0700 |
121 |
-Subject: [PATCH] Fix procfs reading cgroups with colon in name |
122 |
- |
123 |
-Summary: |
124 |
-When reading cgroup membership, we split by ':' and expect there to |
125 |
-be 3 parts. This is not always the case since cgroup name can |
126 |
-contain ':'. |
127 |
- |
128 |
-Reviewed By: lnyng |
129 |
- |
130 |
-Differential Revision: D30681159 |
131 |
- |
132 |
-fbshipit-source-id: 895e1b26965ae33454a19c2ec1bc5478a5f95635 |
133 |
---- |
134 |
- below/procfs/src/lib.rs | 2 +- |
135 |
- below/procfs/src/test.rs | 34 ++++++++++++++++++++++++++++++---- |
136 |
- 2 files changed, 31 insertions(+), 5 deletions(-) |
137 |
- |
138 |
---- a/below/procfs/src/lib.rs |
139 |
-+++ b/below/procfs/src/lib.rs |
140 |
-@@ -565,7 +565,7 @@ impl ProcReader { |
141 |
- // A line starting with "0::" would be an entry for cgroup v2. |
142 |
- // Otherwise, the line containing "pids" controller is what we want |
143 |
- // for cgroup v1. |
144 |
-- let parts: Vec<_> = line.split(':').collect(); |
145 |
-+ let parts: Vec<_> = line.splitn(3, ':').collect(); |
146 |
- if parts.len() == 3 { |
147 |
- if parts[0] == "0" && parts[1] == "" { |
148 |
- cgroup_path = Some(parts[2].to_owned()); |
149 |
---- a/below/procfs/src/test.rs |
150 |
-+++ b/below/procfs/src/test.rs |
151 |
-@@ -804,7 +804,7 @@ cancelled_write_bytes: 5431947264 |
152 |
- |
153 |
- #[test] |
154 |
- fn test_pid_cgroupv2() { |
155 |
-- let cgroup = b"0::/user.slice/user-119756.slice/session-3.scope |
156 |
-+ let cgroup = b"0::/user.slice/user:with:colon.slice/session-3.scope |
157 |
- "; |
158 |
- |
159 |
- let procfs = TestProcfs::new(); |
160 |
-@@ -814,12 +814,12 @@ fn test_pid_cgroupv2() { |
161 |
- .read_pid_cgroup(1024) |
162 |
- .expect("Failed to read pid cgroup file"); |
163 |
- |
164 |
-- assert_eq!(cgroup, "/user.slice/user-119756.slice/session-3.scope"); |
165 |
-+ assert_eq!(cgroup, "/user.slice/user:with:colon.slice/session-3.scope"); |
166 |
- } |
167 |
- |
168 |
- #[test] |
169 |
- fn test_pid_cgroupv1() { |
170 |
-- let cgroup = b"11:pids:/init.scope |
171 |
-+ let cgroup = b"11:pids:/cgroup-path:colon |
172 |
- 10:perf_event:/ |
173 |
- 9:hugetlb:/ |
174 |
- 8:cpu,cpuacct:/init.scope |
175 |
-@@ -838,7 +838,33 @@ fn test_pid_cgroupv1() { |
176 |
- .read_pid_cgroup(1024) |
177 |
- .expect("Failed to read pid cgroup file"); |
178 |
- |
179 |
-- assert_eq!(cgroup, "/init.scope"); |
180 |
-+ assert_eq!(cgroup, "/cgroup-path:colon"); |
181 |
-+} |
182 |
-+ |
183 |
-+#[test] |
184 |
-+fn test_pid_cgroupv1and2() { |
185 |
-+ let cgroup = b"11:pids:/cgroup-path:colon |
186 |
-+10:perf_event:/ |
187 |
-+9:hugetlb:/ |
188 |
-+8:cpu,cpuacct:/init.scope |
189 |
-+7:blkio:/init.scope |
190 |
-+6:freezer:/ |
191 |
-+5:cpuset:/ |
192 |
-+4:memory:/init.scope |
193 |
-+3:devices:/init.scope |
194 |
-+2:net_cls,net_prio:/ |
195 |
-+1:name=systemd:/init.scope |
196 |
-+0::/user.slice/user:with:colon.slice/session-3.scope"; |
197 |
-+ |
198 |
-+ let procfs = TestProcfs::new(); |
199 |
-+ procfs.create_pid_file_with_content(1024, "cgroup", cgroup); |
200 |
-+ let reader = procfs.get_reader(); |
201 |
-+ let cgroup = reader |
202 |
-+ .read_pid_cgroup(1024) |
203 |
-+ .expect("Failed to read pid cgroup file"); |
204 |
-+ |
205 |
-+ // When we see both cgroup v1 and v2, v2 takes precedence |
206 |
-+ assert_eq!(cgroup, "/user.slice/user:with:colon.slice/session-3.scope"); |
207 |
- } |
208 |
- |
209 |
- #[test] |