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: [PATCH 1/3] SELinux: Cleanup the secid/secctx conversion functions
Date: Tue, 8 Apr 2008 17:13:08 -0400	[thread overview]
Message-ID: <200804081713.08660.paul.moore@hp.com> (raw)
In-Reply-To: <1207665824.21223.311.camel@moss-spartans.epoch.ncsc.mil>

On Tuesday 08 April 2008 10:43:44 am Stephen Smalley wrote:
> On Mon, 2008-04-07 at 19:11 -0400, Paul Moore wrote:
> > @@ -709,73 +697,46 @@ static int security_context_to_sid_core(char
> > *scontext, u32 scontext_len, u32 *s null suffix to the copy to
> > avoid problems with the existing attr package, which doesn't view
> > the null terminator as part of the attribute value. */
> > -	scontext2 = kmalloc(scontext_len+1,GFP_KERNEL);
> > -	if (!scontext2) {
> > -		rc = -ENOMEM;
> > -		goto out;
> > -	}
> > -	memcpy(scontext2, scontext, scontext_len);
> > -	scontext2[scontext_len] = 0;
> > +	scontext_dup = kmemdup(scontext, scontext_len + 1, GFP_KERNEL);
>
> Also, in addition to the gfp_flags change, I'm not clear that the
> above change is correct.  We are taking a byte array "scontext" of
> length "scontext_len" and copying it into a buffer of length
> "scontext_len+1" so that we can ensure that it is NUL terminated
> prior to parsing.  Won't kmemdup with scontext_len+1 ultimately run
> off the end of the original string?

Good point, I believe you're right.  I'll add this and the gfp stuff to 
the list of needed changes.

I think I may also suggest shelving this patch for 2.6.26 as a little 
birdie mentioned it would be a good idea to give this a through testing 
on non-MLS/MCS systems which I haven't yet done and don't expect to be 
able to do so before the merge window opens.

I haven't seen any objections to the other two patches, so I'll 
re-submit those for 2.6.27 and leave the secid/secctx cleanup for the 
next time around.

Thanks for the review.

-- 
paul moore
linux @ 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-04-08 21:13 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-07 23:10 [PATCH 0/3] Some SELinux patches for 2.6.26 Paul Moore
2008-04-07 23:11 ` [PATCH 1/3] SELinux: Cleanup the secid/secctx conversion functions Paul Moore
2008-04-08 14:38   ` Stephen Smalley
2008-04-08 14:43   ` Stephen Smalley
2008-04-08 21:13     ` Paul Moore [this message]
2008-04-09 17:27       ` Stephen Smalley
2008-04-07 23:11 ` [PATCH 2/3] SELinux: Made netnode cache adds faster Paul Moore
2008-04-09 17:08   ` Stephen Smalley
2008-04-09 17:41     ` Paul Moore
2008-04-10 12:29       ` Stephen Smalley
2008-04-10 13:46         ` Paul Moore
2008-04-07 23:11 ` [PATCH 3/3] SELinux: Add network port SID cache Paul Moore
2008-04-09 17:15   ` Stephen Smalley
2008-04-09 17:37     ` Paul Moore
2008-04-09 18:08       ` Stephen Smalley

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=200804081713.08660.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.