From: Eric Paris <eparis@parisplace.org>
To: Stephen Smalley <sds@tycho.nsa.gov>
Cc: "Christopher J. PeBenito" <cpebenito@tresys.com>,
selinux@tycho.nsa.gov, Eamon Walsh <ewalsh@tycho.nsa.gov>,
James Morris <jmorris@namei.org>,
Chad Sellers <csellers@tresys.com>
Subject: Re: Expunging userspace classes and permissions from kernel headers
Date: Fri, 23 Mar 2007 14:41:05 -0400 [thread overview]
Message-ID: <1174675265.10788.72.camel@localhost.localdomain> (raw)
In-Reply-To: <1174667120.31436.232.camel@moss-spartans.epoch.ncsc.mil>
On Fri, 2007-03-23 at 12:25 -0400, Stephen Smalley wrote:
> On Fri, 2007-03-23 at 16:09 +0000, Christopher J. PeBenito wrote:
> > I reverted the comment change and changed "null" to NULL. Is this what
> > you had in mind (it doesn't have the PAX change yet)?
>
> Yes, looks sane. We would then apply that diff (re-based to the kernel
> tree) along with a patch like the following untested one (added a guard
> to both avc_dump_query and validate_classes despite my earlier comment).
> Look reasonable to others?
>
> diff --git a/security/selinux/avc.c b/security/selinux/avc.c
> index da8caf1..b25cf18 100644
> --- a/security/selinux/avc.c
> +++ b/security/selinux/avc.c
> @@ -217,7 +217,9 @@ static void avc_dump_query(struct audit_buffer *ab, u32 ssid, u32 tsid, u16 tcla
> audit_log_format(ab, " tcontext=%s", scontext);
> kfree(scontext);
> }
> - audit_log_format(ab, " tclass=%s", class_to_string[tclass]);
> +
> + if (tclass && tclass < ARRAY_SIZE(class_to_string))
> + audit_log_format(ab, " tclass=%s", class_to_string[tclass]);
> }
I don't see how this causes any harm. Can we count on audit_log_format
handleing a null pointer for the %s correctly? If we are going to work
under the assumption that bad tclass values might get in here we don't
know if we are going to hit a hole in the class table. Maybe we'd
rather have
if (tclass) && tclass < ARRAY_SIZE && class_to_string[tclass]
audit_log_format......
else
printk(KERN_ERR "attempting to log a non-kernel class definition %d\n", tclass);
so we at least know when something is getting through....
>
> /**
> diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
> diff --git a/security/selinux/ss/services.c b/security/selinux/ss/services.c
> index 1e52356..3668f18 100644
> --- a/security/selinux/ss/services.c
> +++ b/security/selinux/ss/services.c
> @@ -1050,6 +1050,8 @@ static int validate_classes(struct policydb *p)
>
> for (i = 1; i < kdefs->cts_len; i++) {
> def_class = kdefs->class_to_string[i];
> + if (!def_class)
> + continue;
> if (i > p->p_classes.nprim) {
> printk(KERN_INFO
> "security: class %s not defined in policy\n",
>
>
--
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.
next prev parent reply other threads:[~2007-03-23 18:41 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-22 13:24 Expunging userspace classes and permissions from kernel headers Stephen Smalley
2007-03-22 13:46 ` Christopher J. PeBenito
2007-03-22 13:50 ` Stephen Smalley
2007-03-22 17:25 ` Christopher J. PeBenito
2007-03-22 17:51 ` Stephen Smalley
2007-03-23 16:09 ` Christopher J. PeBenito
2007-03-23 16:25 ` Stephen Smalley
2007-03-23 18:34 ` James Morris
2007-03-23 18:41 ` Eric Paris [this message]
2007-03-23 18:50 ` Stephen Smalley
2007-03-23 19:37 ` Christopher J. PeBenito
2007-03-26 15:23 ` Stephen Smalley
2007-03-26 17:40 ` Stephen Smalley
2007-03-30 19:44 ` Stephen Smalley
2007-03-30 20:30 ` Christopher J. PeBenito
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=1174675265.10788.72.camel@localhost.localdomain \
--to=eparis@parisplace.org \
--cc=cpebenito@tresys.com \
--cc=csellers@tresys.com \
--cc=ewalsh@tycho.nsa.gov \
--cc=jmorris@namei.org \
--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.