-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
[ubsan] load of misaligned address in ripple/ours/src/ripple/basics/SlabAllocator.h #4528
Comments
seelabs
added a commit
to seelabs/rippled
that referenced
this issue
May 22, 2023
Unaligned load and stores are supported by both intel and arm CPUs, however, this is UB in C++. Replacing this with a `memcpy` fixes the undefined behavior and the compiled assembly code is equivalent to the original (so there is no penalty to using memcpy).
seelabs
added a commit
to seelabs/rippled
that referenced
this issue
May 30, 2023
Unaligned load and stores are supported by both intel and arm CPUs, however, this is UB in C++. Replacing this with a `memcpy` fixes the undefined behavior and the compiled assembly code is equivalent to the original (so there is no penalty to using memcpy).
intelliot
pushed a commit
that referenced
this issue
May 31, 2023
Misaligned load and store operations are supported by both Intel and ARM CPUs. However, in C++, these operations are undefined behavior (UB). Substituting these operations with a `memcpy` fixes this UB. The compiled assembly code is equivalent to the original, so there is no performance penalty to using memcpy. For context: The unaligned load and store operations fixed here were originally introduced in the slab allocator (#4218).
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Issue Description
The undefined behavior sanitizer is reporting misaligned load and stores in the slab allocator.
Steps to Reproduce
Run the unit tests with the undefined behavior sanitizer (-Dsan=undefined)
Actual Result
The following runtime errors were reported in the SlabAllocator: (current branch: 629ed5c)
ripple/ours/src/ripple/basics/SlabAllocator.h:79:57: runtime error: store to misaligned address 0x7f91cdc002a4 for type 'uint8_t *', which requires 8 byte alignment
ripple/ours/src/ripple/basics/SlabAllocator.h:118:24: runtime error: load of misaligned address 0x7f91d03ffda4 for type 'uint8_t *', which requires 8 byte alignment
ripple/ours/src/ripple/basics/SlabAllocator.h:118:24: runtime error: load of misaligned address 0x7f91c5dff67c for type 'uint8_t *', which requires 8 byte alignment
ripple/ours/src/ripple/basics/SlabAllocator.h:139:52: runtime error: store to misaligned address 0x7f91c9bffbbc for type 'uint8_t *', which requires 8 byte alignment
The text was updated successfully, but these errors were encountered: