Re: [PATCH 1/2] ext4: Handle casefolding with encryption
From: Theodore Ts'o
Date: Fri Feb 19 2021 - 10:22:57 EST
On Wed, Feb 17, 2021 at 03:48:39PM -0700, Andreas Dilger wrote:
> It would be possible to detect if the encrypted/casefold+dirdata
> variant is in use, because the dirdata variant would have the 0x40
> bit set in the file_type byte. It isn't possible to positively
> identify the "raw" non-dirdata variant, but the assumption would be
> if (rec_len >= round_up(name_len, 4) + 8) in an encrypted+casefold
> directory that the "raw" hash must be present in the dirent.
Consider a 4k directory directory block which has only three entries,
".", "..", and "a". The directory entry for "a" will have a rec_len
substantially larger than name_len.
Fortunatelly, the "raw" non-dirdata variant case easily can be
detected. If the directory has the encryption and casefold set, and
the 0x40 bit is not set, then raw must be present, assuming that the
directory block has not been corrupted (but if it's corrupted, all
bets are off).
- Ted