Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp8098828pxb; Fri, 19 Feb 2021 07:23:09 -0800 (PST) X-Google-Smtp-Source: ABdhPJzB2g9gxiHo96vQhK8ZBYw9rLPAqGOXpaEIRU79nIHzsSu9bV5wyRQN3MsmLZyvHXLO0nJx X-Received: by 2002:a17:907:3e26:: with SMTP id hp38mr9288405ejc.459.1613748189563; Fri, 19 Feb 2021 07:23:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613748189; cv=none; d=google.com; s=arc-20160816; b=VpUuyG9IT72HTSNtwBlwVeK3GI+HbyU5H67NQNVn+PM+w9hm1z1590GBXKcaf7rTgY RyO94ekL6zdlmS+Wjxem4fzq9flcmqSO8fgUftpo6wUfqE41Cj41EDSnPtSd20wDMirW sFtyBrMlWPD8g8NupbAbfQM4Kxj6xUc8jLhyLi1Vkt/nAXUYJ7eMgpD9H6rNA55UDAgN G2Ena6L4zCbkyH81a41yjDphnUCk2IpoJkGPQtzx8hx/y/uD+eTJ/V0qDtT3FkYXt66d O0ICYSWg5CHqGREG9MNLvB7db5qbyKBqAOLojN3oZ80Fv3fNl2V7+OHVXqw6auQpPdVO kVPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=GCsR7LmfiIE4Izr6QrgEWxfNTni5l84yj9YSXJ5ojbA=; b=X3iuJJCIqvSGaxjLpIwseqzBnnd0onF3SanuEni3VMEvCBvBAjm4x598W90JrBLWIz mQPa7TlxCNcuB7WHdZNrwwrz6bzk6qFQgJ5XlSkVNqs9Xd0s9OLmfIoIDI0GrQqUx2o8 1GiDWdVg0R8qwLbmSn6mm8qJmiIrkl5EEoiQhOuTXz0asHDfloTVZjHrM+f7ctvOXXYq SPQVvS/vC/wpQpozuNWfA3YPgFdGR+V00lKneawsSXUuK0DBzbkPOC1cUSuhDAMmYoha M6cDidoMnyT2QKGD6rwh34noW1mwvwkJAnQqAjiai4bxnFIOaefBcsdht8056cdAGez/ 3y2w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z9si6512354edb.204.2021.02.19.07.22.39; Fri, 19 Feb 2021 07:23:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229803AbhBSPWi (ORCPT + 99 others); Fri, 19 Feb 2021 10:22:38 -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-ext4@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