public inbox for linux-nvme@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH v2 00/20] nvme: fixes, cleanups and enhancements to the dhchap-auth host code
@ 2022-11-13 11:24 Sagi Grimberg
  2022-11-13 11:24 ` [PATCH v2 01/20] nvme-auth: rename __nvme_auth_[reset|free] to nvme_auth[reset|free]_dhchap Sagi Grimberg
                   ` (20 more replies)
  0 siblings, 21 replies; 46+ messages in thread
From: Sagi Grimberg @ 2022-11-13 11:24 UTC (permalink / raw)
  To: linux-nvme
  Cc: Christoph Hellwig, Keith Busch, Chaitanya Kulkarni,
	Hannes Reinecke

Currently the authentication code is fairly fragile with respect to
mutual locking between secrets sysfs override, re-authentication, and
controller resets.

This patch set attempts to resolve these issues by:
1. freeing queue chap context as soon as authentication completes
   - including making the chap 4k buffer short-lived (added a mempool
     to overcome memory pressure situations).
2. allocate a simple vector for queue chap contexts so there is
no list/tree traversal to resolve queue chap context. queue chap
contexts are 1x1 mapped to queues, which are stored in a vector as
well.
3. flush chap auth_work from the ctrl dhchap work, this simplifies
how we flush inflight authentication sequence
4. use ctrl dhchap_auth_mutex to protect only the resources that are
accessed and modified via sysfs and the authentication flow (i.e. ctrl
host_key and ctrl_key)
5. move drivers (rdma/tcp) nvme_auth_stop later in the error recovery
flow to expedite failover and not block on I/O.

Feedback is welcome.

Changes from v1:
- split some of list->array conversion patch to make it simpler to review
  still it involves the locking changes in it so no regression is introduced.
- removed dhchap array macro foreach and accessor as the dhchap queue context
  is now typed in nvme_ctrl.
- Added mempool for chap buffers to overcome memory pressure situations
- removed redundant chap->buf_size
- renamed __nvme_auth_work to nvme_queue_auth_work (also nvme_dhchap_auth_work
  to nvme_ctrl_auth_work)
- converted macro to static inline function (ctrl_max_dhchaps)

Sagi Grimberg (20):
  nvme-auth: rename __nvme_auth_[reset|free] to
    nvme_auth[reset|free]_dhchap
  nvme-auth: rename authentication work elements
  nvme-auth: remove symbol export from nvme_auth_reset
  nvme-auth: don't re-authenticate if the controller is not LIVE
  nvme-auth: remove redundant buffer deallocations
  nvme-auth: don't ignore key generation failures when initializing ctrl
    keys
  nvme-auth: don't override ctrl keys before validation
  nvme-auth: remove redundant if statement
  nvme-auth: don't keep long lived 4k dhchap buffer
  nvme-auth: guarantee dhchap buffers under memory pressure
  nvme-auth: clear sensitive info right after authentication completes
  nvme-auth: remove redundant deallocations
  nvme-auth: no need to reset chap contexts on re-authentication
  nvme-auth: check chap ctrl_key once constructed
  nvme: move nvme_dhchap_queue_context declaration to nvme.h header
  nvme-auth: convert dhchap_auth_list to an array
  nvme-auth: remove redundant auth_work flush
  nvme-auth: have dhchap_auth_work wait for queues auth to complete
  nvme-tcp: stop auth work after tearing down queues in error recovery
  nvme-rdma: stop auth work after tearing down queues in error recovery

 drivers/nvme/host/auth.c | 282 ++++++++++++++++++---------------------
 drivers/nvme/host/core.c |  32 ++++-
 drivers/nvme/host/nvme.h |  43 +++++-
 drivers/nvme/host/rdma.c |   2 +-
 drivers/nvme/host/tcp.c  |   2 +-
 5 files changed, 200 insertions(+), 161 deletions(-)

-- 
2.34.1



^ permalink raw reply	[flat|nested] 46+ messages in thread

end of thread, other threads:[~2022-11-15 10:32 UTC | newest]

