From: "Theodore Ts'o" <tytso@mit.edu>
To: Shreeya Patel <shreeya.patel@collabora.com>
Cc: viro@zeniv.linux.org.uk, adilger.kernel@dilger.ca,
krisman@collabora.com, linux-ext4@vger.kernel.org,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel@collabora.com
Subject: Re: [PATCH 2/2] fs: ext4: Fix the inconsistent name exposed by /proc/self/cwd
Date: Fri, 1 Oct 2021 14:41:31 -0400 [thread overview]
Message-ID: <YVdWW0uyRqYWSgVP@mit.edu> (raw)
In-Reply-To: <8402d1c99877a4fcb152de71005fa9cfb25d86a8.1632909358.git.shreeya.patel@collabora.com>
On Wed, Sep 29, 2021 at 04:23:39PM +0530, Shreeya Patel wrote:
> /proc/self/cwd is a symlink created by the kernel that uses whatever
> name the dentry has in the dcache. Since the dcache is populated only
> on the first lookup, with the string used in that lookup, cwd will
> have an unexpected case, depending on how the data was first looked-up
> in a case-insesitive filesystem.
>
> Steps to reproduce :-
>
> root@test-box:/src# mkdir insensitive/foo
> root@test-box:/src# cd insensitive/FOO
> root@test-box:/src/insensitive/FOO# ls -l /proc/self/cwd
> lrwxrwxrwx 1 root root /proc/self/cwd -> /src/insensitive/FOO
>
> root@test-box:/src/insensitive/FOO# cd ../fOo
> root@test-box:/src/insensitive/fOo# ls -l /proc/self/cwd
> lrwxrwxrwx 1 root root /proc/self/cwd -> /src/insensitive/FOO
>
> Above example shows that 'FOO' was the name used on first lookup here and
> it is stored in dcache instead of the original name 'foo'. This results
> in inconsistent name exposed by /proc/self/cwd since it uses the name
> stored in dcache.
>
> To avoid the above inconsistent name issue, handle the inexact-match string
> ( a string which is not a byte to byte match, but is an equivalent
> unicode string ) case in ext4_lookup which would store the original name
> in dcache using d_add_ci instead of the inexact-match string name.
I'm not sure this is a problem. /proc/<pid>/cwd just needs to point
at the current working directory for the process. Why do we care
whether it matches the case that was stored on disk? Whether we use
/src/insensitive/FOO, or /src/insensitive/Foo, or
/src/insensitive/foo, all of these will reach the cwd for that
process.
- Ted
next prev parent reply other threads:[~2021-10-01 18:42 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-29 10:53 [PATCH 0/2] Handle a soft hang and the inconsistent name issue Shreeya Patel
2021-09-29 10:53 ` [PATCH 1/2] fs: dcache: Handle case-exact lookup in d_alloc_parallel Shreeya Patel
2021-10-01 18:35 ` Gabriel Krisman Bertazi
2021-10-03 13:52 ` Al Viro
2021-10-03 13:38 ` Al Viro
2021-10-05 13:09 ` Shreeya Patel
2021-09-29 10:53 ` [PATCH 2/2] fs: ext4: Fix the inconsistent name exposed by /proc/self/cwd Shreeya Patel
2021-10-01 18:41 ` Theodore Ts'o [this message]
2021-10-01 19:11 ` Gabriel Krisman Bertazi
2021-10-02 1:21 ` Theodore Ts'o
2021-10-14 21:54 ` Gabriel Krisman Bertazi
2021-10-01 18:16 ` [PATCH 0/2] Handle a soft hang and the inconsistent name issue Gabriel Krisman Bertazi
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=YVdWW0uyRqYWSgVP@mit.edu \
--to=tytso@mit.edu \
--cc=adilger.kernel@dilger.ca \
--cc=kernel@collabora.com \
--cc=krisman@collabora.com \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=shreeya.patel@collabora.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;
as well as URLs for NNTP newsgroup(s).