From: Miklos Szeredi <miklos@szeredi.hu>
To: "André Almeida" <andrealmeid@igalia.com>
Cc: Amir Goldstein <amir73il@gmail.com>,
linux-unionfs@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel-dev@igalia.com, John Schoenick <johns@valvesoftware.com>
Subject: Re: [PATCH] ovl: Fix nested backing file paths
Date: Wed, 30 Apr 2025 11:08:06 +0200 [thread overview]
Message-ID: <CAJfpegv=CFjkAXLM26vFc0prGJ18aVeO3j_0LQSh290DQZn_+g@mail.gmail.com> (raw)
In-Reply-To: <20250429183850.211682-1-andrealmeid@igalia.com>
On Tue, 29 Apr 2025 at 20:39, André Almeida <andrealmeid@igalia.com> wrote:
>
> When the lowerdir of an overlayfs is a merged directory of another
> overlayfs, ovl_open_realfile() will fail to open the real file and point
> to a lower dentry copy, without the proper parent path. After this,
> d_path() will then display the path incorrectly as if the file is placed
> in the root directory.
>
> This bug can be triggered with the following setup:
>
> mkdir -p ovl-A/lower ovl-A/upper ovl-A/merge ovl-A/work
> mkdir -p ovl-B/upper ovl-B/merge ovl-B/work
>
> cp /bin/cat ovl-A/lower/
>
> mount -t overlay overlay -o \
> lowerdir=ovl-A/lower,upperdir=ovl-A/upper,workdir=ovl-A/work \
> ovl-A/merge
>
> mount -t overlay overlay -o \
> lowerdir=ovl-A/merge,upperdir=ovl-B/upper,workdir=ovl-B/work \
> ovl-B/merge
>
> ovl-A/merge/cat /proc/self/maps | grep --color cat
> ovl-B/merge/cat /proc/self/maps | grep --color cat
>
> The first cat will correctly show `/ovl-A/merge/cat`, while the second
> one shows just `/cat`.
>
> To fix that, uses file_user_path() inside of backing_file_open() to get
> the correct file path for the dentry.
>
> Co-developed-by: John Schoenick <johns@valvesoftware.com>
> Signed-off-by: John Schoenick <johns@valvesoftware.com>
> Signed-off-by: André Almeida <andrealmeid@igalia.com>
Perfect, thanks!
Added these:
Fixes: def3ae83da02 ("fs: store real path instead of fake path in
backing file f_path")
Cc: <stable@vger.kernel.org> # v6.7
and pushed to ovl-next.
Thanks,
Miklos
prev parent reply other threads:[~2025-04-30 9:08 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-29 18:38 [PATCH] ovl: Fix nested backing file paths André Almeida
2025-04-30 9:08 ` Miklos Szeredi [this message]
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='CAJfpegv=CFjkAXLM26vFc0prGJ18aVeO3j_0LQSh290DQZn_+g@mail.gmail.com' \
--to=miklos@szeredi.hu \
--cc=amir73il@gmail.com \
--cc=andrealmeid@igalia.com \
--cc=johns@valvesoftware.com \
--cc=kernel-dev@igalia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-unionfs@vger.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;
as well as URLs for NNTP newsgroup(s).