From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1A5CD345741 for ; Tue, 7 Apr 2026 10:47:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.130 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775558881; cv=none; b=ubIA/GTM/oJkqyeuXbHDdeJup2Mhhos8wdhn48rDvF3E6SOZUPVagqefakSDZbErEQ9zSzH8IRF9h/O4AgdJWfkvw3JghZOeA7aomRjRAag2VSr0Pj/ZokuUagB4mUas33ZXsEALOAjKGXE/SoHjBpz3RHYNGyNDgeJCtTbMlS0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775558881; c=relaxed/simple; bh=65JyhmluF4n+YKAFolKmo0uN7HZW1Xycp5NYAwo/1VU=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=CwM+THXcfHCHZ2nzASY5vdE1udP+8hEmBsJoYf/1p+TN2j5qJtKCd3r8zauq//KC4lfiuv57hFouuA073htH5gsimkByqgSWMsp+V2BrnQ5++Oh+f0gHgxjGsqPXDSpyONq2A8v7xA3K5U1GIYWOAscTo9rL9RpbfoSmvgEQMEM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de; spf=pass smtp.mailfrom=suse.de; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=DZ34gODj; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=ycieUkG6; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=DZ34gODj; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=ycieUkG6; arc=none smtp.client-ip=195.135.223.130 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="DZ34gODj"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="ycieUkG6"; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="DZ34gODj"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="ycieUkG6" 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 5D4534E3F2; Tue, 7 Apr 2026 10:47:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1775558878; 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=VxwlNxQdC9flJRNusgvHrRLd9XlseS96nRkGKLydNW0=; b=DZ34gODjKN5AzG4TIinRbNrs0kRJvppb+LEsSh0cHx5JRZTMeZzH96tGyL3u0Wmo8sbGP5 /Y0QbSD5GHvlfbnUaYA7L82v7QOdKAJFbqBy7ofk+t5QR1cZbVZ4WjV6w6Zf9DFSc8hm16 IbrFMgWgzXN8mOdcA5k5/FjwNj5KEV8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1775558878; 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=VxwlNxQdC9flJRNusgvHrRLd9XlseS96nRkGKLydNW0=; b=ycieUkG64m2B4M9VqFhOgmbkwIU7mR5iLgIzEW/eGghjjUix9zsWck2k+8UxkOwj/72fE7 CLD7xN0mE+IK5sCA== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1775558878; 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=VxwlNxQdC9flJRNusgvHrRLd9XlseS96nRkGKLydNW0=; b=DZ34gODjKN5AzG4TIinRbNrs0kRJvppb+LEsSh0cHx5JRZTMeZzH96tGyL3u0Wmo8sbGP5 /Y0QbSD5GHvlfbnUaYA7L82v7QOdKAJFbqBy7ofk+t5QR1cZbVZ4WjV6w6Zf9DFSc8hm16 IbrFMgWgzXN8mOdcA5k5/FjwNj5KEV8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1775558878; 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=VxwlNxQdC9flJRNusgvHrRLd9XlseS96nRkGKLydNW0=; b=ycieUkG64m2B4M9VqFhOgmbkwIU7mR5iLgIzEW/eGghjjUix9zsWck2k+8UxkOwj/72fE7 CLD7xN0mE+IK5sCA== 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 48A634A0B0; Tue, 7 Apr 2026 10:47:58 +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 cvhFEd7g1GlNLQAAD6G6ig (envelope-from ); Tue, 07 Apr 2026 10:47:58 +0000 Message-ID: <77b7fc41-840e-43cc-a417-cbd78a9ba6aa@suse.de> Date: Tue, 7 Apr 2026 12:47:57 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] nvme: expose TLS mode To: Daniel Wagner , Keith Busch , Christoph Hellwig , Sagi Grimberg Cc: linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org References: <20260401-expose-tls-mode-v1-1-433a83d1d23f@kernel.org> Content-Language: en-US From: Hannes Reinecke In-Reply-To: <20260401-expose-tls-mode-v1-1-433a83d1d23f@kernel.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Score: -4.30 X-Spam-Level: X-Spamd-Result: default: False [-4.30 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; FUZZY_RATELIMITED(0.00)[rspamd.com]; RCVD_VIA_SMTP_AUTH(0.00)[]; MIME_TRACE(0.00)[0:+]; ARC_NA(0.00)[]; TO_DN_SOME(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:mid,suse.de:email] X-Spam-Flag: NO On 4/1/26 10:52, Daniel Wagner wrote: > It is not possible to determine the active TLS mode from the > presence or absence of sysfs attributes like tls_key, > tls_configured_key, or dhchap_secret. > > With the introduction of the concat mode and optional DH-CHAP > authentication, different configurations can result in identical > sysfs state. This makes user space detection unreliable. > > Expose the TLS mode explicitly to allow user space to > unambiguously identify the active configuration and avoid > fragile heuristics in nvme-cli. > > Signed-off-by: Daniel Wagner > --- > I am extending the test suite for nvme-cli to cover the use case of > nvme connect --tls/--concat. > > Currently, nvme-cli uses heuristics to determine whether --tls was used > to initiate the connection. With the introduction of --concat, these > heuristics are no longer reliable. > > By exposing the TLS mode explicitly, nvme config can now generate a > configuration based on the currently active connection. > > $ nvme config --scan --dump --output-format json /dev/nvme1 > [ > { > "hostnqn":"nqn.2014-08.org.nvmexpress:uuid:befdec4c-2234-11b2-a85c-ca77c773af36", > "hostid":"befdec4c-2234-11b2-a85c-ca77c773af36", > "dhchap_key":"DHHC-1:01:1+pb0VSbn3cBrOhwP5SHa6gwlbPikdZ0mmBKKXC74Sm0s0pb:", > "subsystems":[ > { > "nqn":"nqn.io-1", > "ports":[ > { > "transport":"tcp", > "traddr":"192.168.30.30", > "trsvcid":"4420", > "dhchap_key":"DHHC-1:01:1+pb0VSbn3cBrOhwP5SHa6gwlbPikdZ0mmBKKXC74Sm0s0pb:", > "dhchap_ctrl_key":"DHHC-1:01:uTcIEwLZsEoVJucx7sKVvzfwOTAfJ9ZGcvYWswHwF41mMSW1:", > "tls":true, > "keyring":".nvme" > } > ] > } > ] > } > ] > --- > drivers/nvme/host/sysfs.c | 18 ++++++++++++++++++ > 1 file changed, 18 insertions(+) > > diff --git a/drivers/nvme/host/sysfs.c b/drivers/nvme/host/sysfs.c > index 16c6fea4b2db..c4b5241371d6 100644 > --- a/drivers/nvme/host/sysfs.c > +++ b/drivers/nvme/host/sysfs.c > @@ -810,6 +810,23 @@ const struct attribute_group nvme_dev_attrs_group = { > EXPORT_SYMBOL_GPL(nvme_dev_attrs_group); > > #ifdef CONFIG_NVME_TCP_TLS > +static ssize_t tls_mode_show(struct device *dev, > + struct device_attribute *attr, char *buf) > +{ > + struct nvme_ctrl *ctrl = dev_get_drvdata(dev); > + const char *mode; > + > + if (ctrl->opts->tls) > + mode = "tls"; > + else if (ctrl->opts->concat) > + mode = "concat"; > + else > + mode = "none"; > + > + return sysfs_emit(buf, "%s\n", mode); > +} > +static DEVICE_ATTR_RO(tls_mode); > + > static ssize_t tls_key_show(struct device *dev, > struct device_attribute *attr, char *buf) > { > @@ -845,6 +862,7 @@ static struct attribute *nvme_tls_attrs[] = { > &dev_attr_tls_key.attr, > &dev_attr_tls_configured_key.attr, > &dev_attr_tls_keyring.attr, > + &dev_attr_tls_mode.attr, > NULL, > }; > > Why not modify the 'is_visible' function to hide the attribute when TLS is not enabled? That would avoid the awkward 'none' setting ... 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