Skip to content

Comments

Add payload info all and payload info nonstatic commands for Dauntless signed image descriptors#213

Open
vsk-ant wants to merge 1 commit intogoogle:mainfrom
vsk-ant:payload-info-all-gaps
Open

Add payload info all and payload info nonstatic commands for Dauntless signed image descriptors#213
vsk-ant wants to merge 1 commit intogoogle:mainfrom
vsk-ant:payload-info-all-gaps

Conversation

@vsk-ant
Copy link

@vsk-ant vsk-ant commented Feb 20, 2026

Add payload info all and payload info nonstatic commands for Dauntless signed image descriptors.

@google-cla
Copy link

google-cla bot commented Feb 20, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

Copy link
Collaborator

@jhand2 jhand2 left a comment

Choose a reason for hiding this comment

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

Thank you! Left a few minor comments.

Comment on lines 193 to 212
int fd = open(image_file, O_RDONLY, 0);
if (fd == -1) {
fprintf(stderr, "Error opening file %s: %s\n", image_file, strerror(errno));
return -1;
}
struct stat statbuf;
if (fstat(fd, &statbuf)) {
fprintf(stderr, "fstat error: %s\n", strerror(errno));
goto cleanup2;
}
if (statbuf.st_size > SIZE_MAX) {
fprintf(stderr, "file too large\n");
goto cleanup2;
}

uint8_t* image = mmap(NULL, statbuf.st_size, PROT_READ, MAP_PRIVATE, fd, 0);
if (image == MAP_FAILED) {
fprintf(stderr, "mmap error: %s\n", strerror(errno));
goto cleanup2;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: Duplicated from the payload_info function. What do you think about refactoring the code to read a payload file into a shared function?

Copy link
Author

Choose a reason for hiding this comment

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

Updated, thanks for the feedback.


printf("Non-static regions:\n");
bool found_non_static = false;
for (uint8_t i = 0; i < info_all.region_count; i++) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Seems like the region printing code could be shared with the all function by passing an attribute mask. e.g. print_regions(&info_all, /*skip_mask=*/IMAGE_REGION_STATIC)

Copy link
Author

Choose a reason for hiding this comment

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

Done

examples/htool.c Outdated
.func = htool_payload_info_all,
},
{
.verbs = (const char*[]){"payload", "info", "gaps", NULL},
Copy link
Collaborator

Choose a reason for hiding this comment

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

Payload descriptors are required to have no gaps (all flash regions must be described in the regions list). Otherwise they are considered invalid and the RoT will reject them.

So I think instead this command can just be payload info nonstatic.

Copy link
Author

Choose a reason for hiding this comment

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

Done, thanks!

@vsk-ant vsk-ant changed the title Add payload info all and payload info gaps commands with extended descriptor parsing and region gap detection Add payload info all and payload info nonstatic commands for Titan image inspection Feb 21, 2026
@vsk-ant vsk-ant force-pushed the payload-info-all-gaps branch from 935ff3d to efebef1 Compare February 21, 2026 20:04
@vsk-ant vsk-ant changed the title Add payload info all and payload info nonstatic commands for Titan image inspection Add payload info all and payload info nonstatic commands for Dauntless signed image descriptors Feb 21, 2026
@vsk-ant vsk-ant force-pushed the payload-info-all-gaps branch from efebef1 to 89df90d Compare February 21, 2026 22:17
@vsk-ant vsk-ant requested a review from jhand2 February 24, 2026 20:41
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