All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eamon Walsh <ewalsh@tycho.nsa.gov>
To: Joshua Brindle <method@manicmethod.com>
Cc: Daniel J Walsh <dwalsh@redhat.com>, Joe Nall <joe@nall.com>,
	"Christopher J. PeBenito" <cpebenito@tresys.com>,
	SE Linux <selinux@tycho.nsa.gov>,
	Stephen Smalley <sds@tycho.nsa.gov>
Subject: Re: Use of optional_policy in templates (compiler bug or feature?)
Date: Mon, 20 Oct 2008 19:52:27 -0400	[thread overview]
Message-ID: <48FD19BB.1090503@tycho.nsa.gov> (raw)
In-Reply-To: <9E8A5545-7705-4CD3-9015-30AD17FA0AFE@nall.com>

Joe Nall wrote:
> I'm really struggling to get our mls X policy to work around this  
> issue. I have to rebuild the base policy for every change because the  
> change has to be in the optional. blagh.
>
> joe
>   

We took a look at this and applied the following patch to checkmodule:

diff --git a/checkpolicy/module_compiler.c b/checkpolicy/module_compiler.c
index 36d20be..c8a6d05 100644
--- a/checkpolicy/module_compiler.c
+++ b/checkpolicy/module_compiler.c
@@ -904,8 +904,7 @@ static int require_type_or_attribute(int pass, unsigned char isattr)
 			return -1;
 		}
 	case -2:{
-			yyerror("duplicate declaration of type/attribute");
-			return -1;
+			return 0;
 		}
 	case -1:{
 			yyerror("could not require type/attribute here");



The magic -2 value is documented at the top of require_symbol() as
meaning "duplicate declaration", however, in the bowels of the function
(module_compiler.c line 628) this is contradicted by the statement
"previous declaration was not in scope or had a mismatched
type/attribute."  So I think the error message touched in the above
patch is wrong, or at least not always correct.

Anyway, the return -2 on line 628 is the case encountered by Joe's test
code.  And in fact applying the above patch changes the error to:

/home/ewalsh/git/selinux/checkpolicy/checkmodule:  loading policy configuration from tmp/swo.tmp
swo.te":4:ERROR 'type swo_dbusd_t is not within scope' at token ';' on line 77949:
        allow swo_t swo_dbusd_t:dbus send_msg;
#line 4
/home/ewalsh/git/selinux/checkpolicy/checkmodule:  error(s) encountered while parsing configuration


So perhaps we could do something like go back and promote type
declarations in optional blocks into the containing scope when a require
is encountered further along?  Josh?


-- 
Eamon Walsh <ewalsh@tycho.nsa.gov>
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:[~2008-10-20 23:52 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-15 16:02 Use of optional_policy in templates (compiler bug or feature?) Joe Nall
2008-10-15 18:46 ` Christopher J. PeBenito
2008-10-15 19:59   ` Joe Nall
2008-10-16 12:49     ` Christopher J. PeBenito
2008-10-16 13:43       ` Joe Nall
2008-10-16 14:50         ` Joshua Brindle
2008-10-16 15:46           ` Joe Nall
2008-10-20 18:19           ` Daniel J Walsh
2008-10-20 18:41             ` Joe Nall
2008-10-20 23:52               ` Eamon Walsh [this message]
2008-10-22 14:01                 ` Stephen Smalley
2008-10-22 14:26                   ` Joe Nall
2008-10-22 14:28                     ` Stephen Smalley
2008-10-22 14:32                       ` Stephen Smalley
2008-10-22 17:42                         ` Joshua Brindle
2008-10-23 14:10                           ` Stephen Smalley
2008-10-23 14:15                             ` Joshua Brindle
2008-10-23 14:16                             ` Stephen Smalley
2008-11-24  3:35                         ` Joe Nall
2008-12-02 14:26                           ` Joe Nall
2008-12-02 14:27                             ` Stephen Smalley

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=48FD19BB.1090503@tycho.nsa.gov \
    --to=ewalsh@tycho.nsa.gov \
    --cc=cpebenito@tresys.com \
    --cc=dwalsh@redhat.com \
    --cc=joe@nall.com \
    --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.