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=-9.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 14588C388F9 for ; Thu, 12 Nov 2020 02:41:23 +0000 (UTC) Received: from lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 43A2A20709; Thu, 12 Nov 2020 02:41:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=lists.sourceforge.net header.i=@lists.sourceforge.net header.b="guSQesIc"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=sourceforge.net header.i=@sourceforge.net header.b="kL9S5KWT"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=sf.net header.i=@sf.net header.b="lpRlvXYo"; dkim=neutral (0-bit key) header.d=google.com header.i=@google.com header.b="HsIKmy2m" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 43A2A20709 Authentication-Results: mail.kernel.org; dmarc=pass (p=none dis=none) header.from=lists.sourceforge.net Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linux-f2fs-devel-bounces@lists.sourceforge.net DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.sourceforge.net; s=beta; h=Content-Transfer-Encoding:Content-Type:Cc: Reply-To:From:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:Subject:In-Reply-To:MIME-Version:References: Message-ID:To:Date:Sender:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=LPzAWeKQV6dBkuDmw4hZlIrh2hKPpJOKhELuv37A9Ss=; b=guSQesIcpBmMzpsaYVtrJRnap TTM3FyT0kuuqmZ7n6yAhMcyv/GmeK4XxSgjA/w0wks42/OXAnp+Cgz4OwICVp+joTslvy4IQVu5fo 7of9B6MZGs8NEBlsXsNgR8wcy3/+UaJUeZjL62G+j2Lp3ifzkb5gCBq4F4Ii+K6F5D6xI=; Received: from [127.0.0.1] (helo=sfs-ml-1.v29.lw.sourceforge.com) by sfs-ml-1.v29.lw.sourceforge.com with esmtp (Exim 4.90_1) (envelope-from ) id 1kd2Y1-0005ku-AX; Thu, 12 Nov 2020 02:41:17 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-1.v29.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kd2Y0-0005kl-Vc for linux-f2fs-devel@lists.sourceforge.net; Thu, 12 Nov 2020 02:41:17 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=In-Reply-To:Content-Type:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=TPVBYTjJe0hHmPnczFzGKQ6IA34dXAh8mCwAyisyNuc=; b=kL9S5KWTD8ybtiWS8NleqguEcP /LVdHvpc6XIgS/Ls0K8/Nq+BbVNFuwrM80lDSFIu1BRJugxa22r8wrI6dppgkU4gUhCdpOiH6IqqU 2BVTLLr7Jc/0l94Egb++Vj65RAk+U2CjyDLnGosbn1e92rhnOAUtbbd7+rfbWr8wSgio=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To :From:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=TPVBYTjJe0hHmPnczFzGKQ6IA34dXAh8mCwAyisyNuc=; b=lpRlvXYoMAUQZ9HSn0xzeGBrN2 +hZ4/NebvtiD2tbXFezcR/9JC/Sr+1k5Q6bRpjE/a5SZ+vjmrUJN4FQOsYL7wIATgZRZDzYkfDOWd b0AolVEIhfuqmlghWfUWW+ly4ue+6YeBJVZSdAAPuuCi3dL9f7scUJPOFSP5Cpq3taPE=; Received: from mail-pf1-f193.google.com ([209.85.210.193]) by sfi-mx-1.v28.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.92.2) id 1kd2Xq-00HayK-2O for linux-f2fs-devel@lists.sourceforge.net; Thu, 12 Nov 2020 02:41:16 +0000 Received: by mail-pf1-f193.google.com with SMTP id c66so3136359pfa.4 for ; Wed, 11 Nov 2020 18:41:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=TPVBYTjJe0hHmPnczFzGKQ6IA34dXAh8mCwAyisyNuc=; b=HsIKmy2mHTXPwQWLxT4t4wMTLWDqRF5L0W6i0qLwHTLP0BTicyOwRlVS/u3RGVkS3C RJu4DtUK8Lh1VeQ0Fs8R5cbJEOb/KIkknyTWSIlbVMHhwEeu7GDekDQ/SV18yfChQ43u f5vBpgZwYvIZXfftSHO6UNWQ2nO1I3Cblgwuwic4geXh3UcAEcVGpwC88AbQgivqgoih 5Qk4grVFGf2rvo2ZlDamtz3W2G2rSwLcQNC+AHJ4Ef7IfjYB5tNvaoZKN+2kjzfT9PFn e5JMHTGUxFXQH+qS5+PJ/EIdj0wMijhOFFGs6yDsANBc0YNo66B2zmJuqpMIiwdoAcWL a3wA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=TPVBYTjJe0hHmPnczFzGKQ6IA34dXAh8mCwAyisyNuc=; b=onI4NS0+9CSOQtOXeVMLiFuL0y1xc5giJFriFtKPQRdUOBis6U2+DIqTI/GPu33S4U mBxGAt1Bbz7eRoEqe/VyMWhjJWVu3NrI+c1lDoQHL/dlDlw22me148NupHwLYzACks/+ FlKa7yhZ81PS0/pyj70JHg/mi43n3xT8KoS2Yv5IHFYLrMxpK1boSZVkhkEMeeBFftjm PYfKS0x8veyBLLnj8VFXhnJBJ/yAq5zGpS0T+bCcrY8mGfhjzhndAmsNJpqngYLJRLvC 6EarWyA5ftDxi46USDOd1k04Swy1brX0G/cVIXDa6ik2lnsdJcWvekL9uScHHXS10Lqn 2dzA== X-Gm-Message-State: AOAM530qK74jTcNzlm+99lWLnObX5LUzlQ5U2wjeDdfW3tId++qyTO0h tpxgp5XBxT7rUwjbglbOM1aERA== X-Google-Smtp-Source: ABdhPJxyWqEnhtC2yWsqGmtNX7PfX0PEmHE0bU42jkynWKfam4h3j/TgIeVQcJC3A4TtJNl389fptg== X-Received: by 2002:a62:2cc1:0:b029:18c:85f5:864b with SMTP id s184-20020a622cc10000b029018c85f5864bmr502272pfs.29.1605148859471; Wed, 11 Nov 2020 18:40:59 -0800 (PST) Received: from google.com (154.137.233.35.bc.googleusercontent.com. [35.233.137.154]) by smtp.gmail.com with ESMTPSA id p4sm3814925pjo.6.2020.11.11.18.40.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Nov 2020 18:40:58 -0800 (PST) Date: Thu, 12 Nov 2020 02:40:54 +0000 To: Eric Biggers Message-ID: <20201112024054.GA4042272@google.com> References: <20201111015224.303073-1-ebiggers@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20201111015224.303073-1-ebiggers@kernel.org> X-Headers-End: 1kd2Xq-00HayK-2O Subject: Re: [f2fs-dev] [PATCH] fscrypt: fix inline encryption not used on new files X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Satya Tangirala via Linux-f2fs-devel Reply-To: Satya Tangirala Cc: Jaegeuk Kim , linux-fscrypt@vger.kernel.org, linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net On Tue, Nov 10, 2020 at 05:52:24PM -0800, Eric Biggers wrote: > From: Eric Biggers > > The new helper function fscrypt_prepare_new_inode() runs before > S_ENCRYPTED has been set on the new inode. This accidentally made > fscrypt_select_encryption_impl() never enable inline encryption on newly > created files, due to its use of fscrypt_needs_contents_encryption() > which only returns true when S_ENCRYPTED is set. > > Fix this by using S_ISREG() directly instead of > fscrypt_needs_contents_encryption(), analogous to what > select_encryption_mode() does. > > I didn't notice this earlier because by design, the user-visible > behavior is the same (other than performance, potentially) regardless of > whether inline encryption is used or not. > > Fixes: a992b20cd4ee ("fscrypt: add fscrypt_prepare_new_inode() and fscrypt_set_context()") > Signed-off-by: Eric Biggers > --- > fs/crypto/inline_crypt.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/fs/crypto/inline_crypt.c b/fs/crypto/inline_crypt.c > index 89bffa82ed74a..c57bebfa48fea 100644 > --- a/fs/crypto/inline_crypt.c > +++ b/fs/crypto/inline_crypt.c > @@ -74,7 +74,7 @@ int fscrypt_select_encryption_impl(struct fscrypt_info *ci) > int i; > > /* The file must need contents encryption, not filenames encryption */ > - if (!fscrypt_needs_contents_encryption(inode)) > + if (!S_ISREG(inode->i_mode)) > return 0; > > /* The crypto mode must have a blk-crypto counterpart */ > > base-commit: 92cfcd030e4b1de11a6b1edb0840e55c26332d31 > -- > 2.29.2 > Looks good to me. Please feel free to add Reviewed-by: Satya Tangirala _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel