[PATCH v5 0/9] nvme-auth: switch to use the kernel keyring
Hannes Reinecke
hare at suse.de
Mon Nov 23 07:41:24 PST 2026
On 11/23/26 4:32 PM, Martin Belanger wrote:
>
>
> On 11/23/26 07:59, Martin Belanger wrote:
>> How should nvme-cli determine whether the kernel accepts a key
>> description for DH-HMAC-CHAP?
> [...]
>> 2. Use a separate option for the key description, for example
>> dhchap_key=%s and dhchap_ctrl_key=%s. nvme-cli would then detect
>> support through /dev/nvme-fabrics, as it does for the other
>> options. It also avoids having one string that can mean either a
>> description or key data.
>
> Hi Hannes,
>
> A follow-up with test results. I added DH-HMAC-CHAP support to
> nvme-keysd and tested it with v5 in a VM, with nvmet over TCP and keys
> in both directions. Import, connect by key description, a wrong key,
> and a key replacement all work.
>
Cool.
> For detection, nvme-keysd now uses add_key(): it fails with ENODEV
> when the 'dhchap' key type does not exist. On an older kernel, the
> connect fails with "Invalid DH-CHAP secret <name>", which is clear
> enough. So nvme-cli does not need a new option for this. A separate
> option would still avoid the ambiguity between a description and key
> data, but that is your decision.
>
> One finding: add_key() with the exact secret length, without a
> trailing NUL, fails at random with EPERM. nvme_dhchap_psk_preparse()
> treats the payload as a C string and reads past it (the bug Sashiko
> reported), and base64_decode() returns -1. User space passes the
> length without a NUL, keyctl(1) too. Could v6 parse exactly
> prep->datalen bytes? For now nvme-keysd passes the NUL.
>
Yeah, that should be addressed with v6.
Cheers,
Hannes
--
Dr. Hannes Reinecke Kernel Storage Architect
hare at 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
More information about the Linux-nvme
mailing list