From: sashiko-bot@kernel.org
To: "Anton Protopopov" <a.s.protopopov@gmail.com>, bpf@vger.kernel.org
Subject: Re: [PATCH v2 bpf-next 2/6] bpf: Don't allow the IMA helpers on inode_getxattr and inode_getattr
Date: Fri, 04 Dec 2026 16:07:11 +0000 [thread overview]
Message-ID: <sashiko-outbox-250158@kernel.org> (raw)
In-Reply-To: <20261204155438.1413411-3-a.s.protopopov@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] bpf: Fixes trailer cites 423f16108c9d instead of 27672f0d280a
--
commit 1530c83bfb984cb9b336b48e9f99703d6ca8c173
Author: Anton Protopopov <a.s.protopopov@gmail.com>
> bpf: Don't allow the IMA helpers on inode_getxattr and inode_getattr
>
> The bpf_ima_inode_hash() and bpf_ima_file_hash() helpers take
> iint->mutex in __ima_inode_hash(). IMA takes iint->mutex before the
> inode lock in process_measurement(). So a program which calls them
> with the inode locked can deadlock against a concurrent open of the
> file.
>
> The inode_getxattr and inode_getattr hooks are sometimes called with
> the inode locked. EVM reads xattrs with vfs_getxattr() to update
> security.evm from the post setxattr, removexattr and setattr hooks,
> which run with the inode locked. And nfsd_setattr() locks the inode
> before fh_fill_pre_attrs() calls vfs_getattr(). IMA also verifies
> security.evm with iint->mutex held and EVM reads the xattrs with
> vfs_getxattr(). So a program on inode_getxattr can wait for the mutex
> which its own task holds.
>
> The hooks can't go to d_inode_locked_hooks as most callers don't hold
> the lock. Don't allow the helpers on them.
>
> Fixes: 423f16108c9d ("bpf: Augment the set of sleepable LSM hooks")
> Signed-off-by: Anton Protopopov <a.s.protopopov@gmail.com>
[Severity: Low]
Commit 423f16108c9d ("bpf: Augment the set of sleepable LSM hooks") only
marked bpf_lsm_inode_getattr and bpf_lsm_inode_getxattr as sleepable, and
both remain sleepable after this patch. bpf_ima_inode_hash() and
bpf_ima_inode_hash_allowed() were introduced later. Should this use:
Fixes: 27672f0d280a ("bpf: Add a BPF helper for getting the IMA hash of an inode")
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261204155438.1413411-1-a.s.protopopov@gmail.com?part=2
next prev parent reply other threads:[~2026-12-04 16:07 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-04 15:54 [PATCH v2 bpf-next 0/6] bpf: Use the xattr kfuncs on six more inode hooks Anton Protopopov
2026-12-04 15:54 ` [PATCH v2 bpf-next 1/6] bpf: Add path_chmod and path_chown to d_inode_locked_hooks Anton Protopopov
2026-12-04 15:54 ` [PATCH v2 bpf-next 2/6] bpf: Don't allow the IMA helpers on inode_getxattr and inode_getattr Anton Protopopov
2026-12-04 16:07 ` sashiko-bot [this message]
2026-12-04 16:15 ` bot+bpf-ci
2026-12-04 15:54 ` [PATCH v2 bpf-next 3/6] bpf: Don't allow the IMA hash helpers on hooks with the inode locked Anton Protopopov
2026-12-04 16:15 ` bot+bpf-ci
2026-12-04 15:54 ` [PATCH v2 bpf-next 4/6] bpf: Let sleepable LSM programs attach to six more inode hooks Anton Protopopov
2026-12-04 16:13 ` sashiko-bot
2026-12-04 15:54 ` [PATCH v2 bpf-next 5/6] bpf: Add a bpf_get_inode_xattr kfunc Anton Protopopov
2026-12-04 15:54 ` [PATCH v2 bpf-next 6/6] selftests/bpf: Test xattr kfuncs on the new sleepable inode hooks Anton Protopopov
2026-12-04 16:09 ` sashiko-bot
2026-12-04 19:48 ` [PATCH v2 bpf-next 0/6] bpf: Use the xattr kfuncs on six more " Alexei Starovoitov
2026-12-04 19:59 ` Anton Protopopov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=sashiko-outbox-250158@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=a.s.protopopov@gmail.com \
--cc=bpf@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.