Skip to contentSkip to conversation

colons valid in identifiers in compilers?

DISCUSSION Spencer R. Shimko 2 participants 3 messages Aug 23, 2007 SELinux security module

lore
Share & tools
lore
#0 lore raw

All,

We were experimenting with labeling aliased interfaces yesterday. Of course it doesn't work in the kernel, the denials are on the physical interface label and the aliased interface labels are never checked (and rightly so).

The strange part is that, according to the lexer and parser sources, a colon should never be a valid identifier. E.g. eth0:1 should never be valid in a netifcon statement:

netifcon eth0:1 system_u:system_r:netif01_t system_u:system_r:unlabeled_t

The statement above should be invalid but it isn't throwing a compiler error. You can test this using:

# semanage interface -a -t http_port_t eth0:1

Subsequently running checkpolicy in debug mode reveals that the aliased interface label does appear in the binary policy.

According to the compiler sources a colon is not part of a valid identifier (line 203 in policy_scan.l). Why is the above succeeding given the lexer's definition of an identifier?

Thanks,
Spencer

Signature · 10 lines
Spencer Shimko
Tresys Technology, LLC
[email protected]
(410) 290-1411 x 125


--
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.
#1 lore raw
Quoted 15 lines · Spencer R. Shimko

All,

We were experimenting with labeling aliased interfaces yesterday. Of course it doesn't work in the kernel, the denials are on the physical interface label and the aliased interface labels are never checked (and rightly so).

The strange part is that, according to the lexer and parser sources, a colon should never be a valid identifier. E.g. eth0:1 should never be valid in a netifcon statement:

netifcon eth0:1 system_u:system_r:netif01_t system_u:system_r:unlabeled_t

The statement above should be invalid but it isn't throwing a compiler error. You can test this using:

Quoted 8 lines
# semanage interface -a -t http_port_t eth0:1

Subsequently running checkpolicy in debug mode reveals that the aliased interface label does appear in the binary policy.

According to the compiler sources a colon is not part of a valid identifier (line 203 in policy_scan.l). Why is the above succeeding given the lexer's definition of an identifier?

Changes via semanage don't go through checkpolicy at all, so the checkpolicy lexer/parser are irrelevant. It is purely up to what the libsemanage parser allows, and what the libsepol interface allows (which doesn't care). Interesting point though.

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.
#2 lore raw
Quoted 21 lines · Stephen Smalley
Quoted 20 lines · Spencer R. Shimko

All,

We were experimenting with labeling aliased interfaces yesterday. Of course it doesn't work in the kernel, the denials are on the physical interface label and the aliased interface labels are never checked (and rightly so).

The strange part is that, according to the lexer and parser sources, a colon should never be a valid identifier. E.g. eth0:1 should never be valid in a netifcon statement:

netifcon eth0:1 system_u:system_r:netif01_t system_u:system_r:unlabeled_t

The statement above should be invalid but it isn't throwing a compiler error. You can test this using:

# semanage interface -a -t http_port_t eth0:1

Subsequently running checkpolicy in debug mode reveals that the aliased interface label does appear in the binary policy.

Quoted 8 lines
Quoted 3 lines

According to the compiler sources a colon is not part of a valid identifier (line 203 in policy_scan.l). Why is the above succeeding given the lexer's definition of an identifier?

Changes via semanage don't go through checkpolicy at all, so the checkpolicy lexer/parser are irrelevant. It is purely up to what the libsemanage parser allows, and what the libsepol interface allows (which doesn't care). Interesting point though.

Thanks. libsepol doesn't do any validation checking on names/identifiers. A little birdie (Josh) has told me that the appropriate place to address this is in the new policy rep. Adding this type of logic to libsepol/libsemanage supposedly goes against all that is good ;)

Spencer

Quoted 3 lines
Signature · 2 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.