From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B8A4E606A322 for ; Sat, 5 Dec 2026 00:49:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=34faU3dR; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=0i9zjcPL DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Unsubscribe-Post:List-Owner; bh=3/DZX66SAc+qXdhGeSFipSoaaI1WHMNzzTQtErHjJlo=; b=34faU3dRqs0xgXpGUwCzYcWLEf G03TMQOrN/YLhR4J6EYq8JxIBUKJWjd23CgSnrsJWatY/BpUALKwCpnq2gcGW7oNmErw9yR2YwhPX l6PMtGa0eRJJ8NbBh891cEh6BXldkIPuAaxTH8JYe+XdqIV8I5F3sprAiFK+Ha3tCt31kU8ieC0nJ j/GfCBO0MZZhiZZvTb7Ky5493WP7sAtQ7h6T63j5ipJlyplvra1PLIVX7JCb0VuL7HAO5xEmeewZI n18mS907vLrg98kZtIGppUPTUOA+WeASGSUQY2LrZuHI9RuL+f08SJwzx+hvLcQW+GkTc8k/e/lPW UaVkJUyQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xZdxX-00000001or6-2TOu; Sat, 05 Dec 2026 00:49:03 +0000 Received: from mail-pg1-x52e.google.com ([2607:f8b0:4864:20::52e]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xZdxT-00000001oqV-48da for linux-nvme@lists.infradead.org; Sat, 05 Dec 2026 00:49:01 +0000 Received: by mail-pg1-x52e.google.com with SMTP id 41be03b00d2f7-cdb1199bfd8so852935a12.1 for ; Fri, 04 Dec 2026 16:48:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796431738; x=1797036538; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=3/DZX66SAc+qXdhGeSFipSoaaI1WHMNzzTQtErHjJlo=; b=0i9zjcPLhUS39D+zPgoGTh2Uwx5glwHrolD3uSzRvzvw6rWDqXUK8RXzZHOZzow1OX 3W+bNQzJedcArlroNoPBffBNp7OckNgZfJRuqA9wL0BRVg9scmSwq0FPdk/pTQ+Dz4aQ sDs/uWBI4ol4pUH7cC5h3TSDcO6iMnlrUCyXXQVkfs2gPSW+8CkmN/u3g4iKUUjT/Rm/ sASZrBMKr23xK8imLySuM/Hy2AkMhlritToB+JqfLtQRE5i4tI2YGjvq+PzqRgnzb4lW 2gOczCZG9pHEfNCYJ56yEaC4KbrZkk96wD4/s1Oj04ap2q6oW5ubDZnv2Or5hm4R8OVV UuFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796431738; x=1797036538; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=3/DZX66SAc+qXdhGeSFipSoaaI1WHMNzzTQtErHjJlo=; b=JB2K/CnBFcl3aZ10t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4sC2+qr418 0GXNJn/P2AIG7wuBYcKiLesI7xh+qy8IWANxNwWb/pi4tkMBCOsfPXki0b3F3ZTOJRuMGD2qdej pyxwRZ02Qx3n3Miz8u8tlmcpd3fCDN3UulOkPOq3QNmJV3KQ5YYa6E7+YkVvAdQ4= X-Received: by 2002:a17:90b:5483:b0:3a7:f4d:b23d with SMTP id 98e67ed59e1d1-3b5e06a62d5mr3179848a91.52.1796431738436; Fri, 04 Dec 2026 16:48:58 -0800 (PST) Received: from localhost.localdomain ([42.118.185.60]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-3b5c7d9c004sm11773643a91.17.2026.12.04.16.48.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Dec 2026 16:48:58 -0800 (PST) From: Lee Seong Hyeon To: linux-nvme@lists.infradead.org Cc: hare@kernel.org, hch@lst.de, sagi@grimberg.me, kch@nvidia.com, linux-kernel@vger.kernel.org Subject: [PATCH RESEND 0/2] nvmet-auth: fix use-after-free and out-of-bounds read across queues Date: Sat, 5 Dec 2026 07:48:14 +0700 Message-ID: <20261205004816.2017-1-ihopenre@gmail.com> X-Mailer: git-send-email 2.55.0.windows.3 X-Archived-By: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261204_164900_066011_4CEBE97A X-CRM114-Status: GOOD ( 11.77 ) X-Spam-Score: -2.1 (--) X-BeenThere: linux-nvme@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-nvme" X-Spam-Status: No, score=-11.1 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 Resending to linux-nvme as Christoph and Hannes asked. The first posting went to the maintainers and security@kernel.org only. The only change is the Reviewed-by from Hannes on both patches, and the rebase onto 007722b8211f, where they apply without changes. The DH-HMAC-CHAP keys and the negotiated hash live in struct nvmet_ctrl and are shared by all queues, but each queue processes AUTH_Send and AUTH_Receive on its own and sq->auth_lock is per queue. 1. AUTH_Negotiate on one queue frees ctrl->host_key in nvmet_setup_auth() while a Reply on another queue uses it (KASAN use-after-free read). 2. AUTH_Negotiate on any queue can change ctrl->shash_id. A queue that got its challenge for SHA-256 and replies with hl=64 after another queue negotiated SHA-512 makes nvmet_auth_host_hash() read 64 bytes from the 32 byte sq->dhchap_c1 (KASAN slab-out-of-bounds read). Conditions: CONFIG_NVME_TARGET_AUTH and a subsystem exported to a host that has a dhchap_key set. A Connect for an I/O queue is accepted while the admin queue is unauthenticated, and both queues accept authentication commands. (1) is a race between two connections, (2) is deterministic. Tested in QEMU with KASAN over nvmet-tcp, on 20eef29b7c84 and again on 007722b8211f. Unpatched: both reports. Both patches: neither shows in a 20 second race run. With both patches the in-kernel nvme-tcp host still connects with dhchap_secret (SHA-256, NULL DH group), with and without dhchap_ctrl_secret, and reads and writes the namespace; a wrong secret is still rejected. W=1 and checkpatch --strict are clean. Not tested: lockdep (patch 1 adds a mutex nested inside sq->auth_lock; the lock order was checked by reading only), DH groups other than NULL, TLS, RDMA, FC and loop transports. Both patches were found and drafted with the help of an AI coding assistant; this is stated in each commit message. Lee Seong Hyeon (2): nvmet-auth: serialize the controller authentication state nvmet-auth: fail the transaction when the hash was changed drivers/nvme/target/auth.c | 2 ++ drivers/nvme/target/core.c | 3 +++ drivers/nvme/target/fabrics-cmd-auth.c | 31 ++++++++++++++++++++++++++ drivers/nvme/target/nvmet.h | 3 +++ 4 files changed, 39 insertions(+) base-commit: 007722b8211f7b34fdf21b1e6a9c32497633ea29 -- 2.53.0