linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yun Levi <ppbuk5246@gmail.com>
To: linux-fsdevel@vger.kernel.org
Subject: [Question] Unlinking original file of bind mounted file.
Date: Fri, 30 Dec 2022 17:08:31 +0900	[thread overview]
Message-ID: <CAM7-yPQOZx85f3KxKO1feSPcwYTZGRNNVEgqn4D_+nhhXvqQzQ@mail.gmail.com> (raw)

Hello fs-devel folks,

I have a few questions about below situation's handling.

======================================================
1. mount --bind {somefile} {target}
2. rm -f {somefile}
=======================================================

when it happens, the step (2)'s operation is working -- it removes.
But, the inode of {somefile} is live with i_nlink = 0 with an orphan
state of ext4_inode_info in ext4-fs.

IIUC, because ext4-inode-entry is removed in the disk via ext4_unlink,
and it seems possible
the inode_entry which is freed by unlink in step(2) will be used again
when a new file is created.

Suggest new created file which recycled the inode_entry unlinked by step(2).
and bind mounted-file is live.
In that situation, it seems that  via bind mount-file, it can
manipulate the data of the newly created file and access it
arbitrarily.

I don't know if it's right  to allow access to the removed file via
binded-file and it's the spec of filesystems or designed action by
ext4 filesystem only.

Thanks.

-- 
Best regards,
Levi

             reply	other threads:[~2022-12-30  8:08 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-30  8:08 Yun Levi [this message]
2022-12-30 10:58 ` [Question] Unlinking original file of bind mounted file Matthew Wilcox
     [not found]   ` <CAM7-yPROANYjeGn3ECfqmn0sLzEQPUpzCyU5zSN3-mJv3UA4CA@mail.gmail.com>
2022-12-30 11:16     ` Fwd: " Yun Levi
2022-12-30 21:51       ` Eric Biggers
2022-12-30 22:58         ` Yun Levi
2022-12-30 23:05           ` Eric Biggers
2022-12-31  4:35             ` Yun Levi

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=CAM7-yPQOZx85f3KxKO1feSPcwYTZGRNNVEgqn4D_+nhhXvqQzQ@mail.gmail.com \
    --to=ppbuk5246@gmail.com \
    --cc=linux-fsdevel@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).