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

bot+bpf-ci at kernel.org bot+bpf-ci at kernel.org
Fri Jul 31 22:12:24 UTC 2026


> 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


More information about the Linux-security-module-archive mailing list