linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [Question] Unlinking original file of bind mounted file.
@ 2022-12-30  8:08 Yun Levi
  2022-12-30 10:58 ` Matthew Wilcox
  0 siblings, 1 reply; 7+ messages in thread
From: Yun Levi @ 2022-12-30  8:08 UTC (permalink / raw)
  To: linux-fsdevel

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-12-31  4:35 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-30  8:08 [Question] Unlinking original file of bind mounted file Yun Levi
2022-12-30 10:58 ` 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

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).