libsepol: Only call role_fix_callback for base.p_roles during expansion.

expand_role_attributes() would merge the sub role attribute's roles
ebitmap into that of the parent, then clear it off from the parent's
roles ebitmap. This supports the assertion in role_fix_callback() that
any role attribute's roles ebitmap contains just regular roles.

expand_role_attribute() works on base.p_roles table but not any
block/decl's p_roles table, so the above assertion in role_fix_callback
could fail when it is called for block/decl and some role attribute is
added into another.

Since the effect of get_local_role() would have been complemented by
the populate_roleattributes() at the end of the link phase, there is
no needs(and wrong) to call role_fix_callback() for block/decl in the
expand phase.

Signed-off-by: Harry Ciao <qingtao.cao@windriver.com>
Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
This commit is contained in:
Harry Ciao 2011-08-02 18:03:53 +08:00 committed by Eric Paris
parent e1ae7b43f1
commit dbc9a61819

View File

@ -2835,9 +2835,6 @@ int expand_module(sepol_handle_t * handle,
if (hashtab_map if (hashtab_map
(decl->p_roles.table, role_copy_callback, &state)) (decl->p_roles.table, role_copy_callback, &state))
goto cleanup; goto cleanup;
if (hashtab_map
(decl->p_roles.table, role_fix_callback, &state))
goto cleanup;
/* copy users */ /* copy users */
if (hashtab_map if (hashtab_map