* [PATCH v2] apparmor: return 0 from unpack_tag_headers() on success
@ 2026-12-02 17:47 Cong Nguyen
2026-12-02 17:50 ` sashiko-bot
0 siblings, 1 reply; 2+ messages in thread
From: Cong Nguyen @ 2026-12-02 17:47 UTC (permalink / raw)
To: John Johansen, Georgia Garcia
Cc: Guicai Ma, apparmor, linux-security-module, linux-kernel
unpack_tag_headers() returns int, where 0 means success and a negative
errno means failure, like unpack_strs_table() and unpack_tagsets() which
unpack_tags() calls next to it. On success it returns true, which is 1.
unpack_tags() tests the result with "if (error)", so a successfully
unpacked "hdrs" array is treated as a failure: unpack_tags() destroys the
tags, rewinds e->pos and returns 1. Its caller, unpack_pdb(), only checks
for "< 0", so it carries on with the tags section unconsumed and the
profile then fails to unpack with -EPROTO.
Return 0 on success.
Cc: stable@vger.kernel.org
Fixes: 3d28e2397af7 ("apparmor: add support loading per permission tagging")
Signed-off-by: Cong Nguyen <congnt264@gmail.com>
Reviewed-by: Guicai Ma <maguicai@kylinos.cn>
Tested-by: Guicai Ma <maguicai@kylinos.cn>
---
Changes in v2:
- Add Cc: stable and Guicai Ma Reviewed-by and Tested-by tags.
- Say that the profile fails to unpack with -EPROTO instead of continuing without tags (Guicai Ma).
security/apparmor/policy_unpack.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/security/apparmor/policy_unpack.c b/security/apparmor/policy_unpack.c
index 24fbce2e4322..b6864757e6dd 100644
--- a/security/apparmor/policy_unpack.c
+++ b/security/apparmor/policy_unpack.c
@@ -841,7 +841,7 @@ static int unpack_tag_headers(struct aa_ext *e, struct aa_tags_struct *tags)
tags->hdrs.size = size;
tags->hdrs.table = hdrs;
AA_DEBUG(DEBUG_UNPACK, "headers %ld size %d", (long) hdrs, size);
- return true;
+ return 0;
fail:
kfree_sensitive(hdrs);
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-12-02 17:50 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-02 17:47 [PATCH v2] apparmor: return 0 from unpack_tag_headers() on success Cong Nguyen
2026-12-02 17:50 ` sashiko-bot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.