Parse Security Profile descriptors#3528
Open
flaviens wants to merge 2 commits into
Open
Conversation
There was a problem hiding this comment.
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_securityto 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 populatelibnbft_securityentries 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 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; |
| /* 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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Cf. linux-nvme/libnvme#1112
Vibe-coded, please double check.