Commit 0a089bf
committed
bfd: Use dynamic expansion to support large groups/users
When dumping a process with a massive number of supplementary groups,
the `Groups:` line in `/proc/<pid>/status` easily exceeds the hardcoded
`BUFSIZE` (4096 bytes). This causes `breadchr()` to abort with
"The bfd buffer is too small"
Instead of globally increasing `BUFSIZE`—which unnecessarily inflates
the memory footprint for all routine checkpoint operations—this patch
introduces a dynamic expansion mechanism
When `breadchr()` reaches the buffer limit, it dynamically maps an
independent, doubled VMA to handle the long text line (capped at 2MB
to prevent OOM). This oversized buffer is then safely unmapped during
`buf_put()` to avoid polluting the fixed-size zero-copy batched
memory pool
Fixes: #2898
Signed-off-by: dong sunchao <dongsunchao@gmail.com>1 parent cff99db commit 0a089bf
1 file changed
+82
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
| 29 | + | |
28 | 30 | | |
29 | 31 | | |
| 32 | + | |
30 | 33 | | |
31 | 34 | | |
32 | 35 | | |
| |||
61 | 64 | | |
62 | 65 | | |
63 | 66 | | |
| 67 | + | |
64 | 68 | | |
65 | 69 | | |
66 | 70 | | |
| |||
77 | 81 | | |
78 | 82 | | |
79 | 83 | | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
85 | 98 | | |
86 | 99 | | |
87 | 100 | | |
| |||
140 | 153 | | |
141 | 154 | | |
142 | 155 | | |
| 156 | + | |
| 157 | + | |
143 | 158 | | |
144 | 159 | | |
145 | 160 | | |
146 | 161 | | |
147 | | - | |
| 162 | + | |
148 | 163 | | |
149 | 164 | | |
150 | 165 | | |
| |||
175 | 190 | | |
176 | 191 | | |
177 | 192 | | |
| 193 | + | |
178 | 194 | | |
179 | 195 | | |
| 196 | + | |
180 | 197 | | |
| 198 | + | |
181 | 199 | | |
182 | 200 | | |
183 | 201 | | |
| |||
195 | 213 | | |
196 | 214 | | |
197 | 215 | | |
198 | | - | |
199 | | - | |
200 | | - | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
201 | 270 | | |
202 | 271 | | |
203 | 272 | | |
| |||
251 | 320 | | |
252 | 321 | | |
253 | 322 | | |
| 323 | + | |
| 324 | + | |
254 | 325 | | |
255 | | - | |
| 326 | + | |
256 | 327 | | |
257 | 328 | | |
258 | 329 | | |
259 | 330 | | |
260 | 331 | | |
261 | 332 | | |
262 | | - | |
| 333 | + | |
263 | 334 | | |
264 | 335 | | |
265 | 336 | | |
| |||
0 commit comments