From fa3a1bcaf3f808dd22c7969c3865f554c21cfd20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= Date: Mon, 8 Apr 2024 17:07:59 +0200 Subject: [PATCH] libsepol: improve policy lookup failure message MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If a policy version cannot be found include the policy target, and a module prefix for non kernel policies in the message. Signed-off-by: Christian Göttsche Acked-by: James Carter --- libsepol/src/write.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libsepol/src/write.c b/libsepol/src/write.c index 283d11c8..2fcc1701 100644 --- a/libsepol/src/write.c +++ b/libsepol/src/write.c @@ -2252,8 +2252,10 @@ int policydb_write(policydb_t * p, struct policy_file *fp) info = policydb_lookup_compat(p->policyvers, p->policy_type, p->target_platform); if (!info) { - ERR(fp->handle, "compatibility lookup failed for policy " - "version %d", p->policyvers); + ERR(fp->handle, "compatibility lookup failed for %s%s policy version %d", + p->target_platform == SEPOL_TARGET_SELINUX ? "selinux" : "xen", + p->policy_type == POLICY_KERN ? "" : " module", + p->policyvers); return POLICYDB_ERROR; }