Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Potential issue with rename system call #170

Open
SleepyMug opened this issue Jul 23, 2024 · 0 comments
Open

Potential issue with rename system call #170

SleepyMug opened this issue Jul 23, 2024 · 0 comments

Comments

@SleepyMug
Copy link
Collaborator

SleepyMug commented Jul 23, 2024

If the command being run has rename in it, while the renaming target is an existing directory, try gives EXDEV (Invalid cross-device link)

Potentially related to redirect_dir feature (https://docs.kernel.org/filesystems/overlayfs.html#renaming-directories)

To recreate:

Create rename.c:

#include <stdio.h>
#include <unistd.h>

int main(void)
{
    int ret;
    ret = link("x", "y");
    printf("link ret=%d\n", ret);
    ret = unlink("x");
    printf("unlink ret=%d\n", ret);
}

Then do the following:

$ gcc rename.c -o rename
$ mkdir x
$ ./rename
rename: Success
$ rmdir y; mkdir x
$ try ./rename
rename: Invalid cross-device link
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant