Repository navigation
Commit b8805df
committed
libtcb: tolerate setgroups EPERM in unprivileged user namespaces
In a user namespace where /proc/self/setgroups is "deny",
setgroups(2) is permanently rejected by the kernel. Perform the
regular privilege drop and only tolerate sys_setgroups(0, NULL)
failing with EPERM in such a namespace; in that case the kernel
guarantees no supplementary group could have been gained via the
namespace, so leaving the list in place is safe. Record this
with a new PRIV_MAGIC_NOSETGROUPS state so that tcb_gain_priv_r()
skips the matching setgroups() call.
Fixes failures of pam_tcb, libnss_tcb, tcb_unconvert and shadow's
shadowtcb_drop_priv() when running under rootless container.1 parent f00de37 commit b8805df
2 files changed
Lines changed: 42 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
3 | 21 | | |
4 | 22 | | |
5 | 23 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
196 | 196 | | |
197 | 197 | | |
198 | 198 | | |
| 199 | + | |
199 | 200 | | |
200 | 201 | | |
201 | 202 | | |
202 | 203 | | |
| 204 | + | |
203 | 205 | | |
204 | 206 | | |
205 | 207 | | |
| |||
234 | 236 | | |
235 | 237 | | |
236 | 238 | | |
237 | | - | |
238 | | - | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
239 | 257 | | |
240 | 258 | | |
241 | 259 | | |
242 | 260 | | |
243 | 261 | | |
244 | | - | |
| 262 | + | |
245 | 263 | | |
246 | 264 | | |
247 | 265 | | |
| |||
253 | 271 | | |
254 | 272 | | |
255 | 273 | | |
| 274 | + | |
256 | 275 | | |
257 | 276 | | |
258 | 277 | | |
| |||
264 | 283 | | |
265 | 284 | | |
266 | 285 | | |
267 | | - | |
| 286 | + | |
| 287 | + | |
268 | 288 | | |
269 | 289 | | |
270 | 290 | | |
| |||
0 commit comments