From: Al Viro <viro@zeniv.linux.org.uk>
To: Amir Goldstein <amir73il@gmail.com>
Cc: Christian Brauner <brauner@kernel.org>,
Miklos Szeredi <miklos@szeredi.hu>,
Paul Moore <paul@paul-moore.com>,
James Morris <jmorris@namei.org>,
"Serge E . Hallyn" <serge@hallyn.com>,
Mimi Zohar <zohar@linux.ibm.com>,
linux-security-module@vger.kernel.org,
linux-integrity@vger.kernel.org, linux-unionfs@vger.kernel.org,
linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH v2 1/3] fs: get mnt_writers count for an open backing file's real path
Date: Mon, 9 Oct 2023 07:43:30 +0100 [thread overview]
Message-ID: <20231009064330.GF800259@ZenIV> (raw)
In-Reply-To: <20231007084433.1417887-2-amir73il@gmail.com>
On Sat, Oct 07, 2023 at 11:44:31AM +0300, Amir Goldstein wrote:
> +static inline void file_put_write_access(struct file *file)
> +{
> + put_write_access(file->f_inode);
> + mnt_put_write_access(file->f_path.mnt);
> + if (unlikely(file->f_mode & FMODE_BACKING)) {
> + struct path *real_path = backing_file_real_path(file);
> +
> + if (real_path->mnt)
> + mnt_put_write_access(real_path->mnt);
IDGI. Where do we get FMODE_BACKING combined with NULL real_path.mnt *AND*
put_file_access() possibly called? Or file_get_write_access(), for
that matter...
FMODE_BACKING is set only in alloc_empty_backing_file(). The only caller
is backing_file_open(), which immediately sets real_path to its third
argument. That could only come from ovl_open_realfile(). And if that
had been called with buggered struct path, it would have already blown
up on mnt_idmap(realpath->mnt).
The only interval where such beasts exist is from
ff->file.f_mode |= FMODE_BACKING | FMODE_NOACCOUNT;
return &ff->file;
in alloc_empty_backing_file() through
f->f_path = *path;
path_get(real_path);
*backing_file_real_path(f) = *real_path;
in backing_file_open(). Where would that struct file (just allocated,
never seen outside of local variables in those two scopes) be passed
to get_file_write_access() or put_file_access()?
Or am I misreading something?
next prev parent reply other threads:[~2023-10-09 6:43 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-07 8:44 [PATCH v2 0/3] Reduce impact of overlayfs backing files fake path Amir Goldstein
2023-10-07 8:44 ` [PATCH v2 1/3] fs: get mnt_writers count for an open backing file's real path Amir Goldstein
2023-10-09 6:43 ` Al Viro [this message]
2023-10-09 8:03 ` Amir Goldstein
2023-10-07 8:44 ` [PATCH v2 2/3] fs: create helper file_user_path() for user displayed mapped file path Amir Goldstein
2023-10-09 7:00 ` Al Viro
2023-10-09 7:51 ` Amir Goldstein
2023-10-07 8:44 ` [PATCH v2 3/3] fs: store real path instead of fake path in backing file f_path Amir Goldstein
2023-10-09 7:48 ` Al Viro
2023-10-09 8:25 ` Amir Goldstein
2023-10-09 18:53 ` Al Viro
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=20231009064330.GF800259@ZenIV \
--to=viro@zeniv.linux.org.uk \
--cc=amir73il@gmail.com \
--cc=brauner@kernel.org \
--cc=jmorris@namei.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-integrity@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=linux-unionfs@vger.kernel.org \
--cc=miklos@szeredi.hu \
--cc=paul@paul-moore.com \
--cc=serge@hallyn.com \
--cc=zohar@linux.ibm.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;
as well as URLs for NNTP newsgroup(s).