Commit fd7b938
CRI tty:true containers run their workload through pty_server's raw fork, which
applied NONE of the A3S_SEC_* controls the exec path enforces: no capability
drop/keep-set, no seccomp filter, no_new_privs unset, no supplemental groups.
A pod that requested a securityContext (RuntimeDefault seccomp, dropped caps,
runAsNonRoot) but also set tty:true silently ran with FULL capabilities and no
syscall filter — kubelet believed the policy was in effect. Any tenant that
requested a TTY got an isolation bypass.
Parse the same A3S_SEC_* controls from the PtyRequest env (same KEY=VALUE format
the exec path consumes) and build the seccomp filter BEFORE the fork (building
allocates; the post-fork child stays async-signal-safe). In the child apply,
reusing the exact async-signal-safe namespace:: primitives the exec path uses:
supplemental groups + capabilities BEFORE the uid switch (they need
CAP_SETGID/CAP_SETPCAP), then no_new_privs and the prebuilt seccomp filter AFTER
it. The exec path is untouched.
Ordering note: the PTY child does its own setsid (controlling terminal) and
chroot/user.apply, so only the confinement sequence is shared — not the exec
path's setpgid/chroot, which would conflict with setsid.
KNOWN follow-up: tty containers still get NO cgroup (pty_server never calls
ContainerCgroup::create) so cpu/mem/pids limits remain unenforced for them; and
masked/readonly paths (parent-side fs ops) aren't applied here yet.
Co-authored-by: Roy Lin <roylin@a3s.box>
1 parent eae2da1 commit fd7b938
1 file changed
Lines changed: 119 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
164 | 164 | | |
165 | 165 | | |
166 | 166 | | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
167 | 236 | | |
168 | 237 | | |
169 | 238 | | |
| |||
219 | 288 | | |
220 | 289 | | |
221 | 290 | | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
222 | 322 | | |
223 | 323 | | |
224 | 324 | | |
225 | 325 | | |
226 | 326 | | |
227 | 327 | | |
228 | 328 | | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
229 | 348 | | |
230 | 349 | | |
231 | 350 | | |
| |||
0 commit comments