From 851b47bd7de35f4464a67c991d55cbcb07230edc Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 10 Dec 2014 18:01:01 +0100 Subject: [PATCH] Don't do vfork in conjunction with setuid --- src/libstore/build.cc | 2 ++ src/libutil/util.cc | 3 +++ 2 files changed, 5 insertions(+) diff --git a/src/libstore/build.cc b/src/libstore/build.cc index ab8923bbd..36436d7eb 100644 --- a/src/libstore/build.cc +++ b/src/libstore/build.cc @@ -1914,6 +1914,8 @@ void DerivationGoal::startBuilder() builderOut.create(); /* Fork a child to build the package. */ + ProcessOptions options; + options.allowVfork = !buildUser.enabled(); pid = startProcess([&]() { runChild(); }); diff --git a/src/libutil/util.cc b/src/libutil/util.cc index bdd114c5e..5895e7200 100644 --- a/src/libutil/util.cc +++ b/src/libutil/util.cc @@ -825,6 +825,9 @@ void killUser(uid_t uid) users to which the current process can send signals. So we fork a process, switch to uid, and send a mass kill. */ + ProcessOptions options; + options.allowVfork = false; + Pid pid = startProcess([&]() { if (setuid(uid) == -1)