linux-fscrypt.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers@kernel.org>
To: Satya Tangirala <satyat@google.com>
Cc: linux-block@vger.kernel.org, linux-scsi@vger.kernel.org,
	linux-fscrypt@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	linux-f2fs-devel@lists.sourceforge.net,
	linux-ext4@vger.kernel.org,
	Barani Muthukumaran <bmuthuku@qti.qualcomm.com>,
	Kuohong Wang <kuohong.wang@mediatek.com>,
	Kim Boojin <boojin.kim@samsung.com>
Subject: Re: [PATCH v8 03/11] block: Make blk-integrity preclude hardware inline encryption
Date: Sun, 15 Mar 2020 13:16:18 -0700	[thread overview]
Message-ID: <20200315201618.GH1055@sol.localdomain> (raw)
In-Reply-To: <20200312080253.3667-4-satyat@google.com>

On Thu, Mar 12, 2020 at 01:02:45AM -0700, Satya Tangirala wrote:
> diff --git a/block/blk-integrity.c b/block/blk-integrity.c
> index ff1070edbb40..793ba23e8688 100644
> --- a/block/blk-integrity.c
> +++ b/block/blk-integrity.c
> @@ -409,6 +409,13 @@ void blk_integrity_register(struct gendisk *disk, struct blk_integrity *template
>  	bi->tag_size = template->tag_size;
>  
>  	disk->queue->backing_dev_info->capabilities |= BDI_CAP_STABLE_WRITES;
> +
> +#ifdef BLK_INLINE_ENCRYPTION
> +	if (disk->queue->ksm) {
> +		pr_warn("blk-integrity: Integrity and hardware inline encryption are not supported together. Unregistering keyslot manager from request queue, to disable hardware inline encryption.");
> +		blk_ksm_unregister(disk->queue);
> +	}
> +#endif
>  }
>  EXPORT_SYMBOL(blk_integrity_register);

This ifdef is wrong, it should be CONFIG_BLK_INLINE_ENCRYPTION.

Also the log message is missing a trailing newline.

>  
> diff --git a/block/keyslot-manager.c b/block/keyslot-manager.c
> index 38df0652df80..a7970e18a122 100644
> --- a/block/keyslot-manager.c
> +++ b/block/keyslot-manager.c
> @@ -25,6 +25,9 @@
>   * Upper layers will call blk_ksm_get_slot_for_key() to program a
>   * key into some slot in the inline encryption hardware.
>   */
> +
> +#define pr_fmt(fmt) "blk_ksm: " fmt

People aren't going to know what "blk_ksm" means in the logs.
I think just use "blk-crypto" instead.

> +
>  #include <crypto/algapi.h>
>  #include <linux/keyslot-manager.h>
>  #include <linux/atomic.h>
> @@ -375,3 +378,20 @@ void blk_ksm_destroy(struct keyslot_manager *ksm)
>  	memzero_explicit(ksm, sizeof(*ksm));
>  }
>  EXPORT_SYMBOL_GPL(blk_ksm_destroy);
> +
> +bool blk_ksm_register(struct keyslot_manager *ksm, struct request_queue *q)
> +{
> +	if (blk_integrity_queue_supports_integrity(q)) {
> +		pr_warn("Integrity and hardware inline encryption are not supported together. Won't register keyslot manager with request queue.");
> +		return false;
> +	}
> +	q->ksm = ksm;
> +	return true;
> +}
> +EXPORT_SYMBOL_GPL(blk_ksm_register);


People reading the logs won't know what a keyslot manager is and why they should
care that one wasn't registered.  It would be better to say that hardware inline
encryption is being disabled.

Ideally the device name would be included in the message too.

> +
> +void blk_ksm_unregister(struct request_queue *q)
> +{
> +	q->ksm = NULL;
> +}
> +EXPORT_SYMBOL_GPL(blk_ksm_unregister);

blk_ksm_unregister() doesn't need to be exported.

  reply	other threads:[~2020-03-15 20:16 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-12  8:02 [PATCH v8 00/11] Inline Encryption Support Satya Tangirala
2020-03-12  8:02 ` [PATCH v8 01/11] block: Keyslot Manager for Inline Encryption Satya Tangirala
2020-03-15 20:08   ` Eric Biggers
2020-03-12  8:02 ` [PATCH v8 02/11] block: Inline encryption support for blk-mq Satya Tangirala
2020-03-19 11:01   ` Christoph Hellwig
2020-03-12  8:02 ` [PATCH v8 03/11] block: Make blk-integrity preclude hardware inline encryption Satya Tangirala
2020-03-15 20:16   ` Eric Biggers [this message]
2020-03-19 11:04   ` Christoph Hellwig
2020-03-12  8:02 ` [PATCH v8 04/11] block: blk-crypto-fallback for Inline Encryption Satya Tangirala
2020-03-12  8:02 ` [PATCH v8 05/11] scsi: ufs: UFS driver v2.1 spec crypto additions Satya Tangirala
2020-03-12  8:02 ` [PATCH v8 06/11] scsi: ufs: UFS crypto API Satya Tangirala
2020-03-15 18:24   ` Eric Biggers
2020-03-12  8:02 ` [PATCH v8 07/11] scsi: ufs: Add inline encryption support to UFS Satya Tangirala
2020-03-15 18:38   ` Eric Biggers
2020-03-15 18:48   ` Eric Biggers
2020-03-12  8:02 ` [PATCH v8 08/11] fs: introduce SB_INLINECRYPT Satya Tangirala
2020-03-15 19:05   ` Eric Biggers
2020-03-12  8:02 ` [PATCH v8 09/11] fscrypt: add inline encryption support Satya Tangirala
2020-03-15 17:20   ` Eric Biggers
2020-03-12  8:02 ` [PATCH v8 10/11] f2fs: " Satya Tangirala
2020-03-15 17:16   ` Eric Biggers
2020-03-12  8:02 ` [PATCH v8 11/11] ext4: " Satya Tangirala
2020-03-12 15:43 ` [PATCH v8 00/11] Inline Encryption Support 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=20200315201618.GH1055@sol.localdomain \
    --to=ebiggers@kernel.org \
    --cc=bmuthuku@qti.qualcomm.com \
    --cc=boojin.kim@samsung.com \
    --cc=kuohong.wang@mediatek.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-fscrypt@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=satyat@google.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).