[apparmor] Fwd: what's going on with aa_destroy_aafs() call in apparmor_init()?

Ryan Lee ryan.lee at canonical.com
Mon Sep 22 16:14:14 UTC 2025


---------- Forwarded message ---------
From: Al Viro <viro at zeniv.linux.org.uk>
Date: Sun, Sep 21, 2025 at 12:37 AM
Subject: what's going on with aa_destroy_aafs() call in apparmor_init()?
To: John Johansen <john at apparmor.net>
Cc: <linux-fsdevel at vger.kernel.org>, <linux-security-module at vger.kernel.org>


        Correct me if I'm wrong, but as far as I can tell apparmor_init()
ends up being called from security_init(), which is called before the call
of vfs_caches_init(), not to mention fs_initcall stuff.

        If that's the case, what is this doing there?
error:
        aa_destroy_aafs();
        AA_ERROR("Error creating AppArmor securityfs\n");
        return error;

aa_create_aafs() is called via fs_initcall; moreover, it will bail out
if called before apparmor_initialized has become true, so...

While we are at it, what will happen if apparmor_init() succeeds, but
aa_create_fs() fails afterwards?

If nothing else, aa_null_path will be left {NULL, NULL}, which will
immediately oops dentry_open() in aa_inherit_files()...



More information about the AppArmor mailing list