Files
ARTEX/server
Adrian Martinez Garcia b6748f8ec0 fix(server): lock OS thread and set PR_SET_NO_NEW_PRIVS in shims before exec
PR_SET_NO_NEW_PRIVS is per thread. PrepareExecPrivilege set it on a server thread that never execs, so the flag was not inherited by agent processes. The shims set it in enterExecutor, but runBashShim and runDropShim did not lock their goroutine, so it could migrate between prctl and exec.

Move the prctl out of PrepareExecPrivilege. Lock the thread at the top of runBashShim and runDropShim; the lock is never released because exec replaces the process.

Replace the test with a deterministic one: the drop shim runs as root with GOMAXPROCS=1, and a wrapped setNoNewPrivsFn forces the goroutine off its thread. Without the lock the exec'd program reports NoNewPrivs 0; with it, 1.
2026-11-23 22:28:50 +00:00
..
2026-07-26 04:27:45 -04:00
2026-07-26 04:27:45 -04:00
2026-08-24 14:14:15 +08:00
2026-08-25 12:05:26 +08:00