diff --git a/sandboxed_api/sandbox2/forkserver.cc b/sandboxed_api/sandbox2/forkserver.cc index 1ad8f95..085f0b6 100644 --- a/sandboxed_api/sandbox2/forkserver.cc +++ b/sandboxed_api/sandbox2/forkserver.cc @@ -158,6 +158,7 @@ static void RunInitProcess(int signaling_fd, std::set open_fds) { } else if (child > 0) { // Perform some sanitization (basically equals to SanitizeEnvironment // except that it does not require /proc to be available). + SAPI_RAW_CHECK(chdir("/") == 0, "changing init cwd failed"); setsid(); if (prctl(PR_SET_PDEATHSIG, SIGKILL, 0, 0, 0) != 0) { SAPI_RAW_PLOG(ERROR, "prctl(PR_SET_PDEATHSIG, SIGKILL) failed");