lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 19 Mar 2012 13:28:43 -0700
From:	Vaibhav Nagarnaik <vnagarnaik@...gle.com>
To:	Steven Rostedt <rostedt@...dmis.org>
Cc:	Justin Teravest <teravest@...gle.com>,
	David Sharp <dhsharp@...gle.com>, linux-kernel@...r.kernel.org,
	Vaibhav Nagarnaik <vnagarnaik@...gle.com>
Subject: [PATCH 2/2] trace-cmd: Close the trace file descriptor

trace-cmd opens "trace_raw" file descriptor to splice data continuously
through it to the CPU files. This causes a lot of pages being allocated
for the splice interface in the kernel. After the recorder instance is
destroyed, it doesn't close the file descriptor causing many of the
pages to remain in the cache. This gives an invalid view of memory lying
around in cache.

In any case, it is a good practice for the applications to close all the
descriptors that are opened.

This patch closes the open file descriptor which is used in the splice()
call and updates the check for disk file descriptor when closing it.

Signed-off-by: Vaibhav Nagarnaik <vnagarnaik@...gle.com>
---
 trace-recorder.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/trace-recorder.c b/trace-recorder.c
index 4a01fb9..215affc 100644
--- a/trace-recorder.c
+++ b/trace-recorder.c
@@ -50,7 +50,10 @@ void tracecmd_free_recorder(struct tracecmd_recorder *recorder)
 	if (!recorder)
 		return;
 
-	if (recorder->fd)
+	if (recorder->trace_fd >= 0)
+		close(recorder->trace_fd);
+
+	if (recorder->fd >= 0)
 		close(recorder->fd);
 
 	free(recorder);
-- 
1.7.7.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