All of lore.kernel.org
 help / color / mirror / Atom feed
From: KaiGai Kohei <kaigai@ak.jp.nec.com>
To: Stephen Smalley <sds@tycho.nsa.gov>
Cc: method@manicmethod.com, Jacques Thomas <jthomas@cs.purdue.edu>,
	SE Linux <selinux@tycho.nsa.gov>
Subject: Re: [PATCH 2/2] libsepol: remove dead code in check_avtab_hierarchy_callback()
Date: Tue, 16 Feb 2010 11:36:54 +0900	[thread overview]
Message-ID: <4B7A04C6.9020808@ak.jp.nec.com> (raw)
In-Reply-To: <4B7104C9.30903@ak.jp.nec.com>

(2010/02/09 15:46), KaiGai Kohei wrote:
> (2010/02/05 23:50), Stephen Smalley wrote:
>> On Fri, 2010-02-05 at 14:42 +0900, KaiGai Kohei wrote:
>>> What is the current status of this patch?
>>> Its kernel side patch has been already merged into James's -next tree.
>>>
>>> http://git.kernel.org/?p=linux/kernel/git/jmorris/security-testing-2.6.git;a=commit;h=7d52a155e38d5a165759dbbee656455861bf7801
>>
>> I had to use -l to get it to apply (whitespace mangled).
>>
>> Before applying it, when trying to install the test_policy.pp module
>> from the selinux testsuite with expand-check=1
>> in /etc/selinux/semanage.conf, I get:
>> libsepol.check_avtab_hierarchy_callback: hierarchy violation between types test_bounds_child_t and test_bounds_file_blue_t : file {  ioctl read getattr lock open }
>> libsepol.check_avtab_hierarchy_callback: hierarchy violation between types test_bounds_child_t and test_bounds_file_red_t : file {  write append }
>> libsepol.hierarchy_check_constraints: 2 total errors found during hierarchy check
>>
>> And after applying it, I get the following:
>> libsepol.check_avtab_hierarchy_callback: hierarchy violation between types test_bounds_child_t and test_bounds_file_blue_t : file {  ioctl read getattr lock open }
>> libsepol.check_avtab_hierarchy_callback: hierarchy violation between types test_bounds_child_t and test_bounds_child_t : process {  fork transition sigchld sigkill sigstop signull signal getsched setsched getsession getpgid setpgid getcap setcap share getattr setexec setfscreate noatsecure siginh rlimitinh setcurrent setkeycreate setsockcreate }
>> libsepol.check_avtab_hierarchy_callback: hierarchy violation between types test_bounds_child_t and test_bounds_child_t : capability {  dac_override dac_read_search }
>> libsepol.check_avtab_hierarchy_callback: hierarchy violation between types test_bounds_child_t and test_bounds_child_t : file {  ioctl read write getattr lock append open }
>> libsepol.check_avtab_hierarchy_callback: hierarchy violation between types test_bounds_child_t and test_bounds_child_t : dir {  ioctl read getattr lock search open }
>> libsepol.check_avtab_hierarchy_callback: hierarchy violation between types test_bounds_child_t and test_bounds_child_t : fd {  use }
>> libsepol.check_avtab_hierarchy_callback: hierarchy violation between types test_bounds_child_t and test_bounds_child_t : lnk_file {  ioctl read getattr lock }
>> libsepol.check_avtab_hierarchy_callback: hierarchy violation between types test_bounds_child_t and test_bounds_child_t : fifo_file {  ioctl read write getattr lock append open }
>> libsepol.check_avtab_hierarchy_callback: hierarchy violation between types test_bounds_child_t and test_bounds_child_t : unix_stream_socket {  ioctl read write create getattr setattr append bind connect listen accept getopt setopt shutdown }
>> libsepol.check_avtab_hierarchy_callback: hierarchy violation between types test_bounds_child_t and test_bounds_child_t : unix_dgram_socket {  ioctl read write create getattr setattr append bind connect getopt setopt shutdown sendto }
>> libsepol.check_avtab_hierarchy_callback: hierarchy violation between types test_bounds_child_t and test_bounds_child_t : association {  sendto }
>> libsepol.check_avtab_hierarchy_callback: hierarchy violation between types test_bounds_child_t and test_bounds_file_red_t : file {  write append }
>> libsepol.hierarchy_check_constraints: 12 total errors found during hierarchy check
>>
> 
> We might overlook something in the case when both of source and target are bounded.
> 
> When test_bounds_child_t tries to access a pseudo file, such as /proc/<PID>, these
> entries are labeled to domain of the corresponding process.
> The test_bounds_child_t is bounded to test_bounds_parent_t, and it is also a case
> when both of source and target are bounded to its super domain.
> 
> This test policy indeed violated to the first check that ensures the permissions
> between source (test_bounds_child_t) and target (test_bounds_child_t) are enclosed
> by the permissions between parent of the source (test_bounds_parent_t) and the target,
> because nothing are allowed between test_bounds_parent_t and test_bounds_child_t as
> a filesystem object.
> 
> However, the older implementation had also ensured the permissions between the source
> and the target are enclosed by the permissions between parent of the source and parent
> of the target, then, if these are enclosed, this check allows the permissions between
> both of children, even if the first checks were violated.
> 
> In other words, we have to allow the test_bounds_parent_t to performs something on
> the test_bounds_child_t explicitly, in this case.
> 
> At first, I replied to Jacques Thomas that I could not find any actual use cases in
> the target side boundary, but it might be misjudge.
> If I vote it again, I'll support an idea to revert my patch.

