-
Notifications
You must be signed in to change notification settings - Fork 332
regression: CopyMem() in ad8692e copies out of bounds #725
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
I'm not 100% sure that we can really count on the string being null terminated since other places also seem to just copy the first 100 char16s. |
The CopyMem() introduced in "ad8692e avoid EFIv2 runtime services on Apple x86 machines" copies 100 CHAR16s no matter what. NX enabled firmware catches this and the boot breaks on those systems when the value is smaller than that and it's up against a page boundary with a page that's not mapped as readable. https://uefi.org/specs/UEFI/2.10/04_EFI_System_Table.html says that FirmwareVendor is a pointer to a NUL terminated string that identifies the vendor that produces the system firmware for the platform. Signed-off-by: Jan Setje-Eilers <Jan.SetjeEilers@oracle.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Jan and I have tested this and think it should work unless someone has done something truly unlikely with their string placement.
Which means we'll find out when someone has.
|
Was there a reason not to just StrnCmp in place as in earlier commit of this PR? Possible (lack of) alignment?
|
| * So right now we're only copying ten bytes, because Apple is the | ||
| * only vendor we're testing against. | ||
| */ | ||
| CopyMem(vendorbuf, vendor, 10); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apologies if I'm missing something, but vendorbuf is not used after this CopyMem, but rather vendor, which looks like a mistake.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ping @vathpela - I'm not sure if closed issues and merged PRs are monitored in this repo, i.e. should I create a new Issue?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess also ping @jsetje
The CopyMem() introduced in
ad8692e avoid EFIv2 runtime services on Apple x86 machines copies 100 CHAR16s no matter what. NX enabled firmware catches this and the boot breaks on those systems.
https://uefi.org/specs/UEFI/2.10/04_EFI_System_Table.html says that FirmwareVendor is a pointer to a null terminated string that identifies the vendor that produces the system firmware for the platform. If we can rely on it being null terminated then we don't need to copy the string at all.