libsepol: validate fsuse types

Check the fsuse type is valid, e.g. of type xattr, trans or task.

Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
This commit is contained in:
Christian Göttsche 2021-12-09 17:49:27 +01:00 committed by James Carter
parent 8a7215c6a5
commit 24618ad3f5

View file

@ -2,6 +2,7 @@
#include <sepol/policydb/conditional.h>
#include <sepol/policydb/ebitmap.h>
#include <sepol/policydb/policydb.h>
#include <sepol/policydb/services.h>
#include "debug.h"
#include "policydb_validate.h"
@ -778,6 +779,15 @@ static int validate_ocontexts(sepol_handle_t *handle, policydb_t *p, validate_t
if (validate_context(&octx->context[1], flavors, p->mls))
goto bad;
break;
case OCON_FSUSE:
switch (octx->v.behavior) {
case SECURITY_FS_USE_XATTR:
case SECURITY_FS_USE_TRANS:
case SECURITY_FS_USE_TASK:
break;
default:
goto bad;
}
}
}
}