[PATCH 02/13] fs: add d_real_data_inode() and d_real_metadata_inode()

sashiko-bot at kernel.org sashiko-bot at kernel.org
Sun Nov 15 14:05:47 UTC 2026


> Currently, d_real() can't fail. When overlayfs fails to look up the data
> of a metacopy file in a data-only layer it hands back the overlayfs
> dentry and callers silently work with the overlayfs inode. That's more
> problematic than current callers realize.
> 
> For trace_uprobe and bpf's uprobe_multi it means uprobe_register() fails
> with an -EIO that has nothing to do with the actual problem. For IMA it
> means the stacked change detection is skipped and for IPE the file is
> evaluated against an inode that has none of the properties of the real
> file.
> 
> Teach d_real() to fail and teach all callers to handle errors. This adds
> two helpers for the callers to switch over to:
> 
> - d_real_data_inode() returns the inode hosting the data or an ERR_PTR()
>   if that can't be resolved.
> 
> - d_real_metadata_inode() returns the inode hosting the metadata. It
>   never has to look anything up and so never fails (but no promises for
>   the future).
> 
> d_real() can't fail yet so this is a pure preparation. d_real_inode()
> stays around until all callers are converted.
> 
> No functional changes.
> 
> Suggested-by: Amir Goldstein <amir73il at gmail.com>
> Link: https://lore.kernel.org/all/CAOQ4uxhGxpBtMZ5kfuzR1tQAewiecoX7UjXQRo91QjJHH9T_Yw@mail.gmail.com
> Signed-off-by: Christian Brauner (Amutable) <brauner at kernel.org>

Sashiko has reviewed this patch and found no issues.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261115-work-ovl-d_real-v1-0-ca155efbcb2e@kernel.org?part=2




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