Skip to contentSkip to conversation

any reason why a class mapping is not able to solve permissionx?

DISCUSSION Dominick Grift 2 participants 6 messages Jan 17, 2020 – Jan 23, 2020 SELinux security module

lore
Share & tools
lore
#0 lore raw

For example this:

(permissionx alg_socket_ioctl_except_SIOCGIFHWADDR (ioctl alg_socket (and (all) (not (0x8927))))) (classmap all_sockets (ioctl_except_SIOCGIFHWADDR))
(classmapping all_sockets ioctl_except_SIOCGIFHWADDR alg_socket_ioctl_except_SIOCGIFHWADDR)

(allowx a self (all_sockets (ioctl_except_SIOCGIFHWADDR)))

Say's:

<snip>
Building AST from Parse Tree
Destroying Parse Tree
Resolving AST
Failed to resolve classmapping statement at policy/base/class_maps.cil:994 Problem at policy/base/class_maps.cil:994
Pass 14 of resolution failed
Failed to resolve ast
Failed to compile cildb: -2
make: *** [Makefile:30: policy.32] Error 254

Am i doing something wrong or is this unsupported?

Signature · 3 lines
Key fingerprint = 5F4D 3CDB D3F8 3652 FBD8 02D5 3B6C 5F1D 2C7B 6B02
https://sks-keyservers.net/pks/lookup?op=get&search=0x3B6C5F1D2C7B6B02
Dominick Grift
#1 lore raw
Quoted 21 lines · Dominick Grift

For example this:

(permissionx alg_socket_ioctl_except_SIOCGIFHWADDR (ioctl alg_socket (and (all) (not (0x8927))))) (classmap all_sockets (ioctl_except_SIOCGIFHWADDR))
(classmapping all_sockets ioctl_except_SIOCGIFHWADDR alg_socket_ioctl_except_SIOCGIFHWADDR)

(allowx a self (all_sockets (ioctl_except_SIOCGIFHWADDR)))

Say's:

<snip>
Building AST from Parse Tree
Destroying Parse Tree
Resolving AST
Failed to resolve classmapping statement at policy/base/class_maps.cil:994 Problem at policy/base/class_maps.cil:994
Pass 14 of resolution failed
Failed to resolve ast
Failed to compile cildb: -2
make: *** [Makefile:30: policy.32] Error 254

Quoted 1 line

Am i doing something wrong or is this unsupported?

Are we supposed to be able to use allowx rules in macros?

This works when the tunable is set false:

(tunable no_mac_addr true)

(block bla1
(blockinherit system_agent_template)

(macro stuff ((type ARG1))
(tunableif no_mac_addr
(true
(allow ARG1 self create_except_ioctl_tcp_stream_socket_perms) (allowx ARG1 self tcp_socket_ioctl_except_SIOCGIFHWADDR))
(false
(allow ARG1 self create_tcp_stream_socket_perms)))))

(block blah2

        (blockinherit system_agent_template)

        (call bla1.stuff (subj)))

But when the tunable is set true:
<snip>
Building AST from Parse Tree
Destroying Parse Tree
Resolving AST
make: *** [Makefile:30: policy.32] Segmentation fault (core dumped)

Signature · 3 lines
Key fingerprint = 5F4D 3CDB D3F8 3652 FBD8 02D5 3B6C 5F1D 2C7B 6B02
https://sks-keyservers.net/pks/lookup?op=get&search=0x3B6C5F1D2C7B6B02
Dominick Grift
#2 lore raw
Quoted 22 lines · Dominick Grift
Quoted 21 lines · Dominick Grift

For example this:

(permissionx alg_socket_ioctl_except_SIOCGIFHWADDR (ioctl alg_socket (and (all) (not (0x8927))))) (classmap all_sockets (ioctl_except_SIOCGIFHWADDR))
(classmapping all_sockets ioctl_except_SIOCGIFHWADDR alg_socket_ioctl_except_SIOCGIFHWADDR)

(allowx a self (all_sockets (ioctl_except_SIOCGIFHWADDR)))

Say's:

<snip>
Building AST from Parse Tree
Destroying Parse Tree
Resolving AST
Failed to resolve classmapping statement at policy/base/class_maps.cil:994 Problem at policy/base/class_maps.cil:994
Pass 14 of resolution failed
Failed to resolve ast
Failed to compile cildb: -2
make: *** [Makefile:30: policy.32] Error 254

