[DragonFlyBSD - Bug #3316] (New) hammer2_dirent_create() allows creating >1 dirents with the same name

bugtracker-admin at leaf.dragonflybsd.org bugtracker-admin at leaf.dragonflybsd.org
Sun Jun 5 07:14:55 PDT 2022


Issue #3316 has been reported by tkusumi.

----------------------------------------
Bug #3316: hammer2_dirent_create() allows creating >1 dirents with the same name
http://bugs.dragonflybsd.org/issues/3316

* Author: tkusumi
* Status: New
* Priority: Normal
* Target version: 6.4
* Start date: 2022-06-05
----------------------------------------
When creating a file/directory in HAMMER2, hammer2_dirent_create() scans lhc of a given name if a chain or ondisk blockref already exists. If it exists, the function assigns a different (incremented) lhc value. This ends up allowing two or more inodes with the same dirent name under the same directory.

Note that some (or many) filesystem implementation scans its parent directory contents and return EEXIST if the same name already exists.

In reality, VFS prevents this via name lookup and returns EEXIST before it reaches there. But if a program runs HAMMER2 without VFS on top of it, namely makefs(8), this can not be prevented.

In fact below diff creates an image containing two entities (different inode#, different blockref key, but same name and data) of each regular file in the source directory.
https://leaf.dragonflybsd.org/~tkusumi/diff/makefs_hammer2_dup_regfile.patch



-- 
You have received this notification because you have either subscribed to it, or are involved in it.
To change your notification preferences, please click here: http://bugs.dragonflybsd.org/my/account



More information about the Bugs mailing list