From 17986f29594a8fa22aaaedeafda239f5277fe43a Mon Sep 17 00:00:00 2001 From: "Frank Ch. Eigler" Date: Thu, 11 Oct 2012 23:31:28 -0400 Subject: [PATCH] PR14245 stapio should not pass inherited relay_basedir_fd jistone reported that new fd passing should be suppressed for stapio-spawned child processes like target_cmd or function::system(). * staprun/stapio.c (main): Set CLOEXEC on relay_basedir_fd (if any). --- staprun/stapio.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/staprun/stapio.c b/staprun/stapio.c index 63556e439..e8daf0e3d 100644 --- a/staprun/stapio.c +++ b/staprun/stapio.c @@ -15,7 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . * - * Copyright (C) 2005-2007 Red Hat, Inc. + * Copyright (C) 2005-2012 Red Hat, Inc. * */ @@ -33,6 +33,15 @@ int main(int argc, char **argv) setup_signals(); parse_args(argc, argv); + /* If we inherited a relay_basedir_fd, we want to keep it to ourselves - + i.e., FD_CLOEXEC the bad boy. */ + if (relay_basedir_fd >= 0) { + int rc = set_clexec(relay_basedir_fd); + if (rc) + exit(-1); + } + + if (buffer_size) dbug(1, "Using a buffer of %u MB.\n", buffer_size); -- 2.43.5