Skip to contentSkip to conversation

There is a bug in checkmodule that is driving me nuts

DISCUSSION Daniel J Walsh 5 participants 9 messages Jul 20, 2007 – Jul 23, 2007 SELinux security module

lore
Share & tools
lore
#0 lore raw

The compiler is mistakenly seeing a

gen_requires {
      type  xguest_gnome_home_t;
}

As a redefinition of the type

/usr/bin/checkmodule -M -m guest.tmp -o guest.mod/usr/bin/checkmodule: loading policy configuration from guest.tmp policy/modules/users/guest.te:4:ERROR 'duplicate declaration of type/attribute' at token ';' on line 55020:

       type xguest_gnome_home_t;

#line 4
/usr/bin/checkmodule: error(s) encountered while parsing configuration

The problem is the gen_requires happens before the declaration.

The type is being declared in a template file.

#1 lore raw
Quoted 12 lines · Daniel J Walsh

The compiler is mistakenly seeing a

gen_requires {
       type  xguest_gnome_home_t;
}

As a redefinition of the type

/usr/bin/checkmodule -M -m guest.tmp -o guest.mod/usr/bin/checkmodule:
loading policy configuration from guest.tmp policy/modules/users/guest.te:4:ERROR 'duplicate declaration of type/attribute' at token ';' on line 55020:

Quoted 7 lines
        type xguest_gnome_home_t;

#line 4
/usr/bin/checkmodule: error(s) encountered while parsing configuration

The problem is the gen_requires happens before the declaration.

The type is being declared in a template file.

For better or discarding of requires upon hitting a declaration isn't like to be fixed (when the require is first).

I have an alternative suggestion - remove all of the requires from the policy and use an sepolgen-based pre-processor to add them back in until the policyrep work is done. That will ease the migration and can be done far more easily than fixing the current compiler.

Karl

--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.

#2 lore raw

Hello,

Can I ask what policyrep is ?
Is that policy-generating project on going or wat ?

Thanks.

2007/7/21, Karl MacMillan <[email protected]>:

Quoted 30 lines · Daniel J Walsh
Quoted 12 lines

The compiler is mistakenly seeing a

gen_requires {
       type  xguest_gnome_home_t;
}

As a redefinition of the type

/usr/bin/checkmodule -M -m guest.tmp -o guest.mod/usr/bin/checkmodule:
loading policy configuration from guest.tmp policy/modules/users/guest.te:4:ERROR 'duplicate declaration of type/attribute' at token ';' on line 55020:

Quoted 7 lines
        type xguest_gnome_home_t;

#line 4
/usr/bin/checkmodule: error(s) encountered while parsing configuration

The problem is the gen_requires happens before the declaration.

The type is being declared in a template file.

For better or discarding of requires upon hitting a declaration isn't like to be fixed (when the require is first).

I have an alternative suggestion - remove all of the requires from the policy and use an sepolgen-based pre-processor to add them back in until the policyrep work is done. That will ease the migration and can be done far more easily than fixing the current compiler.

Quoted 8 lines

Karl

--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.

--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.

#3 lore raw
Quoted 5 lines · Shintaro Fujiwara

Hello,

Can I ask what policyrep is ?
Is that policy-generating project on going or wat ?

Separate branch to rework the selinux policy compiler. It includes a library for representing policies (hence the name policyrep) that is useful for policy compilation, analysis, and generation. You can view the code at:

http://selinux.svn.sourceforge.net/viewvc/selinux/branches/policyrep/

Karl

Quoted 35 lines

Thanks.

2007/7/21, Karl MacMillan <[email protected]>:

Quoted 32 lines · Daniel J Walsh
Quoted 9 lines

The compiler is mistakenly seeing a

gen_requires {
       type  xguest_gnome_home_t;
}

As a redefinition of the type

/usr/bin/checkmodule -M -m guest.tmp -o

guest.mod/usr/bin/checkmodule:

Quoted 6 lines

loading policy configuration from guest.tmp policy/modules/users/guest.te:4:ERROR 'duplicate declaration of type/attribute' at token ';' on line 55020:

        type xguest_gnome_home_t;

#line 4
/usr/bin/checkmodule: error(s) encountered while parsing

configuration

Quoted 4 lines

The problem is the gen_requires happens before the declaration.

