From 13b089c890bac229e7c3accfd9299f3fdac95e27 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 17 Oct 2005 17:43:21 +0000 Subject: * Also kill all processes of the build user after the build. This is critical to prevent certain kinds of 0wnage. --- src/libstore/build.cc | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src') diff --git a/src/libstore/build.cc b/src/libstore/build.cc index f0b136d06132..8da1e9946fd7 100644 --- a/src/libstore/build.cc +++ b/src/libstore/build.cc @@ -676,6 +676,14 @@ void DerivationGoal::buildDone() /* So the child is gone now. */ worker.childTerminated(savedPid); + /* When running under a build user, make sure that all processes + running under that uid are gone. This is to prevent a + malicious user from leaving behind a process that keeps files + open and modifies them after they have been chown'ed to + root. */ + if (buildUser != 0) + killUser(buildUser); + /* Close the read side of the logger pipe. */ logPipe.readSide.close(); -- cgit 1.4.1