mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
039acda6e4
Earlier setCapsAndCallSelf() and callSelfAsNobody() were unconditionally clearing the sandbox process's env vars. But in some cases we want to preserve it. For example, when running runsc-race, we want to set GLIBC_TUNABLES for the sandbox process. Note that runsc-race requires --TESTONLY-unsafe-nonroot=true. Right now, when --TESTONLY-unsafe-nonroot is set, boot process does not end up calling setCapsAndCallSelf() or callSelfAsNobody(). So the env vars are retained as desired. But with directfs, those methods are called in spite of --TESTONLY-unsafe-nonroot. So this change is required to preserve env vars with --directfs && --TESTONLY-unsafe-nonroot. This change also adds a test to verify that the sandbox process is running with no leaked environment variables. PiperOrigin-RevId: 533170470