From: Christian Brauner <brauner@kernel.org>
To: Amir Goldstein <amir73il@gmail.com>, linux-fsdevel@vger.kernel.org
Cc: Chris Down <chris@chrisdown.name>,
Miklos Szeredi <mszeredi@redhat.com>,
linux-unionfs@vger.kernel.org, linux-kernel@vger.kernel.org,
bpf@vger.kernel.org, linux-trace-kernel@vger.kernel.org,
linux-integrity@vger.kernel.org,
linux-security-module@vger.kernel.org, linux-mm@kvack.org,
"Christian Brauner (Amutable)" <brauner@kernel.org>,
Fan Wu <wufan@kernel.org>
Subject: [PATCH v2 08/13] ipe: handle errors from resolving the real inode
Date: Mon, 16 Nov 2026 10:44:05 +0100 [thread overview]
Message-ID: <20261116-work-ovl-d_real-v2-8-90564c4ae347@kernel.org> (raw)
In-Reply-To: <20261116-work-ovl-d_real-v2-0-90564c4ae347@kernel.org>
d_real() is about to be able to fail for D_REAL_DATA. So switch
ipe_build_eval_ctx() from d_real_inode() to d_real_data_inode() and deal
with the error.
Currently, if overlayfs fails to resolve the data of a file it hands
back the overlayfs inode and IPE evaluates the policy against that. The
overlayfs inode has neither a block device nor any fs-verity state so
none of the properties of the file hosting the data are visible.
Instead, leave the block device and inode state of the evaluation
context unset if the data can't be resolved so the file is evaluated
without any dm-verity or fs-verity state. IOW, IPE reaches the same
verdict as today but without looking at the overlayfs inode.
This is a no-op until d_real() can actually fail.
Suggested-by: Fan Wu <wufan@kernel.org>
Link: https://lore.kernel.org/all/4e9a39ac-9ad5-49d8-b0c4-09e665504609@kernel.org
Acked-by: Fan Wu <wufan@kernel.org>
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
---
security/ipe/eval.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/security/ipe/eval.c b/security/ipe/eval.c
index 4a7be96c84f03..a2366eb9a47b3 100644
--- a/security/ipe/eval.c
+++ b/security/ipe/eval.c
@@ -102,9 +102,16 @@ void ipe_build_eval_ctx(struct ipe_eval_ctx *ctx,
if (file) {
build_ipe_sb_ctx(ctx, file);
- ino = d_real_inode(file->f_path.dentry);
- build_ipe_bdev_ctx(ctx, ino);
- build_ipe_inode_ctx(ctx, ino);
+ /*
+ * If the real data inode cannot be resolved, leave the bdev
+ * and inode fields unset so the file is evaluated without
+ * dm-verity/fs-verity state.
+ */
+ ino = d_real_data_inode(file->f_path.dentry);
+ if (!IS_ERR(ino)) {
+ build_ipe_bdev_ctx(ctx, ino);
+ build_ipe_inode_ctx(ctx, ino);
+ }
}
}
--
2.53.0
next prev parent reply other threads:[~2026-11-16 9:45 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-16 9:43 [PATCH v2 00/13] fs: let d_real() fail Christian Brauner
2026-11-16 9:43 ` [PATCH v2 01/13] ovl: don't warn when the lazy lowerdata lookup fails in ovl_d_real() Christian Brauner
2026-11-16 9:49 ` sashiko-bot
2026-11-16 9:43 ` [PATCH v2 02/13] fs: add d_real_data_inode() and d_real_metadata_inode() Christian Brauner
2026-11-16 9:49 ` sashiko-bot
2026-11-16 9:44 ` [PATCH v2 03/13] tracing/uprobes: handle errors from resolving the real inode Christian Brauner
2026-11-16 9:53 ` sashiko-bot
2026-11-16 9:44 ` [PATCH v2 04/13] bpf: handle errors from resolving the real inode in uprobe_multi Christian Brauner
2026-11-16 9:49 ` sashiko-bot
2026-11-16 9:44 ` [PATCH v2 05/13] selftests/bpf: handle d_real_data_inode() errors in bpf_testmod Christian Brauner
2026-11-16 9:49 ` sashiko-bot
2026-11-16 9:44 ` [PATCH v2 06/13] ima: handle errors from resolving the real inode Christian Brauner
2026-11-16 9:53 ` sashiko-bot
2026-11-16 9:44 ` [PATCH v2 07/13] ima,evm: use d_real_metadata_inode() Christian Brauner
2026-11-16 9:52 ` sashiko-bot
2026-11-16 9:44 ` Christian Brauner [this message]
2026-11-16 9:49 ` [PATCH v2 08/13] ipe: handle errors from resolving the real inode sashiko-bot
2026-11-16 9:44 ` [PATCH v2 09/13] bpf: return NULL from bpf_real_data_inode() on errors Christian Brauner
2026-11-16 9:51 ` sashiko-bot
2026-11-16 9:44 ` [PATCH v2 10/13] ovl: return the error from the lazy lowerdata lookup in ovl_d_real() Christian Brauner
2026-11-16 9:58 ` sashiko-bot
2026-11-16 9:44 ` [PATCH v2 11/13] fs: remove d_real_inode() Christian Brauner
2026-11-16 9:50 ` sashiko-bot
2026-11-16 9:44 ` [PATCH v2 12/13] selftests/ftrace: add uprobe tests on overlayfs Christian Brauner
2026-11-16 9:53 ` sashiko-bot
2026-11-16 9:44 ` [PATCH v2 13/13] selftests/bpf: add uprobe_multi test on overlayfs without data Christian Brauner
2026-11-16 9:53 ` sashiko-bot
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=20261116-work-ovl-d_real-v2-8-90564c4ae347@kernel.org \
--to=brauner@kernel.org \
--cc=amir73il@gmail.com \
--cc=bpf@vger.kernel.org \
--cc=chris@chrisdown.name \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-integrity@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-security-module@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=linux-unionfs@vger.kernel.org \
--cc=mszeredi@redhat.com \
--cc=wufan@kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox