From 24618ad3f5d81954f93d91a77df55690d38dd368 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= Date: Thu, 9 Dec 2021 17:49:27 +0100 Subject: [PATCH] libsepol: validate fsuse types MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Check the fsuse type is valid, e.g. of type xattr, trans or task. Signed-off-by: Christian Göttsche --- libsepol/src/policydb_validate.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/libsepol/src/policydb_validate.c b/libsepol/src/policydb_validate.c index 2f30a3ad..b2d0e5e5 100644 --- a/libsepol/src/policydb_validate.c +++ b/libsepol/src/policydb_validate.c @@ -2,6 +2,7 @@ #include #include #include +#include #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; + } } } }