bug#80060: mv: move files across bind mounts using the rename syscall

Martin D Kealey <[email protected]> Mon, 29 Dec 2025 15:11:44 +1000
Newsgroups gmane.comp.gnu.core-utils.bugs
Message-ID <CAN_U6MU5sdSHJyF=KcBvJ0FGh0-2yU66zJhGTcrNeiLs4jrgOg@mail.gmail.com>
On Tue, 23 Dec 2025 at 10:08, Andrei Topala <[email protected]> wrote:

> mv already tries rename() first. The problem is that rename() returns
> EXDEV even when source and destination are on the same physical device but
> accessed through different bind mount points.
>

How does `mv` know that it's a problem, rather than working as intended by
the sysadmin?

One use-case for bind mounts is specifically to prevent `rename()` and/or
`link()` into or out of a directory, and defeating this could impact system
security.

-Martin