All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Smalley <sds@tycho.nsa.gov>
To: qingtao.cao@windriver.com
Cc: "Justin P. Mattock" <justinmattock@gmail.com>,
	selinux@tycho.nsa.gov, Eric Paris <eparis@parisplace.org>
Subject: Re: SELinux: avc_has_perm: unexpected error 22
Date: Fri, 25 Mar 2011 08:34:41 -0400	[thread overview]
Message-ID: <1301056481.22099.8.camel@moss-pluto> (raw)
In-Reply-To: <1301055989.22099.4.camel@moss-pluto>

On Fri, 2011-03-25 at 08:26 -0400, Stephen Smalley wrote:
> On Fri, 2011-03-25 at 11:18 +0800, Harry Ciao wrote:
> > So far I have not got an environment as your to reproduce this problem.
> > Could you please kindly print the orig_class and the sock boolean in
> > your case? It's weird since so far only the process and socket classes
> > could retain the creator's role, any other classes object should have
> > "object_r" as usual.
> > 
> > Many thanks for your help!
> 
> You can exercise the code without using XACE/XSELinux by running the
> compute_create program from libselinux/utils, e.g.
> $ compute_create `id -Z` `id -Z` x_drawable
> 
> I think the bug lies in map_class() handling of the case where the
> userspace object class has no corresponding kernel class, as would be
> the case for the x_* classes.  map_class() should likely return 0
> (SECCLASS_NULL) in that case rather than pol_value and thereby ensure
> that we won't match any legitimate kernel class value.

To test this theory, Justin, can you try this patch?

diff --git a/security/selinux/ss/services.c b/security/selinux/ss/services.c
index 3e7544d..ea7c01f 100644
--- a/security/selinux/ss/services.c
+++ b/security/selinux/ss/services.c
@@ -213,7 +213,7 @@ static u16 map_class(u16 pol_value)
 			return i;
 	}
 
-	return pol_value;
+	return SECCLASS_NULL;
 }
 
 static void map_decision(u16 tclass, struct av_decision *avd,


-- 
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:[~2011-03-25 12:34 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-21 16:52 SELinux: avc_has_perm: unexpected error 22 Justin P. Mattock
2011-03-21 16:52 ` [refpolicy] " Justin P. Mattock
2011-03-23 18:07 ` Justin P. Mattock
2011-03-23 18:07   ` [refpolicy] " Justin P. Mattock
2011-03-24  2:30   ` Justin P. Mattock
2011-03-24  2:30     ` [refpolicy] " Justin P. Mattock
2011-03-24 13:58     ` Stephen Smalley
2011-03-24 13:58       ` [refpolicy] " Stephen Smalley
2011-03-24 16:26       ` Justin P. Mattock
2011-03-24 16:26         ` [refpolicy] " Justin P. Mattock
2011-03-24 20:13         ` Stephen Smalley
2011-03-24 20:22           ` Justin P. Mattock
2011-03-24 20:24             ` Stephen Smalley
2011-03-24 20:43               ` Justin P. Mattock
2011-03-25  3:18                 ` Harry Ciao
2011-03-25 12:26                   ` Stephen Smalley
2011-03-25 12:34                     ` Stephen Smalley [this message]
2011-03-25 14:13                       ` [PATCH] selinux: Fix regression for Xorg Stephen Smalley
2011-03-25 18:04                         ` Justin P. Mattock
2011-03-26  3:03                         ` Justin P. Mattock
2011-03-28 12:42                           ` Stephen Smalley
2011-03-28 14:24                             ` Stephen Smalley
2011-03-28 16:20                               ` Justin P. Mattock
2011-03-28 22:28                               ` Justin P. Mattock

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=1301056481.22099.8.camel@moss-pluto \
    --to=sds@tycho.nsa.gov \
    --cc=eparis@parisplace.org \
    --cc=justinmattock@gmail.com \
    --cc=qingtao.cao@windriver.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.