public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
* fscrypt: Howto resolve hash collisions?
@ 2016-10-05 14:00 Richard Weinberger
  2016-10-05 15:45 ` Theodore Ts'o
  0 siblings, 1 reply; 4+ messages in thread
From: Richard Weinberger @ 2016-10-05 14:00 UTC (permalink / raw)
  To: linux-fsdevel, linux-ext4; +Cc: Theodore Ts'o, Eric Biggers, David Gstir

Hi!

UBIFS uses the r5 hash algorithm for filenames and is able to resolve hash collisions.
Unless I miss something it is not possible to resolve hash collisions for bignames
in fscrypto.

UBIFS does in readdir():
fscrypt_fname_disk_to_usr(dir, key_hash_flash(c, &dent->key), 0, &nm.disk_name, &fstr);

Hence, it feeds its filename hash to fscrypto and when no key is present fscrypto
encodes that hash into a bigname starting with "_".
minor_hash is not set because UBIFS's hash has only 32bits.

Upon lookup UBIFS does:
fscrypt_setup_filename(dir, &dentry->d_name, 1, &nm);

For small names nm will contain the decoded name, UBIFS will compute the r5 hash,
does a lookup and compares whether the found directory entry matches the name.
It not, it will resolve the collision.
On the other hand, with bignames, nm will only contain hash and minor_hash.
UBIFS can do a lookup based on the hash value but it has no way to detect nor resolve
the collision since no name is present.

What do I miss? Are ext4 and f2fs not able to resolve hash collisions and therefore
nobody noticed?

Thanks,
//richard

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

end of thread, other threads:[~2016-10-08 23:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-05 14:00 fscrypt: Howto resolve hash collisions? Richard Weinberger
2016-10-05 15:45 ` Theodore Ts'o
2016-10-08 14:33   ` Richard Weinberger
2016-10-08 20:46     ` Theodore Ts'o

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox