In Noble Ubuntu-6.8.0-64.67, the function selinux_dentry_init_security()
looks like this:

static int selinux_dentry_init_security(struct dentry *dentry, int mode,
                                        const struct qstr *name,
                                        const char **xattr_name,
                                        struct lsmcontext *cp)
{
        u32 newsid;
        int rc;

        rc = selinux_determine_inode_label(selinux_cred(current_cred()),
                                           d_inode(dentry->d_parent), name,
                                           inode_mode_to_security_class(mode),
                                           &newsid);
        if (rc)
                return rc;

        if (xattr_name)
                *xattr_name = XATTR_NAME_SELINUX;

        cp->id = LSM_ID_SELINUX;
        return security_sid_to_context(newsid, (char **)cp->context,
                                       &cp->len);
}

From your last comment I see that using the following patch completely
solves the problem:

diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index 35e763fa6aa5..98eacf8ce4a3 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -2909,8 +2909,7 @@ static int selinux_dentry_init_security(struct dentry 
*dentry, int mode,
                *xattr_name = XATTR_NAME_SELINUX;
 
        cp->id = LSM_ID_SELINUX;
-       return security_sid_to_context(newsid, (char **)cp->context,
-                                      &cp->len);
+       return security_sid_to_context(newsid, &cp->context, &cp->len);
 }
 
 static int selinux_dentry_create_files_as(struct dentry *dentry, int mode,

Am I right?

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2115447

Title:
  Ubuntu 24.04.2: NULL pointer dereference with Ceph and selinux

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/apparmor/+bug/2115447/+subscriptions


-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to