Quoted 2 lines
Quoted 1 line

Am i doing something wrong or is this unsupported?

Class maps only support normal permissions, they do not support extended permissions.

Quoted 2 lines

Are we supposed to be able to use allowx rules in macros?

allowx rules are allowed in macros. I will see if I can reproduce the error below and figure out what's going wrong.

Jim

Quoted 27 lines

This works when the tunable is set false:

(tunable no_mac_addr true)

(block bla1
(blockinherit system_agent_template)

(macro stuff ((type ARG1))
(tunableif no_mac_addr
(true
(allow ARG1 self create_except_ioctl_tcp_stream_socket_perms) (allowx ARG1 self tcp_socket_ioctl_except_SIOCGIFHWADDR))
(false
(allow ARG1 self create_tcp_stream_socket_perms)))))

(block blah2

         (blockinherit system_agent_template)

         (call bla1.stuff (subj)))

But when the tunable is set true:
<snip>
Building AST from Parse Tree
Destroying Parse Tree
Resolving AST
make: *** [Makefile:30: policy.32] Segmentation fault (core dumped)

Signature · 2 lines
James Carter <[email protected]>
National Security Agency
#3 lore raw
In reply to Dominick Grift
Quoted 22 lines · Dominick Grift
Quoted 21 lines · Dominick Grift

For example this:

(permissionx alg_socket_ioctl_except_SIOCGIFHWADDR (ioctl alg_socket (and (all) (not (0x8927))))) (classmap all_sockets (ioctl_except_SIOCGIFHWADDR))
(classmapping all_sockets ioctl_except_SIOCGIFHWADDR alg_socket_ioctl_except_SIOCGIFHWADDR)

(allowx a self (all_sockets (ioctl_except_SIOCGIFHWADDR)))

Say's:

<snip>
Building AST from Parse Tree
Destroying Parse Tree
Resolving AST
Failed to resolve classmapping statement at policy/base/class_maps.cil:994 Problem at policy/base/class_maps.cil:994
Pass 14 of resolution failed
Failed to resolve ast
Failed to compile cildb: -2
make: *** [Makefile:30: policy.32] Error 254

Quoted 4 lines
Quoted 1 line

Am i doing something wrong or is this unsupported?

Are we supposed to be able to use allowx rules in macros?

Yes, allowx rules can be used in macros.

Quoted 20 lines

This works when the tunable is set false:

(tunable no_mac_addr true)

(block bla1
(blockinherit system_agent_template)

(macro stuff ((type ARG1))
(tunableif no_mac_addr
(true
(allow ARG1 self create_except_ioctl_tcp_stream_socket_perms) (allowx ARG1 self tcp_socket_ioctl_except_SIOCGIFHWADDR))
(false
(allow ARG1 self create_tcp_stream_socket_perms)))))

(block blah2

         (blockinherit system_agent_template)

         (call bla1.stuff (subj)))
Quoted 7 lines

But when the tunable is set true:
<snip>
Building AST from Parse Tree
Destroying Parse Tree
Resolving AST
make: *** [Makefile:30: policy.32] Segmentation fault (core dumped)

Still trying to figure out the exact issue, but it is the use of the named permissionx that is causing the seg fault.

Jim

Signature · 2 lines
James Carter <[email protected]>
National Security Agency
#4 lore raw
Quoted 58 lines · On 1/21/20 11:26 AM, jwcart2 wrote:
Quoted 22 lines · Dominick Grift
Quoted 21 lines · Dominick Grift

For example this:

(permissionx alg_socket_ioctl_except_SIOCGIFHWADDR (ioctl alg_socket (and (all) (not (0x8927))))) (classmap all_sockets (ioctl_except_SIOCGIFHWADDR))
(classmapping all_sockets ioctl_except_SIOCGIFHWADDR alg_socket_ioctl_except_SIOCGIFHWADDR)

(allowx a self (all_sockets (ioctl_except_SIOCGIFHWADDR)))

Say's:

<snip>
Building AST from Parse Tree
Destroying Parse Tree
Resolving AST
Failed to resolve classmapping statement at policy/base/class_maps.cil:994 Problem at policy/base/class_maps.cil:994
Pass 14 of resolution failed
Failed to resolve ast
Failed to compile cildb: -2
make: *** [Makefile:30: policy.32] Error 254

Quoted 4 lines
Quoted 1 line

Am i doing something wrong or is this unsupported?

Are we supposed to be able to use allowx rules in macros?

Yes, allowx rules can be used in macros.

Quoted 18 lines

This works when the tunable is set false:

(tunable no_mac_addr true)

(block bla1
         (blockinherit system_agent_template)

         (macro stuff ((type ARG1))
                 (tunableif no_mac_addr
                   (true
                       (allow ARG1 self create_except_ioctl_tcp_stream_socket_perms) (allowx ARG1 self tcp_socket_ioctl_except_SIOCGIFHWADDR)) (false
                       (allow ARG1 self create_tcp_stream_socket_perms)))))

(block blah2
         (blockinherit system_agent_template)

Quoted 9 lines

         (call bla1.stuff (subj)))

But when the tunable is set true:
<snip>
Building AST from Parse Tree
Destroying Parse Tree
Resolving AST
make: *** [Makefile:30: policy.32] Segmentation fault (core dumped)

Quoted 2 lines

Still trying to figure out the exact issue, but it is the use of the named permissionx that is causing the seg fault.

There was an error in the code to copy a permissionx. I sent a patch to the list to fix this issue. Jim

Quoted 2 lines

Jim

Signature · 2 lines
James Carter <[email protected]>
National Security Agency
#5 lore raw
Quoted 62 lines · On Thu, Jan 23, 2020 at 03:41:30PM -0500, jwcart2 wrote:
Quoted 61 lines · On 1/21/20 11:26 AM, jwcart2 wrote:
Quoted 24 lines · Dominick Grift
Quoted 23 lines · Dominick Grift

For example this:

(permissionx alg_socket_ioctl_except_SIOCGIFHWADDR (ioctl alg_socket (and (all) (not (0x8927))))) (classmap all_sockets (ioctl_except_SIOCGIFHWADDR)) (classmapping all_sockets ioctl_except_SIOCGIFHWADDR alg_socket_ioctl_except_SIOCGIFHWADDR)

(allowx a self (all_sockets (ioctl_except_SIOCGIFHWADDR)))

Say's:

<snip>
Building AST from Parse Tree
Destroying Parse Tree
Resolving AST
Failed to resolve classmapping statement at policy/base/class_maps.cil:994 Problem at policy/base/class_maps.cil:994
Pass 14 of resolution failed
Failed to resolve ast
Failed to compile cildb: -2
make: *** [Makefile:30: policy.32] Error 254

Quoted 4 lines
Quoted 1 line

Am i doing something wrong or is this unsupported?

Are we supposed to be able to use allowx rules in macros?

Yes, allowx rules can be used in macros.

Quoted 28 lines

This works when the tunable is set false:

(tunable no_mac_addr true)

(block bla1
         (blockinherit system_agent_template)

         (macro stuff ((type ARG1))
                 (tunableif no_mac_addr
                   (true
                       (allow ARG1 self create_except_ioctl_tcp_stream_socket_perms)
                       (allowx ARG1 self tcp_socket_ioctl_except_SIOCGIFHWADDR)) (false
                       (allow ARG1 self create_tcp_stream_socket_perms)))))

(block blah2
         (blockinherit system_agent_template)

         (call bla1.stuff (subj)))

But when the tunable is set true:
<snip>
Building AST from Parse Tree
Destroying Parse Tree
Resolving AST
make: *** [Makefile:30: policy.32] Segmentation fault (core dumped)

Quoted 7 lines
Quoted 3 lines

Still trying to figure out the exact issue, but it is the use of the named permissionx that is causing the seg fault.

There was an error in the code to copy a permissionx. I sent a patch to the list to fix this issue.
Jim

Thanks!

Quoted 8 lines
Quoted 3 lines

Jim

Signature · 2 lines
James Carter <[email protected]>
National Security Agency
Signature · 3 lines
gpg --locate-keys [email protected]
Key fingerprint = FCD2 3660 5D6B 9D27 7FC6  E0FF DA7E 521F 10F6 4098
Dominick Grift