All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] libsepol: with pp to CIL, only associate declared roleattributes with in-scope types
@ 2015-05-22 17:34 Steve Lawrence
  2015-05-22 17:34 ` [PATCH 2/2] libsepol: with pp to CIL, always write auditadm_r and secadm_r roles to the base module Steve Lawrence
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Steve Lawrence @ 2015-05-22 17:34 UTC (permalink / raw)
  To: SELinux List

When a roleattribute is in a declared scope, CIL roletype statements are
generated for all types associated with it. This incorrectly includes
types that are associated with the roleattribute in optional blocks,
which can result in CIL resolution failures if the optional block is
turned off due to a missing type. So, change the roletype CIL statement
generation with roleattributes to mimic the behavior of roles, ensuring
declared roleattributes are only associated with in-scope types.

Signed-off-by: Steve Lawrence <slawrence@tresys.com>
Reported-by: Miroslav Grepl <mgrepl@redhat.com>
---
 libsepol/src/module_to_cil.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libsepol/src/module_to_cil.c b/libsepol/src/module_to_cil.c
index 8d16d3e..1ded21d 100644
--- a/libsepol/src/module_to_cil.c
+++ b/libsepol/src/module_to_cil.c
@@ -2091,7 +2091,9 @@ static int role_to_cil(int indent, struct policydb *pdb, struct avrule_block *UN
 
 
 		for (i = 0; i < num_types; i++) {
-			cil_println(indent, "(roletype %s %s)", key, types[i]);
+			if (is_id_in_scope(pdb, decl_stack, types[i], SYM_TYPES)) {
+				cil_println(indent, "(roletype %s %s)", key, types[i]);
+			}
 		}
 
 		break;
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-05-29 13:57 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-22 17:34 [PATCH 1/2] libsepol: with pp to CIL, only associate declared roleattributes with in-scope types Steve Lawrence
2015-05-22 17:34 ` [PATCH 2/2] libsepol: with pp to CIL, always write auditadm_r and secadm_r roles to the base module Steve Lawrence
2015-05-25 10:45   ` Miroslav Grepl
2015-05-29 13:57   ` James Carter
2015-05-28 19:08 ` [PATCH 1/2] libsepol: with pp to CIL, only associate declared roleattributes with in-scope types James Carter
2015-05-28 20:15   ` James Carter
2015-05-29 13:43     ` James Carter
2015-05-29 13:56 ` James Carter

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.