The type is being declared in a template file.

For better or discarding of requires upon hitting a declaration isn't like to be fixed (when the require is first).

I have an alternative suggestion - remove all of the requires from the policy and use an sepolgen-based pre-processor to add them back in until the policyrep work is done. That will ease the migration and can be done far more easily than fixing the current compiler.

Quoted 13 lines
Quoted 8 lines

Karl

Signature · 3 lines
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.
Signature · 3 lines
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.

--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.

#4 lore raw
In reply to Karl MacMillan
Quoted 17 lines · Karl MacMillan
Quoted 16 lines · Daniel J Walsh

The compiler is mistakenly seeing a

gen_requires {
       type  xguest_gnome_home_t;
}

As a redefinition of the type

/usr/bin/checkmodule -M -m guest.tmp -o guest.mod/usr/bin/checkmodule:
loading policy configuration from guest.tmp policy/modules/users/guest.te:4:ERROR 'duplicate declaration of type/attribute' at token ';' on line 55020:

        type xguest_gnome_home_t;

#line 4
/usr/bin/checkmodule: error(s) encountered while parsing configuration

Quoted 6 lines
Quoted 3 lines

The problem is the gen_requires happens before the declaration.

The type is being declared in a template file.

For better or discarding of requires upon hitting a declaration isn't like to be fixed (when the require is first).

How hard is it to escalate a requires to a decl?
Already happens for users and roles, right?

Quoted 13 lines

I have an alternative suggestion - remove all of the requires from the policy and use an sepolgen-based pre-processor to add them back in until the policyrep work is done. That will ease the migration and can be done far more easily than fixing the current compiler.

Karl

--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.

Signature · 8 lines
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 [email protected] with
the words "unsubscribe selinux" without quotes as the message.
#5 lore raw
Quoted 21 lines · Stephen Smalley
Quoted 19 lines · Karl MacMillan
Quoted 17 lines · Daniel J Walsh

The compiler is mistakenly seeing a

gen_requires {
       type  xguest_gnome_home_t;
}

As a redefinition of the type

/usr/bin/checkmodule -M -m guest.tmp -o guest.mod/usr/bin/checkmodule:
loading policy configuration from guest.tmp
policy/modules/users/guest.te:4:ERROR 'duplicate declaration of type/attribute' at token ';' on line 55020:

        type xguest_gnome_home_t;

#line 4
/usr/bin/checkmodule: error(s) encountered while parsing configuration

The problem is the gen_requires happens before the declaration.

Quoted 23 lines
Quoted 5 lines
Quoted 2 lines

The type is being declared in a template file.

For better or discarding of requires upon hitting a declaration isn't like to be fixed (when the require is first).

How hard is it to escalate a requires to a decl?
Already happens for users and roles, right?

Quoted 13 lines

I have an alternative suggestion - remove all of the requires from the policy and use an sepolgen-based pre-processor to add them back in until the policyrep work is done. That will ease the migration and can be done far more easily than fixing the current compiler.

Karl

--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.

If we resorted Templates before Interfaces, would this problem go away?

--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.

#6 lore raw
Quoted 40 lines · Daniel J Walsh
Quoted 39 lines · Stephen Smalley
Quoted 17 lines · Karl MacMillan
Quoted 15 lines · Daniel J Walsh

The compiler is mistakenly seeing a

gen_requires {
       type  xguest_gnome_home_t;
}

As a redefinition of the type

/usr/bin/checkmodule -M -m guest.tmp -o
guest.mod/usr/bin/checkmodule: loading policy configuration from guest.tmp policy/modules/users/guest.te:4:ERROR 'duplicate declaration of type/attribute' at token ';' on line 55020:

        type xguest_gnome_home_t;

#line 4
/usr/bin/checkmodule: error(s) encountered while parsing configuration

Quoted 7 lines
Quoted 4 lines

The problem is the gen_requires happens before the declaration.

The type is being declared in a template file.

For better or discarding of requires upon hitting a declaration isn't like to be fixed (when the require is first).

How hard is it to escalate a requires to a decl?
Already happens for users and roles, right?

Quoted 8 lines

I have an alternative suggestion - remove all of the requires from the policy and use an sepolgen-based pre-processor to add them back in until the policyrep work is done. That will ease the migration and can be done far more easily than fixing the current compiler.

