All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paul Moore <paul.moore@hp.com>
To: Stephen Smalley <sds@tycho.nsa.gov>
Cc: selinux@tycho.nsa.gov
Subject: Re: [RFC PATCH] SELinux: Cleanup the secid/secctx conversion functions
Date: Fri, 29 Feb 2008 09:23:59 -0500	[thread overview]
Message-ID: <200802290924.00392.paul.moore@hp.com> (raw)
In-Reply-To: <1204294426.31790.256.camel@moss-spartans.epoch.ncsc.mil>

On Friday 29 February 2008 9:13:46 am Stephen Smalley wrote:
> On Fri, 2008-02-29 at 08:54 -0500, Stephen Smalley wrote:
> > On Thu, 2008-02-28 at 16:41 -0500, Paul Moore wrote:
> > > While looking at the SELinux secid/secctx conversion functions I
> > > realized they could probably do with a little cleanup to reduce the
> > > amount of code and make better use of existing string processing
> > > functions in the kernel.  Making use of the kernel's existing string
> > > processing functions is a good idea as many architectures have
> > > specialized/optimized routines which should be an improvement over the
> > > generic code in the SELinux security server. ---
> > >
> > >  security/selinux/ss/mls.c      |   61 +++++--------
> > >  security/selinux/ss/mls.h      |    3 -
> > >  security/selinux/ss/services.c |  194
> > > ++++++++++++++++------------------------ 3 files changed, 103
> > > insertions(+), 155 deletions(-)
> >
> > The snippet below looks like a step backward rather than an improvement
> > - single sprintf replaced by series of strcat calls.  That can't be more
> > efficient.
>
> Hmm...well, maybe I'm wrong (after looking at the implementations).

That is exactly why I decided the multiple strcpy()/strcat() calls would be 
faster.  Our formatting needs here are pretty simple and the kernel's 
sprintf() implementation looks very involved versus strcpy()/strcat().

> Pity that Linux doesn't have stpcpy (as in glibc) - that is much nicer
> than a series of strcat's since it returns the end pointer and doesn't
> require finding the end of string each time.

That would be nice here.  However, I think at least moving away from sprintf() 
should yield an advantage.

-- 
paul moore
linux security @ hp

--
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:[~2008-02-29 14:23 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-28 21:41 [RFC PATCH] SELinux: Cleanup the secid/secctx conversion functions Paul Moore
2008-02-29  9:49 ` James Morris
2008-02-29 13:27   ` Paul Moore
2008-02-29 13:54 ` Stephen Smalley
2008-02-29 14:13   ` Stephen Smalley
2008-02-29 14:23     ` Paul Moore [this message]
2008-02-29 16:40     ` James Antill
2008-02-29 17:03       ` Paul Moore
2008-02-29 18:41         ` Todd Miller
2008-02-29 18:58           ` Paul Moore

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=200802290924.00392.paul.moore@hp.com \
    --to=paul.moore@hp.com \
    --cc=sds@tycho.nsa.gov \
    --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.