Linux Security Modules development
 help / color / mirror / Atom feed
From: Fan Wu <wufan@kernel.org>
To: Christian Brauner <brauner@kernel.org>,
	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
Subject: Re: [PATCH 08/13] ipe: handle errors from resolving the real inode
Date: Sun, 15 Nov 2026 13:00:55 -0800	[thread overview]
Message-ID: <4e9a39ac-9ad5-49d8-b0c4-09e665504609@kernel.org> (raw)
In-Reply-To: <20261115-work-ovl-d_real-v1-8-ca155efbcb2e@kernel.org>

On 11/15/2026 6:01 AM, Christian Brauner wrote:

...

> 
> diff --git a/security/ipe/eval.c b/security/ipe/eval.c
> index 4a7be96c84f03..3751963509df4 100644
> --- a/security/ipe/eval.c
> +++ b/security/ipe/eval.c
> @@ -102,7 +102,11 @@ 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);
> +		ino = d_real_data_inode(file->f_path.dentry);
> +		if (IS_ERR(ino)) {
> +			ctx->file_err = PTR_ERR(ino);
> +			return;
> +		}
>  		build_ipe_bdev_ctx(ctx, ino);
>  		build_ipe_inode_ctx(ctx, ino);


I think we only need to change this part like:

	/*
	 * 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);
	}


This also avoids the missing audit issue noted by the bpf bot, and we
don't need to add file_err to struct ipe_eval_ctx.

With the above change, feel free to add:

Acked-by: Fan Wu <wufan@kernel.org>

Fan

>  	}
> @@ -335,6 +339,15 @@ int ipe_evaluate_event(const struct ipe_eval_ctx *const ctx)
>  		return 0;
>  	}
>  
> +	/*
> +	 * Without the inode hosting the data none of the properties of the
> +	 * file can be evaluated. Refuse it unless IPE is permissive.
> +	 */
> +	if (ctx->file_err) {
> +		rcu_read_unlock();
> +		return READ_ONCE(enforce) ? -EACCES : 0;
> +	}
> +
>  	if (ctx->op == IPE_OP_INVALID) {
>  		if (pol->parsed->global_default_action == IPE_ACTION_INVALID) {
>  			WARN(1, "no default rule set for unknown op, ALLOW it");
> diff --git a/security/ipe/eval.h b/security/ipe/eval.h
> index b26d1147d0708..58ca50987b2b5 100644
> --- a/security/ipe/eval.h
> +++ b/security/ipe/eval.h
> @@ -42,6 +42,7 @@ struct ipe_eval_ctx {
>  	enum ipe_hook_type hook;
>  
>  	const struct file *file;
> +	int file_err;
>  	bool initramfs;
>  #ifdef CONFIG_IPE_PROP_DM_VERITY
>  	const struct ipe_bdev *ipe_bdev;
> 


  parent reply	other threads:[~2026-11-15 21:00 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-15 14:01 [PATCH 00/13] fs: let d_real() fail Christian Brauner
2026-11-15 14:01 ` [PATCH 01/13] ovl: don't warn when the lazy lowerdata lookup fails in ovl_d_real() Christian Brauner
2026-11-15 14:12   ` sashiko-bot
2026-11-15 14:54   ` Amir Goldstein
2026-11-15 14:01 ` [PATCH 02/13] fs: add d_real_data_inode() and d_real_metadata_inode() Christian Brauner
2026-11-15 14:05   ` sashiko-bot
2026-11-15 15:00   ` Amir Goldstein
2026-11-15 20:39     ` Christian Brauner
2026-11-15 14:01 ` [PATCH 03/13] tracing/uprobes: handle errors from resolving the real inode Christian Brauner
2026-11-15 14:07   ` sashiko-bot
2026-11-15 14:01 ` [PATCH 04/13] bpf: handle errors from resolving the real inode in uprobe_multi Christian Brauner
2026-11-15 14:06   ` sashiko-bot
2026-11-15 14:01 ` [PATCH 05/13] selftests/bpf: handle d_real_data_inode() errors in bpf_testmod Christian Brauner
2026-11-15 14:05   ` sashiko-bot
2026-11-15 14:01 ` [PATCH 06/13] ima: handle errors from resolving the real inode Christian Brauner
2026-11-15 14:10   ` sashiko-bot
2026-11-15 14:01 ` [PATCH 07/13] ima,evm: use d_real_metadata_inode() Christian Brauner
2026-11-15 14:05   ` sashiko-bot
2026-11-15 14:01 ` [PATCH 08/13] ipe: handle errors from resolving the real inode Christian Brauner
2026-11-15 14:07   ` sashiko-bot
2026-11-15 14:37   ` bot+bpf-ci
2026-11-15 21:00   ` Fan Wu [this message]
2026-11-15 14:01 ` [PATCH 09/13] bpf: return NULL from bpf_real_data_inode() on errors Christian Brauner
2026-11-15 14:08   ` sashiko-bot
2026-11-15 14:01 ` [PATCH 10/13] ovl: return the error from the lazy lowerdata lookup in ovl_d_real() Christian Brauner
2026-11-15 14:15   ` sashiko-bot
2026-11-15 14:47   ` Amir Goldstein
2026-11-15 14:01 ` [PATCH 11/13] fs: remove d_real_inode() Christian Brauner
2026-11-15 14:07   ` sashiko-bot
2026-11-15 14:48   ` Amir Goldstein
2026-11-15 14:01 ` [PATCH 12/13] selftests/ftrace: add uprobe tests on overlayfs Christian Brauner
2026-11-15 14:18   ` sashiko-bot
2026-11-15 14:01 ` [PATCH 13/13] selftests/bpf: add uprobe_multi test on overlayfs without data Christian Brauner
2026-11-15 14:12   ` sashiko-bot
2026-11-15 18:28 ` [PATCH 00/13] fs: let d_real() fail Alexei Starovoitov

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=4e9a39ac-9ad5-49d8-b0c4-09e665504609@kernel.org \
    --to=wufan@kernel.org \
    --cc=amir73il@gmail.com \
    --cc=bpf@vger.kernel.org \
    --cc=brauner@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 \
    /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