trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jpe...@apache.org
Subject [1/2] trafficserver git commit: TS-3539: close excess files in crash log helper
Date Fri, 01 May 2015 16:14:22 GMT
Repository: trafficserver
Updated Branches:
  refs/heads/master 523b47493 -> 4a4507216


TS-3539: close excess files in crash log helper

The crash log helper is spawned from traffic_server, so we should
close all the open files before exec'ing so that we don't leak
listen sockets or other resources into the child process.


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/a5c26250
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/a5c26250
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/a5c26250

Branch: refs/heads/master
Commit: a5c26250fc085c430dda7d0bd125cd671547a16e
Parents: 523b474
Author: James Peach <jpeach@apache.org>
Authored: Tue Apr 28 15:54:51 2015 -0700
Committer: James Peach <jpeach@apache.org>
Committed: Fri May 1 09:07:18 2015 -0700

----------------------------------------------------------------------
 CHANGES        | 4 ++++
 proxy/Crash.cc | 8 ++++++++
 2 files changed, 12 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/a5c26250/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index d933cbb..be3ddcd 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,8 +1,12 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache Traffic Server 6.0.0
 
+  *) [TS-3539] Close excess file descriptors in crash log helper.
+
   *) [TS-3576] Remove the need for FIPS locking for OpenSSL
 
+  *) [TS-3538]: Perform server certificate validity check.
+
   *) [TS-3575] Fix connection leak.
 
   *) [TS-3538] Perform server certificate validity check.

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/a5c26250/proxy/Crash.cc
----------------------------------------------------------------------
diff --git a/proxy/Crash.cc b/proxy/Crash.cc
index dbfe8fc..0febbea 100644
--- a/proxy/Crash.cc
+++ b/proxy/Crash.cc
@@ -111,6 +111,14 @@ crash_logger_init()
     dup2(pipe[1], STDIN_FILENO);
     close(pipe[0]);
     close(pipe[1]);
+
+    // Starting after stderr, keep closing file descriptors until we run out.
+    for (int fd = STDERR_FILENO + 1; fd; ++fd) {
+      if (close(fd) == -1) {
+        break;
+      }
+    }
+
     ink_release_assert(execl(logger, basename, "--syslog", "--wait", "--host", TS_BUILD_CANONICAL_HOST,
NULL) != -1);
     return; // not reached.
   }


Mime
View raw message