diff options
| author | Xin LI <delphij@FreeBSD.org> | 2026-09-03 05:23:53 +0000 |
|---|---|---|
| committer | Xin LI <delphij@FreeBSD.org> | 2026-09-03 06:51:36 +0000 |
| commit | c4f458da4411872df4968e02ca292389df462b7b (patch) | |
| tree | 15a224a5974fcc83b9aa9e51df57492cf2371ae1 /source/API/SBBreakpointOptionCommon.cpp | |
| parent | 18094609d301540526d3d57e92705bc989d29986 (diff) | |
Exercise each of the 32-bit BIOS Parameter Block and FSInfo fields that
readboot() decodes, using values whose most significant byte has its high
bit set. Each case checks two things: that fsck_msdosfs(8) reports the
full unsigned 32-bit value back on stdout, and that nothing writes a
sanitizer runtime error to stderr.
The second check is what catches a byte-at-a-time decode. Shifting such
a byte left by 24 is undefined, but every compiler we use wraps it into
the same bit pattern, so the decoded value alone cannot tell a correct
decode from an overflowing one. In a WITH_UBSAN build bsd.sanitizer.mk
compiles with -fsanitize=undefined and -fsanitize-recover=undefined, so
the shift is reported on stderr and execution continues, which the test
can then assert on. Against the byte-at-a-time decode these cases fail
in a WITH_UBSAN build and pass without it.
Note that the stderr check also fails on unrelated undefined behavior
that these images reach anywhere in fsck_msdosfs(8), which is intended.
MFC after: 1 week
Diffstat (limited to 'source/API/SBBreakpointOptionCommon.cpp')
0 files changed, 0 insertions, 0 deletions
