Files
gvisor/test/root
Ayush Ranjan 039acda6e4 Preserve sandbox process env vars only for --TESTONLY-unsafe-nonroot.
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
2023-05-18 10:24:09 -07:00
..
2023-03-30 14:16:19 -07:00
2021-12-23 13:03:58 -08:00
2022-05-17 17:48:35 -07:00