libsepol: Check that a module does not have any commons when validating
PATCH 1/1 libsepol: Check that a module does not have any commons when validating
Since a common cannot be declared in a module and cannot be required, there should not be any commons in a policy module. But a maliciously crafted policy could add one which could cause problems when processing the module.
Check that a module does not contain any commons when validating the module after reading it in and quit with an error if it does.
--- libsepol/src/policydb_validate.c | 2 ++ 1 file changed, 2 insertions(+)
libsepol/src/policydb_validate.c +2 -0
@@ -2092,6 +2092,8 @@ int policydb_validate(sepol_handle_t *handle, const policydb_t *p)if (validate_filename_trans_hashtab (handle, p, flavors)) goto bad; }else { +if ((p->policy_type ==POLICY_MOD ) && (p->p_commons.nprim >0 )) + goto bad;if (validate_avrule_blocks (handle, p->global, p, flavors)) goto bad; }
Signature · 1 line
2.55.0
Quoted 10 lines · James Carter
Since a common cannot be declared in a module and cannot be required, there should not be any commons in a policy module. But a maliciously crafted policy could add one which could cause problems when processing the module.
Check that a module does not contain any commons when validating the module after reading it in and quit with an error if it does.
Signed-off-by James Carter <[email protected]>
and merged.