All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Smalley <sds@tycho.nsa.gov>
To: Steve G <linux_4ever@yahoo.com>
Cc: selinux@tycho.nsa.gov, James Athey <jathey@tresys.com>,
	Joshua Brindle <jbrindle@tresys.com>,
	Karl MacMillan <kmacmillan@mentalrootkit.com>
Subject: Re: restorecond matchpathcon patch
Date: Tue, 20 Feb 2007 11:59:22 -0500	[thread overview]
Message-ID: <1171990762.14363.141.camel@moss-spartans.epoch.ncsc.mil> (raw)
In-Reply-To: <20070220165727.62975.qmail@web51509.mail.yahoo.com>

On Tue, 2007-02-20 at 08:57 -0800, Steve G wrote:
> >> IOW, this patch cleans up one problem, but I wonder if the underlying
> >> algorithm should be changed to be less of a memory hog.
> >
> >Possibly the FCGlob work will help address that problem.
> 
> Is that restorecond work or libselinux work? The change in algorithm I was
> thinking about was in restorecond. IOW, it could cache the correct context for
> the handful of files it cares about and use matchpathcon only for the paths that
> contain metacharacters. It could monitor for policy reloads and correct its cache
> in that event. For what its doing, it consumes a lot of memory as is.

libselinux work - replacing the use of pathname regexes in the file
contexts configuration with a simpler globbing syntax.  It doesn't
matter how many times restorecond calls matchpathcon (and restorecond is
just passing full pathnames to it, which matchpathcon then matches
against the table of pathname regexes to find the right context); the
issue is the memory consumed by the precompiled regexes loaded from the
file contexts configuration on the very first matchpathcon call.

> >Calling matchpathcon_fini each time will require re-creation of the
> >entire in-memory table from the file contexts configuration on each
> >matchpathcon call, so you are trading off runtime performance for memory
> >here.
> 
> If you want to leave it alone, we should have something like this added to
> restorecond.c:
> 
> @@ -483,6 +483,7 @@ int main(int argc, char **argv)
> 
>         watch_list_free(master_fd);
>         close(master_fd);
> +       matchpathcon_fini();
>         if (pidfile)
>                 unlink(pidfile);
> 
> so that valgrind can spot real memory leaks. Besides matchpathcon, valgrind is
> reporting other memory issues.

Yes, that would be fine.

-- 
Stephen Smalley
National Security Agency


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.

  reply	other threads:[~2007-02-20 16:59 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-20 15:33 restorecond matchpathcon patch Steve G
2007-02-20 16:02 ` Stephen Smalley
2007-02-20 16:57   ` Steve G
2007-02-20 16:59     ` Stephen Smalley [this message]
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=1171990762.14363.141.camel@moss-spartans.epoch.ncsc.mil \
    --to=sds@tycho.nsa.gov \
    --cc=jathey@tresys.com \
    --cc=jbrindle@tresys.com \
    --cc=kmacmillan@mentalrootkit.com \
    --cc=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.