What is your opinion for this topic?

At first, I didn't find out the case when a bounded domain
accesses /proc/self/* entries with its parent's security context.
In this case, the policy writer has to allow parent domain to
access all the pseudo file entries of possible child domains.

The previous boundary code on the target side well handled it,
but I removed it as a dead code.

I think we have two options.

The one is simple. It is to revert this commit:
  7d52a155e38d5a165759dbbee656455861bf7801

The other is to have a convention when we write policies using
bounds domain.
For example, if all the domain bounded to httpd_t must have
httpd_child_domain attribute, we can allow httpd_t domain to
access file entries of possible child domains in apache.te.

Right now, my preference is the later option.

Thanks,
-- 
OSS Platform Development Division, NEC
KaiGai Kohei <kaigai@ak.jp.nec.com>

--
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:[~2010-02-16  2:36 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-08 19:24 Type boundaries: questions on the semantics / is the enforcement correct ? Jacques Thomas
2009-11-18  2:44 ` KaiGai Kohei
2009-11-19 16:07   ` Jacques Thomas
2009-11-30 18:40     ` Jacques Thomas
2009-12-01  1:02       ` KaiGai Kohei
2009-12-01  3:53         ` Jacques Thomas
2009-12-08 19:46           ` Joshua Brindle
2010-01-15 15:51           ` Stephen Smalley
2010-01-18 10:10             ` KaiGai Kohei
2010-01-20  4:25               ` [PATCH 1/2] selinux: remove dead code in type_attribute_bounds_av() KaiGai Kohei
2010-01-20 13:33                 ` Stephen Smalley
2010-01-20 16:29                   ` contents of /etc/selinux/<type>/contexts/users/* Hasan Rezaul-CHR010
2010-01-20 17:33                     ` Stephen Smalley
2010-01-21  6:00                   ` [PATCH 1/2] selinux: remove dead code in type_attribute_bounds_av() KaiGai Kohei
2010-01-21 14:08                     ` Stephen Smalley
2010-01-24 22:24                     ` James Morris
2010-01-20  4:26               ` [PATCH 2/2] libsepol: remove dead code in check_avtab_hierarchy_callback() KaiGai Kohei
2010-02-05  5:42                 ` KaiGai Kohei
2010-02-05 14:50                   ` Stephen Smalley
2010-02-09  6:46                     ` KaiGai Kohei
2010-02-16  2:36                       ` KaiGai Kohei [this message]
2010-02-16 15:25                         ` Stephen Smalley
2010-02-16 23:49                           ` KaiGai Kohei
2010-02-17 13:51                             ` Stephen Smalley
2010-02-19  7:33                               ` KaiGai Kohei
2010-02-19 15:20                                 ` Stephen Smalley
2010-03-01  2:43                                   ` KaiGai Kohei
2010-03-01 14:34                                     ` Stephen Smalley
2010-03-03  8:09                                       ` KaiGai Kohei
2010-03-04 16:01                                         ` Joshua Brindle
2010-03-04 16:24                                           ` Joshua Brindle
2010-03-05  0:39                                           ` KaiGai Kohei
2010-03-05 14:19                                             ` Joshua Brindle
2010-03-05 14:25                                               ` Stephen Smalley
2010-03-05 14:31                                                 ` Joshua Brindle
2010-03-08  6:56                                                   ` KaiGai Kohei
2010-03-08 15:27                                                     ` Joshua Brindle
2010-02-19 17:31                             ` Stephen Smalley
2010-02-21 22:09                             ` James Morris

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=4B7A04C6.9020808@ak.jp.nec.com \
    --to=kaigai@ak.jp.nec.com \
    --cc=jthomas@cs.purdue.edu \
    --cc=method@manicmethod.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.