Re: [PATCH v6 bpf-next 1/4] security: introduce struct lsm_xattrs

[email protected]
Newsgroups gmane.linux.kernel.lsm,gmane.linux.kernel.bpf,gmane.linux.file-systems,gmane.linux.kernel
Message-ID <d9951258c46ffe401f9f3aec54d442acbe2f791c9bc745783af1268f957e5272@mail.kernel.org>
> In preparation for bpf_init_inode_xattr(), a kfunc that lets bpf LSM
> programs atomically label new inodes, rework how inode_init_security
> xattrs are managed.
>
> inode_init_security receives the LSM xattr array and its count as
> separate parameters. For better compatibility with the bpf verifier,
> update inode_init_security and its callers to consolidate these
> parameters into a single context object: struct lsm_xattrs.

This isn't a bug, but could the changelog note the int -> unsigned int
change of the xattr count, since that is not just a parameter
consolidation?

The xattr count changes from int xattr_count in security_inode_init_security()
to unsigned int xattr_count in struct lsm_xattrs:

include/linux/security.h:
+struct lsm_xattrs {
+       struct xattr *xattrs;
+       unsigned int xattr_count;
+};

security/security.c:security_inode_init_security() {
-       int ret = -EOPNOTSUPP, xattr_count = 0;
+       struct lsm_xattrs xattrs = {};
+       int ret = -EOPNOTSUPP;

The cleanup loop changes accordingly:

-       for (; xattr_count > 0; xattr_count--)
+       for (; xattrs.xattr_count > 0; xattrs.xattr_count--)


---
AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md

CI run summary: https://github.com/kernel-patches/bpf/actions/runs/30592505811
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.