All of lore.kernel.org
 help / color / mirror / Atom feed
From: guido@trentalancia.com (Guido Trentalancia)
To: refpolicy@oss.tresys.com
Subject: [refpolicy] optional_policy blocks
Date: Tue, 18 Jan 2011 17:16:05 +0100	[thread overview]
Message-ID: <1295367365.3083.27.camel@tesla.lan> (raw)
In-Reply-To: <4D35AA8C.5050001@gmail.com>

Hello again !

On Tue, 18/01/2011 at 15.58 +0100, Dominick Grift wrote:
> On 01/18/2011 03:39 PM, Guido Trentalancia wrote:
> > Hello !
> > 
> > I am trying to build and test a modified version of the git reference
> > policy. It is being built of type MCS and not monolithic.
> > 
> > Unfortunately, it seems that for some reason all of the
> > "optional_policy" blocks that are often used in TE files are not being
> > compiled in.
> 
> Because optional policy does not apply to monolithic policy. All modules
> are in a single module (the base module), thus all dependencies are
> installed.
> 
> optional policy is used for modular policy where many modules reside in
> their own policy module. This enabled you to add and remove specific
> modules and introduces the issue of dependencies.
> 
> the optional policy (policy in optional policy blocks) say's if this
> policy is available then use it and if its not available then ignore it.

This is my understanding. optional_policy() is a macro. Such macro
allows to optionally call one or more interfaces depending on whether a
module is included in the policy.

The optional_policy() support macro implements this capability
differently depending on whether a monolithic policy, base module, or
loadable module is being built.

However, the concept from a policy writer's perspective is the same. If
the module is being included in the build process, then the interfaces
defined within the optional_policy block are also called.

I believe that for modular policies it expands to an "optional" block,
while for monolithic policies it expands to an "ifdef" block, see for
example:

http://selinuxproject.org/page/NB_RefPolicy#optional_policy_Macro

http://www.nsa.gov/research/selinux/list-archive/0601/thread_body117.shtml

In any case, from the point of view of this discussion it doesn't really
matter whether the policy being built is monolithic or modular. The
point is that apparently the macro does not get expanded and built. I am
doing: make install-src ; make conf ; make policy ; make install ; make
load as described in the INSTALL file for the reference policy. And
again, as already mentioned, the relative modules appears to be built
and loaded (they appear in policy/modules.conf and also in the output of
semodule -l).

What am I missing then ?

> Sounds strange indeed. Are you sure it is not including any of the
> policy in optional policy block or just some?
>
> If it is just incidental then it could be an error in the interface in
> the optional policy block.
>
> If this really applies to all optional policy then i guess something
> else is going on.

Very strange. I have not checked every optional block in the policy. For
sure, it is not including those that I have created.

If there was an error in the interface definition, then the compiler
would complain !

It might well be the case that none of the optional_policy() blocks got
compiled in....

Regards,

Guido

  parent reply	other threads:[~2011-01-18 16:16 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-18 14:39 [refpolicy] optional_policy blocks Guido Trentalancia
2011-01-18 14:58 ` Dominick Grift
2011-01-18 15:53   ` Guido Trentalancia
2011-01-18 16:05     ` Dominick Grift
2011-01-18 20:56       ` Guido Trentalancia
2011-01-18 23:51         ` Chris PeBenito
2011-01-18 16:16   ` Guido Trentalancia [this message]
2011-01-18 16:27     ` Dominick Grift

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=1295367365.3083.27.camel@tesla.lan \
    --to=guido@trentalancia.com \
    --cc=refpolicy@oss.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.