Fix MbedTLS allocations at runtime #163
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As was recently reported on Matrix for CachyOS on Nova Custom V56 and in Dasharo/dasharo-issues#1001 for FreeBSD on Protectli V1410, EFI runtime can crash when dealing with SecureBoot EFI variables as in #129 (comment).
I originally fixed it only in a single file which showed up in #129 (comment) and somehow concluded that it should be enough which wasn't true. This attempt should be more successful, making it a PR so that more people can take a look and/or test.
The issue can be reproduced in QEMU and probably anywhere else. I installed Debian, reset SecureBoot keys, downloaded https://github.com/Foxboron/sbctl/releases/tag/0.15.4 binary and tried following https://wiki.cachyos.org/configuration/secure_boot_setup/#setting-up-sbctl.
sbctl enroll-keys -m
failed the same way it was described on Matrix. The build from this branch succeeded.Read commit messages for more details.
P.S. Maybe this should also be sent upstream, which lacks these and some other fixes made previously.