Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/5] nvme: target and host fixes from a drivers/nvme audit
@ 2026-12-02 11:58 Guixin Liu
  2026-12-02 11:58 ` [PATCH v2 1/5] nvme: mask the status before checking for Host Identifier Inconsistent Guixin Liu
                   ` (4 more replies)
  0 siblings, 5 replies; 11+ messages in thread
From: Guixin Liu @ 2026-12-02 11:58 UTC (permalink / raw)
  To: Keith Busch, Jens Axboe, Christoph Hellwig, Sagi Grimberg,
	Nilay Shroff, Daniel Wagner, Hannes Reinecke
  Cc: linux-nvme

A static audit of drivers/nvme turned up these independent bugs. Each
patch has its own reproducer and regression run, described in the notes
below its diff.

  nvme: mask the status before checking for Host Identifier Inconsistent
    The EDS->legacy reservation report fallback never triggers when the
    controller sets DNR.

  nvmet: read CRTO from the capability register
    The CRTO property is extracted from CSTS and always reads zero.

  nvmet: complete the passthru request after applying command effects
    nvme_passthru_end() reads req->cmd after the loop host request has
    been freed.

  nvmet-auth: reject negotiation when the configured DH group is not
    offered
    DH group negotiation advertises a group the host did not offer.

  nvmet-auth: require a DH value when a DH group was negotiated
    A reply with dhvlen == 0 bypasses the negotiated DH key exchange.

Testing: QEMU/KVM guest, 7.3.0 kernel with KASAN, nvmet-tcp, nvme-loop
and nvmet passthru to a QEMU nvme backend. Each fix was reproduced on
the unpatched code, verified with the same recipe after patching, and
regression-tested with the test-only injections removed. The
passthru use-after-free is evidenced by free/read address tracking; the
test kernel's module-side KASAN does not splat on that access, as noted
in patch 3. The test-only injections live in the test environment only,
not in these patches.

---
Changes since v1:
- passthru: apply the command effects before completing the target
  request instead of snapshotting req->cmd, which also keeps the
  passthru reference alive across nvme_passthru_end() (Sashiko).
- auth negotiation: drop the fallback to another offered group; it
  races on the controller-wide DH context across queues and downgrades
  to NULL DH. Require the configured group to be offered instead
  (Sashiko).
- Add a fix for a pre-existing DH exchange bypass: a reply with
  dhvlen == 0 was accepted even when a non-null DH group was negotiated
  (Sashiko).

v1: https://lore.kernel.org/all/20261202034707.3844378-1-kanie@linux.alibaba.com/

Guixin Liu (5):
  nvme: mask the status before checking for Host Identifier Inconsistent
  nvmet: read CRTO from the capability register
  nvmet: complete the passthru request after applying command effects
  nvmet-auth: reject negotiation when the configured DH group is not
    offered
  nvmet-auth: require a DH value when a DH group was negotiated

 drivers/nvme/host/pr.c                 |  2 +-
 drivers/nvme/target/fabrics-cmd-auth.c | 32 ++++++++------------------
 drivers/nvme/target/fabrics-cmd.c      |  2 +-
 drivers/nvme/target/passthru.c         | 10 +++++++-
 4 files changed, 20 insertions(+), 26 deletions(-)

-- 
2.43.7



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

end of thread, other threads:[~2026-12-03  8:08 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-02 11:58 [PATCH v2 0/5] nvme: target and host fixes from a drivers/nvme audit Guixin Liu
2026-12-02 11:58 ` [PATCH v2 1/5] nvme: mask the status before checking for Host Identifier Inconsistent Guixin Liu
2026-12-03  8:05   ` Christoph Hellwig
2026-12-02 11:58 ` [PATCH v2 2/5] nvmet: read CRTO from the capability register Guixin Liu
2026-12-03  8:05   ` Christoph Hellwig
2026-12-02 11:58 ` [PATCH v2 3/5] nvmet: complete the passthru request after applying command effects Guixin Liu
2026-12-03  8:05   ` Christoph Hellwig
2026-12-02 11:58 ` [PATCH v2 4/5] nvmet-auth: reject negotiation when the configured DH group is not offered Guixin Liu
2026-12-03  8:07   ` Christoph Hellwig
2026-12-02 11:58 ` [PATCH v2 5/5] nvmet-auth: require a DH value when a DH group was negotiated Guixin Liu
2026-12-03  8:08   ` Christoph Hellwig

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