From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-170.mta1.migadu.com (out-170.mta1.migadu.com [95.215.58.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6EB422D2397 for ; Sat, 18 Apr 2026 11:43:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.170 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776512590; cv=none; b=e6qlqvrgMfZIEdinWQiWWSqKC1cLXSTC57f4jHBEjhpvMB3wiSQPirTWEC8dWEOpyFTBtZtS0WD4ClqjaVtlRC45LxaQ5bBY6S88oosEPvth6i/MR13kdoOGOJlsLUSLnQ6O27StRHbfBTBLeOZY/7bj8eQqSlEJS7Z9+yfyyzY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776512590; c=relaxed/simple; bh=Zk/Xbk5hbC97xGhB8xhReMX0EshM2qrPg5tkYfWm5VA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=YmCS7eDDV+1Oo+5/wsfJGTAKFzBl9mL12lt1+Vs+V2/vfmRZ1n/hBN/I+Xz9rXkU9Y+ohRIN7jMJ+uoj6ROK9e8o13sCMnHOsEP+6h3440nhQ3PT+9IIoYiEptXYj8ivOVCOs1y4AfBGA3xzPrXVTmQvkCIqWvBb1LYPye5zfVM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=CDAgTTSm; arc=none smtp.client-ip=95.215.58.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="CDAgTTSm" Date: Sat, 18 Apr 2026 13:42:46 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1776512577; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=pJ5pOiV3uVbrwJIxnnvzTrlyc9egBQkFtQd756B21gY=; b=CDAgTTSmQsTHUAWzdEUMgIE7TbVCPONiZhpyuG4j9WbItNQtxW/b4JIArBSCRXQg/BoCtN 42dzAi0IZI4AUDbtM6hFJ3PoYL7rs4/MurPcwOrSgb2y0VVfrn+6q01GoI/gqNHaox5ubu 94vqGUyQKGNkkO84XgdO2EP/JYL7VsA= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Thorsten Blum To: Hannes Reinecke Cc: Christoph Hellwig , Sagi Grimberg , Chaitanya Kulkarni , Jens Axboe , stable@vger.kernel.org, linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/3] nvmet-auth: Don't log DHCHAP keys in nvmet_setup_auth() Message-ID: References: <20260303190350.78705-2-thorsten.blum@linux.dev> <20260303190350.78705-4-thorsten.blum@linux.dev> <2b40f93f-f987-423d-8263-ba9b10a1bcaf@suse.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2b40f93f-f987-423d-8263-ba9b10a1bcaf@suse.de> X-Migadu-Flow: FLOW_OUT On Wed, Mar 04, 2026 at 08:19:59AM +0100, Hannes Reinecke wrote: > On 3/3/26 20:03, Thorsten Blum wrote: > > When debug logging is enabled, nvmet_setup_auth() logs the host and > > controller DHCHAP key bytes. Remove the keys from debug logs to avoid > > exposing key material. > > > > Fixes: db1312dd9548 ("nvmet: implement basic In-Band Authentication") > > Cc: stable@vger.kernel.org > > Signed-off-by: Thorsten Blum > > --- > > drivers/nvme/target/auth.c | 10 ++++------ > > 1 file changed, 4 insertions(+), 6 deletions(-) > > > > diff --git a/drivers/nvme/target/auth.c b/drivers/nvme/target/auth.c > > index 2eadeb7e06f2..f24add0bb86f 100644 > > --- a/drivers/nvme/target/auth.c > > +++ b/drivers/nvme/target/auth.c > > @@ -199,10 +199,9 @@ u8 nvmet_setup_auth(struct nvmet_ctrl *ctrl, struct nvmet_sq *sq) > > ctrl->host_key = NULL; > > goto out_free_hash; > > } > > - pr_debug("%s: using hash %s key %*ph\n", __func__, > > + pr_debug("%s: using hash %s\n", __func__, > > ctrl->host_key->hash > 0 ? > > - nvme_auth_hmac_name(ctrl->host_key->hash) : "none", > > - (int)ctrl->host_key->len, ctrl->host_key->key); > > + nvme_auth_hmac_name(ctrl->host_key->hash) : "none"); > > nvme_auth_free_key(ctrl->ctrl_key); > > if (!host->dhchap_ctrl_secret) { > > @@ -217,10 +216,9 @@ u8 nvmet_setup_auth(struct nvmet_ctrl *ctrl, struct nvmet_sq *sq) > > ctrl->ctrl_key = NULL; > > goto out_free_hash; > > } > > - pr_debug("%s: using ctrl hash %s key %*ph\n", __func__, > > + pr_debug("%s: using ctrl hash %s\n", __func__, > > ctrl->ctrl_key->hash > 0 ? > > - nvme_auth_hmac_name(ctrl->ctrl_key->hash) : "none", > > - (int)ctrl->ctrl_key->len, ctrl->ctrl_key->key); > > + nvme_auth_hmac_name(ctrl->ctrl_key->hash) : "none"); > > out_free_hash: > > if (ret) { > > Without the key the pr_debug calls are pretty much pointless anyway, > so you might want to remove them, too. > > However, these debug prints really help when trying to figure out > authentication failures. > I think it would be better to add a compile-time option to disable > these outputs entirely. > > I'll send a patch. Did you ever send a patch? I couldn't find anything. The code hasn't changed either and the keys are still logged (same for patch 3/3). Thanks, Thorsten