Public bug reported:

Below code is failing while compiling with clang: 
static inline int ctnetlink_secctx_size(const struct nf_conn *ct)
{
#ifdef CONFIG_NF_CONNTRACK_SECMARK
        int len, ret;
            ^^^ <-- len is not initialized before use

        ret = security_secid_to_secctx(ct->secmark, NULL);
        if (ret < 0)
                return 0;

        return nla_total_size(0) /* CTA_SECCTX */
               + nla_total_size(sizeof(char) * len); /* CTA_SECCTX_NAME */
                                               ^^^ <-- len has not been 
initialized
#else
        return 0;
#endif
}

Looking into git history I realized that there an incomplete commit of
2d470c778120d3cdb8d8ab250329ca85f49f12b1 (lsm: replace context+len with
lsm_context) causing it:

commit c45f92d3c95e9a242c0b22e2f7f24e4f319391dd
Author: Casey Schaufler <[email protected]>
Date:   Tue Dec 12 14:21:57 2023 -0800

    UBUNTU: SAUCE: apparmor4.0.0 [17/90]: LSM stacking v39: LSM: Use
lsmcontext in security_secid_to_secctx

    BugLink: http://bugs.launchpad.net/bugs/2028253

** Affects: linux (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Kernel
Packages, which is subscribed to linux in Ubuntu.
https://bugs.launchpad.net/bugs/2120561

Title:
  Fix compilation failure because of incomplete backport

Status in linux package in Ubuntu:
  New

Bug description:
  Below code is failing while compiling with clang: 
  static inline int ctnetlink_secctx_size(const struct nf_conn *ct)
  {
  #ifdef CONFIG_NF_CONNTRACK_SECMARK
          int len, ret;
              ^^^ <-- len is not initialized before use

          ret = security_secid_to_secctx(ct->secmark, NULL);
          if (ret < 0)
                  return 0;

          return nla_total_size(0) /* CTA_SECCTX */
                 + nla_total_size(sizeof(char) * len); /* CTA_SECCTX_NAME */
                                                 ^^^ <-- len has not been 
initialized
  #else
          return 0;
  #endif
  }

  Looking into git history I realized that there an incomplete commit of
  2d470c778120d3cdb8d8ab250329ca85f49f12b1 (lsm: replace context+len
  with lsm_context) causing it:

  commit c45f92d3c95e9a242c0b22e2f7f24e4f319391dd
  Author: Casey Schaufler <[email protected]>
  Date:   Tue Dec 12 14:21:57 2023 -0800

      UBUNTU: SAUCE: apparmor4.0.0 [17/90]: LSM stacking v39: LSM: Use
  lsmcontext in security_secid_to_secctx

      BugLink: http://bugs.launchpad.net/bugs/2028253

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


-- 
Mailing list: https://launchpad.net/~kernel-packages
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~kernel-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to