All of lore.kernel.org
 help / color / mirror / Atom feed
From: James Carter <jwcart2@tycho.nsa.gov>
To: Steve Lawrence <slawrence@tresys.com>,
	SELinux List <selinux@tycho.nsa.gov>
Subject: Re: [PATCH v2 2/3] libsepol/cil: add ioctl whitelist support
Date: Wed, 2 Sep 2015 15:28:18 -0400	[thread overview]
Message-ID: <55E74DD2.5000000@tycho.nsa.gov> (raw)
In-Reply-To: <55E74747.1030106@tresys.com>

On 09/02/2015 03:00 PM, Steve Lawrence wrote:
> On 09/02/2015 02:29 PM, James Carter wrote:
>> On 08/31/2015 08:53 AM, Steve Lawrence wrote:
>>> Add three new extended avrule statements with the following syntax:
>>>
>>>     (allowx source_type target_type permissionx)
>>>     (auditallowx source_type target_type permissionx)
>>>     (dontauditx source_type target_type permissionx)
>>>
>>> source_type - type, typeattribute, or typealias
>>> target_type - type, typeattribute, typealias, or "self" keyword
>>> permissionx - named or anonymous permissionx statement, which has the
>>> syntax:
>>>
>>>     (permissionx name (kind object expression))
>>>
>>
>> Right now the permissionx name will be fully qualified, but we haven't
>> been doing that for identifiers that don't show up in the kernel policy
>> (classpermsets, named contexts, named ranges, named ip addrs, etc). So
>> it seems like you should exclude walking the permx symtab in
>> cil_fqn.c:__cil_fqn_qualify_blocks() like we do for these other symtabs.
>>
>
> Yep, this should be excluded from being fully qualified. Will fix.
>
>> The other question I have (and I am willing to put this off for now
>> because I don't know how much work it would be and I don't want to delay
>> this any longer than I already have) is whether it would be possible to
>> factor out the common code from checkpolicy's policy_define.c and cil's
>> cil_binary.c into some common functions in libsepol.
>>
>
> Unfortunately, there really isn't much in common between checkpolicy and
> CIL for extended avrules. checkpolicy uses an av_ioctl_range_list to
> keep track of the extended permissions. But since CIL supports more
> complex expressions and because of expression code reuse, it was easier
> to just use an ebitmap for evaluating/storing the extended permissions.
> Additionally, checkpolicy adds extended avrules to the list of
> avrule_t's, whereas CIL writes directly to the avtab. So they take
> pretty different approaches to solving the same problem.
>
> Really, the only thing they have in common, which was copied directly
> from policy_define.c, is the xperm_setrangebits function. Now that that
> function is in CIL/libsepol, it wouldn't be much effort to have
> checkpolicy use that one and remove the one in policy_define, but I
> think that's about all the refactoring we could do without maybe
> rewriting policy_define.c to use ebitmaps, and I'm not even sure that
> would remove very much code.
>

OK. Don't worry about then.

Jim



-- 
James Carter <jwcart2@tycho.nsa.gov>
National Security Agency

  reply	other threads:[~2015-09-02 19:28 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-31 12:53 [PATCH v2 0/3] Add CIL extended avrule & ioctl whitelist support Steve Lawrence
2015-08-31 12:53 ` [PATCH v2 1/3] libsepol: fix memory leak when destroying avtab containing extended avrules Steve Lawrence
2015-08-31 12:53 ` [PATCH v2 2/3] libsepol/cil: add ioctl whitelist support Steve Lawrence
2015-09-02 18:29   ` James Carter
2015-09-02 19:00     ` Steve Lawrence
2015-09-02 19:28       ` James Carter [this message]
2015-09-02 19:32       ` Jeffrey Vander Stoep
2015-09-02 19:27   ` James Carter
2015-08-31 12:53 ` [PATCH v2 3/3] secilc: Add documentation/examples for allowx, auditallowx, dontauditx, and permissionx Steve Lawrence

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=55E74DD2.5000000@tycho.nsa.gov \
    --to=jwcart2@tycho.nsa.gov \
    --cc=selinux@tycho.nsa.gov \
    --cc=slawrence@tresys.com \
    /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.