Thread overview: 46+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-13 11:24 [PATCH v2 00/20] nvme: fixes, cleanups and enhancements to the dhchap-auth host code Sagi Grimberg
2022-11-13 11:24 ` [PATCH v2 01/20] nvme-auth: rename __nvme_auth_[reset|free] to nvme_auth[reset|free]_dhchap Sagi Grimberg
2022-11-15  3:50   ` Chaitanya Kulkarni
2022-11-13 11:24 ` [PATCH v2 02/20] nvme-auth: rename authentication work elements Sagi Grimberg
2022-11-13 13:11   ` Hannes Reinecke
2022-11-15  3:52   ` Chaitanya Kulkarni
2022-11-13 11:24 ` [PATCH v2 03/20] nvme-auth: remove symbol export from nvme_auth_reset Sagi Grimberg
2022-11-15  3:52   ` Chaitanya Kulkarni
2022-11-13 11:24 ` [PATCH v2 04/20] nvme-auth: don't re-authenticate if the controller is not LIVE Sagi Grimberg
2022-11-15  3:53   ` Chaitanya Kulkarni
2022-11-13 11:24 ` [PATCH v2 05/20] nvme-auth: remove redundant buffer deallocations Sagi Grimberg
2022-11-15  3:54   ` Chaitanya Kulkarni
2022-11-13 11:24 ` [PATCH v2 06/20] nvme-auth: don't ignore key generation failures when initializing ctrl keys Sagi Grimberg
2022-11-15  3:56   ` Chaitanya Kulkarni
2022-11-13 11:24 ` [PATCH v2 07/20] nvme-auth: don't override ctrl keys before validation Sagi Grimberg
2022-11-15  3:58   ` Chaitanya Kulkarni
2022-11-13 11:24 ` [PATCH v2 08/20] nvme-auth: remove redundant if statement Sagi Grimberg
2022-11-15  3:58   ` Chaitanya Kulkarni
2022-11-13 11:24 ` [PATCH v2 09/20] nvme-auth: don't keep long lived 4k dhchap buffer Sagi Grimberg
2022-11-15  4:01   ` Chaitanya Kulkarni
2022-11-13 11:24 ` [PATCH v2 10/20] nvme-auth: guarantee dhchap buffers under memory pressure Sagi Grimberg
2022-11-15  4:04   ` Chaitanya Kulkarni
2022-11-15  8:09     ` Sagi Grimberg
2022-11-13 11:24 ` [PATCH v2 11/20] nvme-auth: clear sensitive info right after authentication completes Sagi Grimberg
2022-11-15  4:06   ` Chaitanya Kulkarni
2022-11-13 11:24 ` [PATCH v2 12/20] nvme-auth: remove redundant deallocations Sagi Grimberg
2022-11-13 13:11   ` Hannes Reinecke
2022-11-15  4:09   ` Chaitanya Kulkarni
2022-11-13 11:24 ` [PATCH v2 13/20] nvme-auth: no need to reset chap contexts on re-authentication Sagi Grimberg
2022-11-15  4:10   ` Chaitanya Kulkarni
2022-11-13 11:24 ` [PATCH v2 14/20] nvme-auth: check chap ctrl_key once constructed Sagi Grimberg
2022-11-13 13:12   ` Hannes Reinecke
2022-11-15  4:13   ` Chaitanya Kulkarni
2022-11-15  4:13   ` Chaitanya Kulkarni
2022-11-13 11:24 ` [PATCH v2 15/20] nvme: move nvme_dhchap_queue_context declaration to nvme.h header Sagi Grimberg
2022-11-15  4:20   ` Chaitanya Kulkarni
2022-11-15 10:03     ` Christoph Hellwig
2022-11-13 11:24 ` [PATCH v2 16/20] nvme-auth: convert dhchap_auth_list to an array Sagi Grimberg
2022-11-13 11:24 ` [PATCH v2 17/20] nvme-auth: remove redundant auth_work flush Sagi Grimberg
2022-11-15  4:15   ` Chaitanya Kulkarni
2022-11-13 11:24 ` [PATCH v2 18/20] nvme-auth: have dhchap_auth_work wait for queues auth to complete Sagi Grimberg
2022-11-13 11:24 ` [PATCH v2 19/20] nvme-tcp: stop auth work after tearing down queues in error recovery Sagi Grimberg
2022-11-15  4:18   ` Chaitanya Kulkarni
2022-11-13 11:24 ` [PATCH v2 20/20] nvme-rdma: " Sagi Grimberg
2022-11-15  4:18   ` Chaitanya Kulkarni
2022-11-15 10:11 ` [PATCH v2 00/20] nvme: fixes, cleanups and enhancements to the dhchap-auth host code Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox