sepolicy: don't construct mappings for ignored types

Say, foo_type was introduced in 29.0 sepolicy and is in 29.0.ignore.cil.
Also assume (typeattributeset foo_type_29_0 (foo_type bar_type))

Make sure that above mapping is not expanded into 28.0.cil, 27.0.cil, etc.

Test: m selinux_policy
Test: build aosp/1199739
Change-Id: Ib564431ab67f555ea1ae650dc31a68121e9c6d84
This commit is contained in:
Tri Vo 2020-01-08 08:53:19 -08:00
parent 3e93ffb62f
commit 8c31ddf22e

View file

@ -45,6 +45,11 @@ def Combine(top, bottom):
# Typeattributes in V.v.cil have _V_v suffix, but not in V.v.ignore.cil
bottom_type = m.group(1) if m else top_ta
# If type doesn't exist in bottom map, no need to maintain mappings to
# that type.
if bottom_type not in bottom.rTypeattributesets.keys():
continue
for bottom_ta in bottom.rTypeattributesets[bottom_type]:
bottom.typeattributesets[bottom_ta].update(top_type_set)