memory_buffer_alloc should use a sufficient default alignment #311
Labels
No labels
api-spec
bug
CLA requested
CLA valid
compliance
DO NOT MERGE
duplicate
enhancement
feature branch
good first issue
HEADER FORMATTING ISSUE
help wanted
Information
invalid
Jira status: AWAITING REVIEW
Jira status: CLOSED
Jira status: DONE
Jira status: IN PROGRESS
Jira status: IN REVIEW
Jira status: OPEN
Jira status: REOPENED
Jira status: RESOLVED
mirrored
mirror internally
needs: backports
needs: ci
needs: design review
needs: preceding PR
needs: review
needs: work
notabug
open for community contribution
Product Backlog
question
ready for merge
security
stale
type: bug
type: enhancement
type: question
web pages
wontfix
writing
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
gh-ARMmbed/mbed-crypto#311
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Description
The MEMORY_BUFFER_ALLOC module defaults to aligning blocks on a 4-byte boundary.
On architectures that require 8- or 16-byte alignment for some data, this results in buggy code.
The fix is to default
MBEDTLS_MEMORY_ALIGN_MULTIPLEto something sensible. In C11, that's_Alignof(max_align_t). In older C dialects, should we usesizeof(char*)(backward compatible) or2 * sizeof(char*)(I don't know of a machine where it's required, but it can improve performance with vector instructions)?To test, we should run a job in
all.shwithMBEDTLS_MEMORY_BUFFER_ALLOC_Cenabled and UBSan enabled (it detects misaligned pointer accesses). At the moment,MBEDTLS_MEMORY_BUFFER_ALLOC_Cis tested viaconfig.plfull. In Mbed TLS, we've changed that to a dedicatedcomponent_test_memory_buffer_allocator. We should wait until this change is sideported to crypto, then modify the test component to enable UBSan.To reproduce:
Issue request type
Internal Jira reference: https://jira.arm.com/browse/IOTCRYPT-967