From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DC52EC433DB for ; Fri, 19 Feb 2021 15:22:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AECAF64DD3 for ; Fri, 19 Feb 2021 15:22:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229828AbhBSPWj (ORCPT ); Fri, 19 Feb 2021 10:22:39 -0500 Received: from outgoing-auth-1.mit.edu ([18.9.28.11]:54553 "EHLO outgoing.mit.edu" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S229527AbhBSPWh (ORCPT ); Fri, 19 Feb 2021 10:22:37 -0500 Received: from cwcc.thunk.org (pool-72-74-133-215.bstnma.fios.verizon.net [72.74.133.215]) (authenticated bits=0) (User authenticated as tytso@ATHENA.MIT.EDU) by outgoing.mit.edu (8.14.7/8.12.4) with ESMTP id 11JFLdRM016190 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 19 Feb 2021 10:21:40 -0500 Received: by cwcc.thunk.org (Postfix, from userid 15806) id A22D415C39E2; Fri, 19 Feb 2021 10:21:39 -0500 (EST) Date: Fri, 19 Feb 2021 10:21:39 -0500 From: "Theodore Ts'o" To: Andreas Dilger Cc: Daniel Rosenberg , Eric Biggers , Ext4 Developers List , Linux Kernel Mailing List , linux-fsdevel , Gabriel Krisman Bertazi , kernel-team@android.com, Paul Lawrence Subject: Re: [PATCH 1/2] ext4: Handle casefolding with encryption Message-ID: References: <20210203090745.4103054-2-drosen@google.com> <56BC7E2D-A303-45AE-93B6-D8921189F604@dilger.ca> <42511E9D-3786-4E70-B6BE-D7CB8F524912@dilger.ca> <01918C7B-9D9B-4BD8-8ED1-BA1CBF53CA95@dilger.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <01918C7B-9D9B-4BD8-8ED1-BA1CBF53CA95@dilger.ca> Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org 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