All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Eric Biggers <ebiggers@kernel.org>
Cc: Christoph Hellwig <hch@lst.de>,
	linux-fscrypt@vger.kernel.org, linux-block@vger.kernel.org
Subject: Re: RFC: what to do about fscrypt vs block device interaction
Date: Fri, 22 Jul 2022 18:03:49 +0200	[thread overview]
Message-ID: <20220722160349.GA10142@lst.de> (raw)
In-Reply-To: <YtpfyZ8Dr9duVr45@sol.localdomain>

On Fri, Jul 22, 2022 at 01:28:57AM -0700, Eric Biggers wrote:
> Yes, evicting the blk-crypto keys at unmount is the expected behavior.
> And it basically is the actual behavior as well, but as currently
> implemented there can be a slight delay.  There are two reasons for the
> delay, both probably solvable.
> 
> The first is that ->s_master_keys isn't released until __put_super().
> It probably should be moved earlier, maybe to generic_shutdown_super().

Yes, this does sound like a good idea.

> The second reason is that the keyrings subsystem is being used to keep
> track of the superblock's master keys (for several reasons, such as
> integrating with the key quotas), and a side effect of that we get the
> delay of the keyring's subsystem garbage collector before the destroy
> callbacks of the keys actually  run.  That delays the eviction of the
> blk-crypto keys.
> 
> To avoid that, I think we could go through and evict all the
> blk_crypto_keys (i.e. call fscrypt_destroy_prepared_key() on the
> fscrypt_prepared_keys embedded in each fscrypt_master_key) during the
> unmount itself, separating it from the destruction of the key objects
> from the keyring subsystem's perspective. That could happen in the
> moved call to fscrypt_sb_free().

I'll give this a try.

What would be a good test suite or set of tests to make sure I don't
break fscrypt operation?

  reply	other threads:[~2022-07-22 16:03 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-21 12:59 RFC: what to do about fscrypt vs block device interaction Christoph Hellwig
2022-07-22  8:28 ` Eric Biggers
2022-07-22 16:03   ` Christoph Hellwig [this message]
2022-07-22 18:24     ` Eric Biggers
2022-08-17  0:28       ` Eric Biggers

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=20220722160349.GA10142@lst.de \
    --to=hch@lst.de \
    --cc=ebiggers@kernel.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-fscrypt@vger.kernel.org \
    /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.