mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Christian Brauner <brauner@kernel.org>
To: Anastasios Papagiannis <tasos.papagiannnis@gmail.com>
Cc: bpf@vger.kernel.org, linux-kernel@vger.kernel.org,
	 linux-fsdevel@vger.kernel.org, ast@kernel.org,
	daniel@iogearbox.net, andrii@kernel.org,  eddyz87@gmail.com,
	memxor@gmail.com, viro@zeniv.linux.org.uk, jack@suse.cz
Subject: Re: [PATCH vfs-7.5.bpf v2 1/3] bpf: Add bpf_path_getattr()
Date: Fri, 6 Nov 2026 09:36:24 +0100	[thread overview]
Message-ID: <20261106-nachjagen-kennt-wehmut-3fac7c2139cb@brauner> (raw)
In-Reply-To: <20261102104655.70901-2-tasos.papagiannnis@gmail.com>

On Mon, Nov 02, 2026 at 12:46:53PM +0200, Anastasios Papagiannis wrote:
> +	ret = vfs_getattr_nosec(path, &stat, request_mask, query_flags);

Hm, do_statx() filters both masks before they hit the filesystem and we
should do the same here:

	if (request_mask & STATX__RESERVED)
		return -EINVAL;
	if ((query_flags & AT_STATX_SYNC_TYPE) == AT_STATX_SYNC_TYPE)
		return -EINVAL;
	request_mask &= ~STATX_CHANGE_COOKIE;

STATX_CHANGE_COOKIE isn't innocous... It causes generic_fillattr() to
call inode_query_iversion() which sets I_VERSION_QUERIED and forces the
next change to bump i_version.

That's in-kernel only. A bpf program shouldn't be able to set it on
every inode it looks at.

> -/* Side-effecting kfuncs that stay exclusive to LSM programs. */
> +/* Kfuncs that stay exclusive to LSM programs. */
>  BTF_SET_START(bpf_fs_kfunc_lsm_only_ids)
> +BTF_ID(func, bpf_path_getattr)

I don't think this belongs here. The set exists so binfmt_misc
handlers can't modify filesystem state. bpf_path_getattr() doesn't
modify anything and the binfmt_misc match and load programs are
sleepable. So they can use it on bprm->file->f_path just like
bpf_path_d_path() and bpf_get_file_xattr(). I'd drop this.

-- 

  reply	other threads:[~2026-11-06  8:36 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-02 10:46 [PATCH vfs-7.5.bpf v2 0/3] " Anastasios Papagiannis
2026-11-02 10:46 ` [PATCH vfs-7.5.bpf v2 1/3] " Anastasios Papagiannis
2026-11-06  8:36   ` Christian Brauner [this message]
2026-11-06 10:38   ` Christian Brauner
2026-11-02 10:46 ` [PATCH vfs-7.5.bpf v2 2/3] docs/bpf: Document bpf_path_getattr() Anastasios Papagiannis
2026-11-02 10:46 ` [PATCH vfs-7.5.bpf v2 3/3] selftests/bpf: Test bpf_path_getattr() Anastasios Papagiannis
2026-11-02 22:49 ` [PATCH vfs-7.5.bpf v2 0/3] bpf: Add bpf_path_getattr() 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=20261106-nachjagen-kennt-wehmut-3fac7c2139cb@brauner \
    --to=brauner@kernel.org \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=jack@suse.cz \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=memxor@gmail.com \
    --cc=tasos.papagiannnis@gmail.com \
    --cc=viro@zeniv.linux.org.uk \
    /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

all inboxes | Powered by JetHome®