Karl

Quoted 7 lines
Quoted 5 lines
Quoted 5 lines
Signature · 3 lines
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.

If we resorted Templates before Interfaces, would this problem go away?

Potentially - requires after declarations works fine (the requires is just ignored). The other way around is what is more trouble.

Karl

Quoted 5 lines
Signature · 4 lines
-- 
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.

--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.

#7 lore raw
Quoted 46 lines · Karl MacMillan
Quoted 45 lines · Daniel J Walsh
Quoted 44 lines · Stephen Smalley
Quoted 17 lines · Karl MacMillan
Quoted 15 lines · Daniel J Walsh

The compiler is mistakenly seeing a

gen_requires {
       type  xguest_gnome_home_t;
}

As a redefinition of the type

/usr/bin/checkmodule -M -m guest.tmp -o
guest.mod/usr/bin/checkmodule: loading policy configuration from guest.tmp policy/modules/users/guest.te:4:ERROR 'duplicate declaration of type/attribute' at token ';' on line 55020:

        type xguest_gnome_home_t;

#line 4
/usr/bin/checkmodule: error(s) encountered while parsing configuration

Quoted 7 lines
Quoted 4 lines

The problem is the gen_requires happens before the declaration.

The type is being declared in a template file.

For better or discarding of requires upon hitting a declaration isn't like to be fixed (when the require is first).

How hard is it to escalate a requires to a decl?
Already happens for users and roles, right?

Quoted 13 lines

I have an alternative suggestion - remove all of the requires from the policy and use an sepolgen-based pre-processor to add them back in until the policyrep work is done. That will ease the migration and can be done far more easily than fixing the current compiler.

Karl

Signature · 3 lines
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.
Quoted 6 lines
Quoted 2 lines

If we resorted Templates before Interfaces, would this problem go away?

Potentially - requires after declarations works fine (the requires is just ignored). The other way around is what is more trouble.

Karl

Ok I was able to hack around this by removing the optional block around gnome_per_role_domain, and moving the definition before the xwindows stuff.

I will add comments that this is broken, and when the new compiler is available we can put it back the way it was.

Quoted 8 lines
Quoted 7 lines
Signature · 4 lines
-- 
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.

--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.

#8 lore raw
In reply to Karl MacMillan
Quoted 46 lines · Karl MacMillan
Quoted 45 lines · Daniel J Walsh
Quoted 44 lines · Stephen Smalley
Quoted 17 lines · Karl MacMillan
Quoted 15 lines · Daniel J Walsh

The compiler is mistakenly seeing a

gen_requires {
       type  xguest_gnome_home_t;
}

As a redefinition of the type

/usr/bin/checkmodule -M -m guest.tmp -o
guest.mod/usr/bin/checkmodule: loading policy configuration from guest.tmp policy/modules/users/guest.te:4:ERROR 'duplicate declaration of type/attribute' at token ';' on line 55020:

        type xguest_gnome_home_t;

#line 4
/usr/bin/checkmodule: error(s) encountered while parsing configuration

Quoted 7 lines
Quoted 4 lines

The problem is the gen_requires happens before the declaration.

The type is being declared in a template file.

For better or discarding of requires upon hitting a declaration isn't like to be fixed (when the require is first).

How hard is it to escalate a requires to a decl?
Already happens for users and roles, right?

Quoted 13 lines

I have an alternative suggestion - remove all of the requires from the policy and use an sepolgen-based pre-processor to add them back in until the policyrep work is done. That will ease the migration and can be done far more easily than fixing the current compiler.

Karl

Signature · 3 lines
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.
Quoted 14 lines
Quoted 2 lines

If we resorted Templates before Interfaces, would this problem go away?

Potentially - requires after declarations works fine (the requires is just ignored). The other way around is what is more trouble.

Karl

Quoted 5 lines
Signature · 4 lines
-- 
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.

template(userdom_unpriv_xwindows_login_user',

userdom_unpriv_login_user($1)
# Should be optional but policy will not build because of compiler problems # Must be before xwindows calls
#optional_policy(`
gnome_per_role_template($1, $1_usertype, $1_r) gnome_exec_gconf($1_t)
#')

userdom_xwindows_client_template($1)
...

--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.