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 2E91B606A322 for ; Sat, 5 Dec 2026 01:12:29 +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=bzBRcEpr; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=gOXkJbHs DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Reply-To:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Date: Content-Transfer-Encoding:Content-Type:References:In-Reply-To:To:Subject:From :Message-ID:Cc:MIME-Version:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Unsubscribe-Post:List-Owner; bh=yaF1UedWsZKgrLnLd7yUhw34hENDlqnTyDdowc5XPCA=; b=bzBRcEprmFvQivof/GlpbdObea a8dfbfIjcZ1PlYzRF1fDnsalOeVVGm9FVOGng22FivNRMmtgaACUskWfFUWQHJH0kWoZlZRpyIUQy IGDLLopRXTgpcCsh4IAWJSN3mkm8MrsS2DhngurB+UnyjshLSUDQRuEz2iAbECJ8MnNC2Ro9/VzUH ckF6DQpaSzxoQ05nzUnb0h54mg+5Mgyk4c+mThmH7KIp/ITmtM9P3pgMw2qwPkkp79worHxAIm5xf UkuZ4OyecfdIRy2smgo/0oIHBuEoe4pWsYcsN6PQcoRrUxecZLwkUYL/sGgN0oFJmUlKguN7BhyrC nkHovmwQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xZeKA-00000001qoT-1hiq; Sat, 05 Dec 2026 01:12:26 +0000 Received: from sea.source.kernel.org ([172.234.252.31]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xZeK1-00000001qoF-1e0D for linux-nvme@lists.infradead.org; Sat, 05 Dec 2026 01:12:18 +0000 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id C41A244170; Sat, 5 Dec 2026 01:12:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 93D541F0092B; Sat, 5 Dec 2026 01:12:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796433136; bh=yaF1UedWsZKgrLnLd7yUhw34hENDlqnTyDdowc5XPCA=; h=From:Subject:Reply-To:To:In-Reply-To:References:Date; b=gOXkJbHs1cOHaVzkcLQ3mj2JeHxWlVQY4Jg2x2CeGHL297cskIBUezonG1KX4hEEW z8eSA79pXB6ZuHut14B6d5yl7pWguA210B2Zl3I1swrzt56OUEk1D57EX7t2Workmf C8thVsk18pOUUoKT5PD3vlFJEEHYNlX7yZhyTTtRgJ8ByvMk5/jtumIDPWMS4Ks9yB 4i6A5eKAVd/l8o8uPKvvgn+6+eipC5u7ABPP7H3TgZUCA4tiYD7aVvh2lPwx7wEWEG KmNI81E3cBsjrmSSX0//N2J/lgG2+uVON3xQSXmICObN6mkh9sgT4BDly6FKDagXZq nDTr19K6dl6Dg== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH RESEND 2/2] nvmet-auth: fail the transaction when the hash was changed To: "Lee Seong Hyeon" , linux-nvme@lists.infradead.org In-Reply-To: <20261205004816.2017-3-ihopenre@gmail.com> References: <20261205004816.2017-1-ihopenre@gmail.com> <20261205004816.2017-3-ihopenre@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Sat, 05 Dec 2026 01:12:16 +0000 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: , Reply-To: sashiko-reviews@lists.linux.dev Sender: "Linux-nvme" X-Spam-Status: No, score=-11.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS 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 X-Archived-By: Thank you for your contribution! Sashiko AI review found 2 potential issues to consider: - [Medium] nvmet-auth: SUCCESS2 hash mismatch sets FAILURE1 and returns success - [Medium] nvmet-auth: nvmet_auth_receive_data_len() sizes SUCCESS1 with ctrl->shash_id -- commit 4340d49e872c07246a6237d56d0d333f026696c4 Author: Lee Seong Hyeon nvmet-auth: fail the transaction when the hash was changed This commit records the hash ID used to generate a queue's DH-HMAC-CHAP challenge in sq->dhchap_hash_id and fails the transaction with NVME_AUTH_DHCHAP_FAILURE_HASH_UNUSABLE if ctrl->shash_id has changed by the time Reply, Success1, or Success2 is processed. > diff --git a/drivers/nvme/target/fabrics-cmd-auth.c b/drivers/nvme/target= /fabrics-cmd-auth.c > index fe068dd5d450c..7f1549fc1545c 100644 > --- a/drivers/nvme/target/fabrics-cmd-auth.c > +++ b/drivers/nvme/target/fabrics-cmd-auth.c [ ... ] > @@ -379,6 +388,19 @@ void nvmet_execute_auth_send(struct nvmet_req *req) > NVME_AUTH_DHCHAP_FAILURE_INCORRECT_PAYLOAD; > goto done_kfree; > } > + /* > + * The challenge values of this transaction have the length of the > + * hash they were generated for. Any queue can make the controller > + * switch to another hash, so do not go on with a different one. > + */ > + if ((data->auth_id =3D=3D NVME_AUTH_DHCHAP_MESSAGE_REPLY || > + data->auth_id =3D=3D NVME_AUTH_DHCHAP_MESSAGE_SUCCESS2) && > + !nvmet_auth_hash_unchanged(req)) { > + req->sq->authenticated =3D false; > + req->sq->dhchap_step =3D NVME_AUTH_DHCHAP_MESSAGE_FAILURE1; > + req->sq->dhchap_status =3D NVME_AUTH_DHCHAP_FAILURE_HASH_UNUSABLE; > + goto done_kfree; > + } > =20 > switch (data->auth_id) { > case NVME_AUTH_DHCHAP_MESSAGE_REPLY: [Severity: Medium] Can setting dhchap_step to NVME_AUTH_DHCHAP_MESSAGE_FAILURE1 on a Success2 hash mismatch leave the host and target out of sync? Unlike Reply, Success2 is the terminal host message in DH-HMAC-CHAP. Because status stays 0, nvmet_execute_auth_send() completes with NVME_SC_SUCCESS, so the host marks the queue authenticated and never issues a follow-up auth_receive to collect Failure1. Meanwhile, the done: path skips nvmet_auth_sq_free() and nvmet_ctrl_fatal_error() because dhchap_step is neither SUCCESS2 nor FAILURE2, re-arming auth_expired_work while leaving req->sq->authenticated false (and skipping nvmet_auth_insert_psk() when ctrl->concat is set). Should the Success2 mismatch case set dhchap_step to NVME_AUTH_DHCHAP_MESSAGE_FAILURE2 instead, as done_failure1: does? [ ... ] > @@ -503,6 +526,8 @@ static int nvmet_auth_success1(struct nvmet_req *req,= void *d, u32 al) > data->auth_id =3D NVME_AUTH_DHCHAP_MESSAGE_SUCCESS1; > data->t_id =3D cpu_to_le16(req->sq->dhchap_tid); > data->hl =3D hash_len; > + if (!nvmet_auth_hash_unchanged(req)) > + return NVME_AUTH_DHCHAP_FAILURE_HASH_UNUSABLE; > if (req->sq->dhchap_c2) { > if (!ctrl->ctrl_key) { > pr_warn("ctrl %d qid %d no ctrl key\n", [Severity: Medium] Does nvmet_auth_receive_data_len() still size the Success1 minimum buffer length using ctrl->shash_id, preventing this check from running? drivers/nvme/target/fabrics-cmd-auth.c:nvmet_auth_receive_data_len() { ... case NVME_AUTH_DHCHAP_MESSAGE_SUCCESS1: min_len =3D sizeof(struct nvmf_auth_dhchap_success1_data); if (req->sq->dhchap_c2) min_len +=3D nvme_auth_hmac_hash_len(ctrl->shash_id); break; ... } If another queue switches ctrl->shash_id to a larger hash (such as SHA-256 to SHA-512) while this queue is waiting at Success1 with req->sq->dhchap_c2 set, a host submitting auth_receive with an exact-sized al for the original hash fails in nvmet_execute_auth_receive() with NVME_SC_INVALID_FIELD | NVME_STATUS_DNR before nvmet_auth_success1() can send Failure1. That also leaves req->sq->dhchap_step stuck at NVME_AUTH_DHCHAP_MESSAGE_SUCCESS1 without cleaning up the transaction. Should nvmet_auth_receive_data_len() use req->sq->dhchap_hash_id (or sizeof(struct nvmf_auth_dhchap_failure_data) when the hash changed)? --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261205004816.2017= -1-ihopenre@gmail.com?part=3D2