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

[BUG] fuse-overlayfs can be tricked to omit directories with same inode #359

Open
fancywins opened this issue Jun 30, 2022 · 0 comments
Open

Comments

@fancywins
Copy link

Reproduction

mkdir lower upper work merged
mkdir -p lower/a/b lower/b
mount -B lower/a/b lower/b
fuse-overlayfs -o lowerdir=lower,upperdir=upper,workdir=work merged
ls lower
>> a  b
ls merged
>> a

Expected result

merged should contain both directories.

The problem

When a new node has the same inode, this code checks if it's a directory, frees it if so, and returns the existing node:

fuse-overlayfs/main.c

Lines 1194 to 1206 in 84240e9

ino = hash_lookup (lo->inodes, &key);
if (ino)
{
struct ovl_node *it;
for (it = ino->node; it; it = it->next_link)
{
if (node_dirp (it) || strcmp (n->path, it->path) == 0)
{
node_free (n);
return it;
}
}

This is clearly way too dangerous. However, the problem goes away if the node_dirp (it) condition is removed.

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