Skip to content

Parse Security Profile descriptors#3528

Open
flaviens wants to merge 2 commits into
linux-nvme:masterfrom
flaviens:nbft-parse-security
Open

Parse Security Profile descriptors#3528
flaviens wants to merge 2 commits into
linux-nvme:masterfrom
flaviens:nbft-parse-security

Conversation

@flaviens

@flaviens flaviens commented Jul 1, 2026

Copy link
Copy Markdown

Cf. linux-nvme/libnvme#1112
Vibe-coded, please double check.

Copilot AI review requested due to automatic review settings July 1, 2026 06:02

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds parsing support for NBFT Security Profile descriptors in libnvme’s NBFT reader, exposing the descriptor’s flags/secret type and providing access to several heap-backed policy lists and the keypath URI.

Changes:

  • Extends struct libnbft_security to include descriptor flags, secret type, and heap-backed policy list/keypath fields.
  • Implements raw heap object extraction (__get_heap_obj_raw) for non-string heap objects (byte lists).
  • Implements read_security() to populate libnbft_security entries from raw NBFT security descriptors.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
libnvme/src/nvme/nbft.h Extends the public libnbft_security structure with parsed Security Profile fields.
libnvme/src/nvme/nbft.c Adds raw heap object parsing helper and implements Security Profile descriptor parsing.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread libnvme/src/nvme/nbft.c Outdated
Comment thread libnvme/src/nvme/nbft.c
Comment on lines +133 to +144
*output = NULL;
*length = le16_to_cpu(obj.length);
if (*length == 0)
return 0;
if (!in_heap(header, obj)) {
libnvme_msg(ctx, LIBNVME_LOG_DEBUG,
"file %s: field '%s' in descriptor '%s' has invalid offset or length\n",
filename, fieldname, descriptorname);
return -EINVAL;
}
*output = (unsigned char *)header + le32_to_cpu(obj.offset);
return 0;
Comment thread libnvme/src/nvme/nbft.h
/* TODO add fields */
__u16 flags;
__u8 secret_type;
/* list fields point into the raw NBFT; not separately freed */
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants