All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jaegeuk Kim <jaegeuk@kernel.org>
To: Theodore Ts'o <tytso@mit.edu>
Cc: linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org,
	linux-f2fs-devel@lists.sourceforge.net,
	Eric Biggers <ebiggers@google.com>
Subject: Re: [PATCH] fscrypto: require write access to mount to set encryption policy
Date: Fri, 9 Sep 2016 21:40:49 -0700	[thread overview]
Message-ID: <20160910044049.GD34151@jaegeuk> (raw)
In-Reply-To: <20160910041519.nmim57wyptdynwxh@thunk.org>

On Sat, Sep 10, 2016 at 12:15:19AM -0400, Theodore Ts'o wrote:
> On Thu, Sep 08, 2016 at 02:20:38PM -0700, Eric Biggers wrote:
> > [To apply cleanly, my other two patches must be applied before this one]
> > 
> > Since setting an encryption policy requires writing metadata to the
> > filesystem, it should be guarded by mnt_want_write/mnt_drop_write.
> > Otherwise, a user could cause a write to a frozen or readonly
> > filesystem.  This was handled correctly by f2fs but not by ext4.  Make
> > fscrypt_process_policy() handle it rather than relying on the filesystem
> > to get it right.
> > 
> > Signed-off-by: Eric Biggers <ebiggers@google.com>

Acked-by: Jaegeuk Kim <jaegeuk@kernel.org>

> > Cc: stable@vger.kernel.org # 4.1+; check fs/{ext4,f2fs}
> 
> Thanks, I have this in the ext4.git's fixes branch, but I plan to only
> send the other two fixes to Linus, since (a) they are more critical,
> and I'd prefer to get an Acked-by from Jaeguk or Changman (as the f2fs
> maintainers) before I send this fix to Linus, since it touches f2fs.

Thank you, Ted.

It'd be better to fix the below basic warnings tho.

# ./scripts/checkpatch.pl [patch]

WARNING: line over 80 characters
#147: FILE: fs/crypto/policy.c:120:
+			ret = create_encryption_context_from_policy(inode, policy);

WARNING: line over 80 characters
#148: FILE: fs/crypto/policy.c:121:
+	} else if (!is_encryption_context_consistent_with_policy(inode, policy)) {

	WARNING: Prefer [subsystem eg: netdev]_warn([subsystem]dev, ... then dev_warn(dev, ... then pr_warn(...  to printk(KERN_WARNING ...
#149: FILE: fs/crypto/policy.c:122:
+		printk(KERN_WARNING

total: 0 errors, 3 warnings, 107 lines checked

Thanks,



> 
> 							- Ted

------------------------------------------------------------------------------

WARNING: multiple messages have this Message-ID (diff)
From: Jaegeuk Kim <jaegeuk@kernel.org>
To: Theodore Ts'o <tytso@mit.edu>
Cc: Eric Biggers <ebiggers@google.com>,
	linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org,
	linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [PATCH] fscrypto: require write access to mount to set encryption policy
Date: Fri, 9 Sep 2016 21:40:49 -0700	[thread overview]
Message-ID: <20160910044049.GD34151@jaegeuk> (raw)
In-Reply-To: <20160910041519.nmim57wyptdynwxh@thunk.org>

On Sat, Sep 10, 2016 at 12:15:19AM -0400, Theodore Ts'o wrote:
> On Thu, Sep 08, 2016 at 02:20:38PM -0700, Eric Biggers wrote:
> > [To apply cleanly, my other two patches must be applied before this one]
> > 
> > Since setting an encryption policy requires writing metadata to the
> > filesystem, it should be guarded by mnt_want_write/mnt_drop_write.
> > Otherwise, a user could cause a write to a frozen or readonly
> > filesystem.  This was handled correctly by f2fs but not by ext4.  Make
> > fscrypt_process_policy() handle it rather than relying on the filesystem
> > to get it right.
> > 
> > Signed-off-by: Eric Biggers <ebiggers@google.com>

Acked-by: Jaegeuk Kim <jaegeuk@kernel.org>

> > Cc: stable@vger.kernel.org # 4.1+; check fs/{ext4,f2fs}
> 
> Thanks, I have this in the ext4.git's fixes branch, but I plan to only
> send the other two fixes to Linus, since (a) they are more critical,
> and I'd prefer to get an Acked-by from Jaeguk or Changman (as the f2fs
> maintainers) before I send this fix to Linus, since it touches f2fs.

Thank you, Ted.

It'd be better to fix the below basic warnings tho.

# ./scripts/checkpatch.pl [patch]

WARNING: line over 80 characters
#147: FILE: fs/crypto/policy.c:120:
+			ret = create_encryption_context_from_policy(inode, policy);

WARNING: line over 80 characters
#148: FILE: fs/crypto/policy.c:121:
+	} else if (!is_encryption_context_consistent_with_policy(inode, policy)) {

	WARNING: Prefer [subsystem eg: netdev]_warn([subsystem]dev, ... then dev_warn(dev, ... then pr_warn(...  to printk(KERN_WARNING ...
#149: FILE: fs/crypto/policy.c:122:
+		printk(KERN_WARNING

total: 0 errors, 3 warnings, 107 lines checked

Thanks,



> 
> 							- Ted

  reply	other threads:[~2016-09-10  4:40 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-08 21:20 [PATCH] fscrypto: require write access to mount to set encryption policy Eric Biggers
2016-09-08 21:20 ` Eric Biggers
2016-09-10  4:15 ` Theodore Ts'o
2016-09-10  4:40   ` Jaegeuk Kim [this message]
2016-09-10  4:40     ` Jaegeuk Kim
2016-09-10  5:20     ` Theodore Ts'o
  -- strict thread matches above, loose matches on Subject: below --
2016-09-20  0:49 Eric Biggers
2017-10-24 23:32 Eric Biggers
2017-10-25  9:42 ` Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160910044049.GD34151@jaegeuk \
    --to=jaegeuk@kernel.org \
    --cc=ebiggers@google.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=tytso@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.