Skip to content

usbboot: Add host-build ASAN tests for bootfiles and DUID parsing - #413

Merged
timg236 merged 3 commits into
raspberrypi:masterfrom
timg236:host-build-test
Oct 28, 2026
Merged

timg236 merged 3 commits into
raspberrypi:masterfrom
timg236:host-build-test

Conversation

@timg236

@timg236 timg236 commented Oct 27, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

The directory next to the executable could fill PATH_MAX, which
would truncate bootfiles.bin when it is appended to form
bootfiles_path. Size exe_msg_dir so that the full path always fits.
get_exe_msg_dir already rejects a directory that is too long. This
also fixes a gcc -Wformat-truncation warning at -O1 and above.
Add a make check target which builds host tests against main.c,
bootfiles.c and decode_duid.c without needing a USB device. The
tests cover bootfiles.bin extraction from valid and corrupt
archives, the order in which the file server searches bootfiles.bin,
the chip and port directories and the embedded msd files, path
traversal, FACTORY_UUID decoding, and that each shipped bootfiles.bin
contains the files that BCM2711 and BCM2712 load.
Build and run make check with clang and the address and undefined
behaviour sanitisers so that memory errors in the bootfiles.bin and
file lookup code fail the pull request.
@timg236
timg236 marked this pull request as ready for review October 28, 2026 08:01
@timg236

timg236 commented Oct 28, 2026

Copy link
Copy Markdown
Collaborator Author

The exe_msg_dir means -01 is no longer required in the ASAN build so I think this is good now.

@timg236
timg236 requested a review from martamomotko October 28, 2026 08:02
@martamomotko

Copy link
Copy Markdown
Contributor

Looks good to me

@timg236
timg236 merged commit 6277162 into raspberrypi:master Oct 28, 2026
2 checks passed
@timg236
timg236 deleted the host-build-test branch October 28, 2026 09:56
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