Skip to content

uefi-sct: RegularExpression: pass GUID pointer to %g in MatchString test - #372

Open
wangsim wants to merge 1 commit into
tianocore:masterfrom
wangsim:fix-regex-matchstring-guid-ptr-371
Open

wangsim wants to merge 1 commit into
tianocore:masterfrom
wangsim:fix-regex-matchstring-guid-ptr-371

Conversation

@wangsim

@wangsim wangsim commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

Two RecordAssertion() calls in RegularExpressionBBTestFunction.c print the regular expression syntax type with %g, but pass *RegExSyntaxTypeList3 and *RegExSyntaxTypeList2, i.e. an EFI_GUID by value. SctLib's %g implementation does va_arg (args, EFI_GUID *), so it expects a pointer.

On AArch64 (AAPCS64) a 16-byte aggregate passed to a variadic function is not passed by reference, so va_arg() consumes only the first 8 bytes of the GUID and treats them as the pointer. GuidToString() then dereferences it and the test takes a data abort. For EFI_REGEX_SYNTAX_TYPE_POSIX_EXTENDED_GUID {5F05B20F-4A56-C231-FA0B-A7B1F110041D} the faulting address is 0xC2314A565F05B20F, the first 8 bytes of that GUID.

Pass the EFI_GUID pointer instead, as %g requires.

Fixes #371

Two RecordAssertion() calls in RegularExpressionBBTestFunction.c print the
regular expression syntax type with %g, but pass *RegExSyntaxTypeList3 and
*RegExSyntaxTypeList2, i.e. an EFI_GUID by value. SctLib's %g implementation
does va_arg (args, EFI_GUID *), so it expects a pointer.

On AArch64 (AAPCS64) a 16-byte aggregate passed to a variadic function is not
passed by reference, so va_arg() consumes only the first 8 bytes of the GUID
and treats them as the pointer. GuidToString() then dereferences it and the
test takes a data abort. For EFI_REGEX_SYNTAX_TYPE_POSIX_EXTENDED_GUID
{5F05B20F-4A56-C231-FA0B-A7B1F110041D} the faulting address is
0xC2314A565F05B20F, the first 8 bytes of that GUID.

Pass the EFI_GUID pointer instead, as %g requires.

Fixes tianocore#371

Signed-off-by: Simon Wang <simowang@nvidia.com>
@wangsim
wangsim marked this pull request as ready for review October 14, 2026 15:20

@anncheng-arm anncheng-arm left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

looks good to me

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.

[Bug]: RegularExpression MatchString tests pass EFI_GUID by value to a %g format, causing a data abort on AArch64

2 participants