Received: by 2002:a05:6500:2018:b0:1fb:9675:f89d with SMTP id t24csp199467lqh; Thu, 30 May 2024 20:34:22 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUQjsatAm7O9HPAMajhsEAJMNLaEmtrfhFoRxmSMk6e+mVfgpwdNUeK+PG3ERMMH/2f5vBfJP3qtKkPInGqdD21B/OVLWC9vawbNA0iHA== X-Google-Smtp-Source: AGHT+IE3UWIG0V668j/rnS2O5pTfou4xGNbVd9dAlCmPF5b9qexIM286K7Y4+z/goyQ4VtoU3v6G X-Received: by 2002:a50:9e05:0:b0:57a:2400:3a56 with SMTP id 4fb4d7f45d1cf-57a3651f208mr509997a12.23.1717126462087; Thu, 30 May 2024 20:34:22 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717126462; cv=pass; d=google.com; s=arc-20160816; b=XM2AAZP42EsZqn7/kQehnuvhT7bRfD12cfElLjZSEi9dzlOYtPEHKDyGQXLX/KKlLr 08OUFgWviC/8rn8WfRnL4e4lHDFtVtx29pr7fSXtp+a9toM1xkS/YVg3HXRz5N/2Sk/R fb3MFQNhfCxC7u4UKFLSHRE26mTwQYPFBB6bL77F1k/A68pepPG+fziVSGX10byAga8A LEB0bvdk/XirRjdjRny4Q/nDPft820g/xmvO0YEqwmUszkgaIL+F5P8L+CXTLI5+zEqL SqZjIjyJMN4ZgHsoyoT7LiuP0Ja15VMieXEkXyoG64iiG+2rL3+gci+b+PaRhw5n7J6f Joxw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=N9R4KxU6QjQS1w4zIMvs95VqINrG90/MD3hSIn2E5Po=; fh=w6YjgRnnhzRVzd7zW7jIDlu4aPMRGknm2E2AIL1ML0E=; b=a07uw8jvdi+q1rPWa3cup1zUteQNY/u25LF/uGltEoixJaTL94OJ+azsY6AoZ/xEbG wosl9zy6dLENVrINPI/H/BAE7K5EmzyoadcM+8znQ0oqsbDiGxBPOj+17yRPZKFzCTYF g2hsKE0ZDVD5KpAucXkiBcYfWUIwVhXQcamjgTLAZf6gDX//+ZBf1U9RtA4FAR1AD/Yf z0YHCLxKO9PAibiSvGvMUfUmMuy++6o1MfIJYDtVz+UjD0Mq6YB3bGLQ5QcvOaLUcmvv n03HJ+KyB7gt7InCGzLmcoHoSXcarfO5SEUh7/0l45IwzCwk7YZHhoosuP4y/mcuXNXG xSrg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=e7TPyZul; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-ext4+bounces-2720-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-ext4+bounces-2720-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-57a31b80d8bsi480091a12.68.2024.05.30.20.34.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 May 2024 20:34:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4+bounces-2720-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=e7TPyZul; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-ext4+bounces-2720-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-ext4+bounces-2720-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id C5FDC1F22F86 for ; Fri, 31 May 2024 03:34:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3F4542C6AE; Fri, 31 May 2024 03:34:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="e7TPyZul" X-Original-To: linux-ext4@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AAA8117BD3; Fri, 31 May 2024 03:34:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717126450; cv=none; b=jiXCeex6GZqaISmj9LY1x090GMyL5PsldaYyzs7ZSnJaFBJ+tP75+LKO8+mPawbBOGqO4vjYszaJyLj9ZYQARSxr4IltSO2x+GP4uTY7t86NeR5egDa5KQzRhUABvmwaH7YAWOTiZuLxVmzcskUOrMTuuPm+nIqIm2HAZhljYv8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717126450; c=relaxed/simple; bh=3u7nFs7d4HvLaGyX2AAa6u8ILfNeeM5SXxP7Y7fcTw0=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=oPd9E5zdh/86ynK1+Ge/rWfAc3AJhCBgNJkY1lMT3Fbh+u6VULayJcyukJ0k2Tna8f1nbgDYn0FDMgtwqzVJmN9+uOyRli9ntibIs4rMsGSrs8ld/BDiimqWUXtt/bI8PziPrcG7mcYk5u2E4TVkBEXGKlG5nRZLOzGhghchJS8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=e7TPyZul; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 87CF5C116B1; Fri, 31 May 2024 03:34:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717126450; bh=3u7nFs7d4HvLaGyX2AAa6u8ILfNeeM5SXxP7Y7fcTw0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=e7TPyZulQF68qu2kcbiKP3Omea5+jtlpR9n0mHJDi04iWSEKdtKcBCajANyVJ2mNK 37VZJpYPbzSez15JeHPHQwQpdUZeeTGsDpw8MskX/B9wZYTOqk3DAos459wFZtGWvQ yIjkujAv2BLWLfbVConC0x83t4IVfKu5okXxr0h+tT0h7ENieOgKr61UidWWuchuk0 BJyba+harshSeaNvbV9XIR11yTau6Aefb4TN51ZHsgKHnBbtwqDUmqYw1D0sz/4fsX 6osORXhEUPpFJYx3i3PeChv0jNnTUY25tFH/wMyr6EZpImcvCFlgc276i2ZuRM6iMd 4I/oZE1lnE3rg== Date: Thu, 30 May 2024 20:34:07 -0700 From: Eric Biggers To: Lizhi Xu Cc: coreteam@netfilter.org, davem@davemloft.net, fw@strlen.de, jaegeuk@kernel.org, kadlec@netfilter.org, kuba@kernel.org, linux-fscrypt@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, netfilter-devel@vger.kernel.org, pablo@netfilter.org, syzbot+340581ba9dceb7e06fb3@syzkaller.appspotmail.com, syzkaller-bugs@googlegroups.com, tytso@mit.edu, adilger.kernel@dilger.ca, linux-ext4@vger.kernel.org Subject: Re: [PATCH V2] ext4: add casefolded feature check before setup encrypted info Message-ID: <20240531033407.GB6505@sol.localdomain> References: <20240531010513.GA9629@sol.localdomain> <20240531033044.1335098-1-lizhi.xu@windriver.com> Precedence: bulk X-Mailing-List: linux-ext4@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240531033044.1335098-1-lizhi.xu@windriver.com> On Fri, May 31, 2024 at 11:30:44AM +0800, 'Lizhi Xu' via syzkaller-bugs wrote: > On Thu, 30 May 2024 20:11:33 -0700, Eric Biggers wrote: > > > Due to the current file system not supporting the casefolded feature, only > > > i_crypt_info was initialized when creating encrypted information, without actually > > > setting the sighash. Therefore, when creating an inode, if the system does not > > > support the casefolded feature, encrypted information will not be created. > > > > > > Reported-by: syzbot+340581ba9dceb7e06fb3@syzkaller.appspotmail.com > > > Signed-off-by: Lizhi Xu > > > --- > > > fs/ext4/ialloc.c | 3 ++- > > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > > > diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c > > > index e9bbb1da2d0a..47b75589fdf4 100644 > > > --- a/fs/ext4/ialloc.c > > > +++ b/fs/ext4/ialloc.c > > > @@ -983,7 +983,8 @@ struct inode *__ext4_new_inode(struct mnt_idmap *idmap, > > > ei->i_projid = make_kprojid(&init_user_ns, EXT4_DEF_PROJID); > > > > > > if (!(i_flags & EXT4_EA_INODE_FL)) { > > > - err = fscrypt_prepare_new_inode(dir, inode, &encrypt); > > > + if (ext4_has_feature_casefold(inode->i_sb)) > > > + err = fscrypt_prepare_new_inode(dir, inode, &encrypt); > > > if (err) > > > goto out; > > > > No, this is not correct at all. This just disables encryption on filesystems > > with the casefold feature. > If filesystems not support casefold feature, Why do I need to setup encrypted > information when creating a directory? Can encrypted information not include *hash? Encryption is a separate feature. It is supported both with and without casefold. - Eric