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 0BBFB606A69C for ; Mon, 30 Nov 2026 07:11:33 +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=SCGuUPe1; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=PDakNIHY; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=Q2XpNDvN; dkim=neutral header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=ZzeaeO16; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=sPjNntIk 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: Content-Type:In-Reply-To:From:References:Cc:To:Subject:MIME-Version:Date: Message-ID:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Unsubscribe-Post: List-Owner; bh=CFTSwBy19dotorRJehbY3M/l+dGYiqUZxZ6HZjYa6DQ=; b=SCGuUPe1DeLnDX KFdMXNfTQgMpRhPbRj1huvFRhByWWUCqlPeQLg6Apqqqo1/q9cJD2rWa5mA1lXzgfgLtjZ19TueYG eaAedefcGC3+hIqf5UIXKi6ptF0zh/2lB1hfuOJalGlg7FTtSeTA22vGyl6YWrcUEy8djyjvFEkCs 4i6Rx8G2PvL5uhHrGpQUq3L5z0iBUn12hL5Ak2gMQjukhtoU818WxCDhBSLDCcqFC4m++dAk7hGH/ 3Un/7sGCZb+2GEt1L7z2eGujyPSHkObQ4fCmFR+NKn8TMrfXMPvPaXzHlpAW/tQuZtU6VTH3QviaB npLML0Du8G7cFZlljZew==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xXvXv-00000003WEx-07y3; Mon, 30 Nov 2026 07:11:31 +0000 Received: from smtp-out1.suse.de ([195.135.223.130]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xXvXh-00000003W8r-3pGx for linux-nvme@lists.infradead.org; Mon, 30 Nov 2026 07:11:19 +0000 Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 77C1122723; Mon, 30 Nov 2026 07:11:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1796022674; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CFTSwBy19dotorRJehbY3M/l+dGYiqUZxZ6HZjYa6DQ=; b=PDakNIHYsZMVdk4JA7lZXGOHZHXbjXJGXzWKw4/30MEPb9/947xVjaugLwlu4EJ7f9y7Kl h+NCgdE1cPfzcJ660fhHwXvCwiUgxj17ef+ftEM/fG4T6sSqSEbB4bw+dhktlPYCaC3+s9 F0f3U9/5RTce01REsYn/DLMEm/4/6K4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1796022674; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CFTSwBy19dotorRJehbY3M/l+dGYiqUZxZ6HZjYa6DQ=; b=Q2XpNDvNnztBRzmh1cLK0fv5nhrZZfYuvGGgiHB2EiIDvEhZF6KQ74FxnpSBLYYNEkl1TV j8RprFOTSqi+auBg== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1796022673; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CFTSwBy19dotorRJehbY3M/l+dGYiqUZxZ6HZjYa6DQ=; b=ZzeaeO16c3baqI+g1HFVn5Hr+7Eiyox+aOdQ3144wrOEwww1ra2KLgwAuP5G4CIvya3d5t 3Q9cm5/44+9MAHh/WOuU/OObzEI6TJgtbQSIvRRRDlBEXGlNxfRsPprI/UpDlEbKAPZNbe YrPt1rODrNf+S6ov2GRK7sfQckTXgQE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1796022673; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CFTSwBy19dotorRJehbY3M/l+dGYiqUZxZ6HZjYa6DQ=; b=sPjNntIk5KPWoT+HiSjeM+MWSMwQqDTRKfuEW6Ak/Ea48erGWZclolVddA2wZ+2VVsBiKy 7n9rLZOvDeTa8RCQ== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 2C68913326; Mon, 30 Nov 2026 07:11:13 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id rYHXAZEhDWt2RgAAD6G6ig (envelope-from ); Mon, 30 Nov 2026 07:11:13 +0000 Message-ID: Date: Mon, 30 Nov 2026 08:11:12 +0100 X-Archived-By: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] nvme-auth: validate DH value length when reusing a group To: Andrew Stellman , Keith Busch , Christoph Hellwig , Sagi Grimberg Cc: Jens Axboe , linux-nvme@lists.infradead.org References: <20261129135247.80697-1-bugs@stellman-greene.com> Content-Language: en-US From: Hannes Reinecke In-Reply-To: <20261129135247.80697-1-bugs@stellman-greene.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Level: X-Spamd-Result: default: False [-13.29 / 50.00]; SUSE_INTERNAL_BYPASS(-9.00)[]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-0.998]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; XM_UA_NO_VERSION(0.01)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; ARC_NA(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; RCVD_TLS_ALL(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_FIVE(0.00)[6]; FROM_EQ_ENVFROM(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,suse.de:email,stellman-greene.com:email] X-Spam-Score: -13.29 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261129_231118_112863_B0AD09D2 X-CRM114-Status: GOOD ( 24.22 ) X-Spam-Score: -4.4 (----) 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=-22.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 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 On 11/29/26 2:52 PM, Andrew Stellman wrote: > From: Andrew Stellman > > When a DH-HMAC-CHAP challenge names the DH group already in use, > nvme_auth_process_dhchap_challenge() jumps to skip_kpp before the DH > value length checks. A challenge with an empty DH value for a non-NULL > group, or with a DH value for the NULL group, then returns 0. The > fresh-group path rejects both. > > Apply the same two checks, with the same error and status codes, on > the reuse path before the jump. These challenges are now rejected with > -EPROTO. > > Tested on mainline 7.4.0-rc4-g4f069ab1ec24 in an arm64 QEMU guest, > using a test-only debugfs hook that calls the function with synthetic > challenges: both malformed reuse cases returned 0 without the patch and > -EPROTO with it, and the three control cases (an empty DH value for a > fresh group, and valid challenges for a reused NULL and non-NULL group) > gave the same results either way. Not tested over a live NVMe/TCP > connection. > > The issue was found by Claude Opus 5.5, Claude Opus 4.8, OpenAI GPT-6 > Sol and Claude Sonnet 5.5 running Quality Playbook, an LLM-driven code > review tool: > https://github.com/andrewstellman/quality-playbook > The fix was drafted with OpenAI GPT-6 (Codex) and this changelog with > Claude Opus 5.5, and both were reviewed by me. > > Fixes: b61775d185a3 ("nvme-auth: Diffie-Hellman key exchange support") > Signed-off-by: Andrew Stellman > --- > A reproducer is available on request. > > drivers/nvme/host/auth.c | 13 +++++++++++++ > 1 file changed, 13 insertions(+) > > diff --git a/drivers/nvme/host/auth.c b/drivers/nvme/host/auth.c > index 9a3da74dec5aa..c45f88ca5db34 100644 > --- a/drivers/nvme/host/auth.c > +++ b/drivers/nvme/host/auth.c > @@ -219,6 +219,19 @@ static int nvme_auth_process_dhchap_challenge(struct nvme_ctrl *ctrl, > > if (chap->dhgroup_id == data->dhgid && > (data->dhgid == NVME_AUTH_DHGROUP_NULL || chap->dh_tfm)) { > + if (data->dhgid != NVME_AUTH_DHGROUP_NULL && !dhvlen) { > + dev_warn(ctrl->device, "qid %d: empty DH value\n", > + chap->qid); > + chap->status = NVME_AUTH_DHCHAP_FAILURE_DHGROUP_UNUSABLE; > + return -EPROTO; > + } > + if (data->dhgid == NVME_AUTH_DHGROUP_NULL && dhvlen) { > + dev_warn(ctrl->device, > + "qid %d: invalid DH value for NULL DH\n", > + chap->qid); > + chap->status = NVME_AUTH_DHCHAP_FAILURE_INCORRECT_PAYLOAD; > + return -EPROTO; > + } > dev_dbg(ctrl->device, > "qid %d: reuse existing DH group %s\n", > chap->qid, gid_name); Reviewed-by: Hannes Reinecke Cheers, Hannes -- Dr. Hannes Reinecke Kernel Storage Architect hare@suse.de +49 911 74053 688 SUSE Software Solutions GmbH, Frankenstr. 146, 90461 Nürnberg HRB 36809 (AG Nürnberg), GF: I. Totev, A. McDonald, W. Knoblich