On Sat, Nov 16, 2024 at 12:37 AM Christian Göttsche <cgoettsche@xxxxxxxxxxxxx> wrote: > > From: Christian Göttsche <cgzones@xxxxxxxxxxxxxx> > > Be more strict during parsing of policies and reject invalid values. > > Add some error messages in the case of policy parse failures, to > enhance debugging, either on a malformed policy or a too strict check. > > Signed-off-by: Christian Göttsche <cgzones@xxxxxxxxxxxxxx> > --- Thanks for the patch. > + switch (xperms.specified) { > + case AVTAB_XPERMS_IOCTLFUNCTION: > + case AVTAB_XPERMS_IOCTLDRIVER: > + case AVTAB_XPERMS_NLMSG: > + break; > + default: > + pr_err("SELinux: avtab: invalid xperm specifier %#x\n", xperms.specified); > + return -EINVAL; > + } > rc = next_entry(&xperms.driver, fp, sizeof(u8)); I think this is too restrictive. We should be able to add extended permissions in a future policy and this should be gracefully handled by the kernel. You could use a pr_info instead, similarly to what is done in selinux_set_mapping for unknown permissions.