All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steve G <linux_4ever@yahoo.com>
To: selinux@tycho.nsa.gov
Subject: restorecond matchpathcon patch
Date: Tue, 20 Feb 2007 07:33:53 -0800 (PST)	[thread overview]
Message-ID: <691709.57722.qm@web51508.mail.yahoo.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 910 bytes --]

Hi,

I was investigating why restorecond consumes so much memory and noticed that
valgrind is reporting about 18mb of reachable memory at exit. It seems that
matchpathcon sits on a lot of memory that may or may not help restorcond. This
patch causes matchpathcon to free its memory after we get its results. 

This helps cleanup valgrind output so that leaks are confined to utmpter and
another list. But I have to wonder if the strategy of allocating memory for each
file in a directory is a good thing or if we can just depend on partial path
matching to decide if we should care about the file. 

IOW, this patch cleans up one problem, but I wonder if the underlying algorithm
should be changed to be les of a memory hog.

-Steve


 
____________________________________________________________________________________
TV dinner still cooling? 
Check out "Tonight's Picks" on Yahoo! TV.
http://tv.yahoo.com/

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 1515479032-policycoreutils-2.0.1-restorecond-leak.patch --]
[-- Type: text/x-patch; name="policycoreutils-2.0.1-restorecond-leak.patch", Size: 635 bytes --]

diff -urp policycoreutils-2.0.1.orig/restorecond/restorecond.c policycoreutils-2.0.1/restorecond/restorecond.c
--- policycoreutils-2.0.1.orig/restorecond/restorecond.c	2007-02-19 21:25:54.000000000 -0500
+++ policycoreutils-2.0.1/restorecond/restorecond.c	2007-02-19 21:28:09.000000000 -0500
@@ -188,7 +188,9 @@ static void restore(const char *filename
 		return;
 	}
 
-	if (matchpathcon(filename, st.st_mode, &scontext) < 0) {
+	retcontext = matchpathcon(filename, st.st_mode, &scontext);
+	matchpathcon_fini();
+	if (retcontext < 0) {
 		if (errno == ENOENT)
 			return;
 		syslog(LOG_ERR, "matchpathcon(%s) failed %s\n", filename,

             reply	other threads:[~2007-02-20 15:32 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-20 15:33 Steve G [this message]
2007-02-20 16:02 ` restorecond matchpathcon patch Stephen Smalley
2007-02-20 16:57   ` Steve G
2007-02-20 16:59     ` Stephen Smalley
2007-02-20 18:13       ` James Athey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=691709.57722.qm@web51508.mail.yahoo.com \
    --to=linux_4ever@yahoo.com \
    --cc=selinux@tycho.nsa.gov \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.