Skip to content
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

Avoid misaligned pointer access on AArch64 #63

Closed
wants to merge 1 commit into from

Conversation

hebasto
Copy link

@hebasto hebasto commented Feb 21, 2024

As the data type is a pointer to uint8_t, accessing memory via a pointer of a larger type, such as (uint64_t*)data, results in misalignment. This can be problematic on ARM hardware. Specifically:

  1. It triggers "misaligned-pointer-use" UBSan warnings.
  2. It triggers "-Wcast-align=strict" warnings when compiling with GCC.

As the `data` type is a pointer to `uint8_t`, accessing memory via a
pointer of a larger type, such as `(uint64_t*)data`, results in
misalignment. This can be problematic on ARM hardware. Specifically:
1. It triggers "misaligned-pointer-use" UBSan warnings.
2. It triggers "-Wcast-align=strict" warnings when compiling with GCC.
@davidben
Copy link
Contributor

davidben commented Sep 6, 2024

Oops, I put together #65 before noticing that you'd already done this. I think adding the wrapper functions is a little tidier (avoids the macros depending on some random local variables), but I've no strong preference between the two.

I'll try to find someone to merge one of the two, since it seems folks might not be paying attention to this repo these days.

@pwnall
Copy link
Member

pwnall commented Sep 6, 2024

Apologies, I just noticed this now.

#65 looks like it covers the same problem, and I'm in contact with the author. Closing in favor of that PR, which is about to get merged.

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.

3 participants