-
Notifications
You must be signed in to change notification settings - Fork 625
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
Fix ems allocator unaligned memory access on riscv64 #2140
Fix ems allocator unaligned memory access on riscv64 #2140
Conversation
/* each hmu node is 4-byte aligned and not 8-byte aligned, | ||
add 4 bytes padding to make below left/right/parent fields | ||
8-byte aligned, so that we can directly access them */ | ||
uint32 __padding; |
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.
Hi,
Cannot find where you set this variable but generally very good change for the project as currently ubsan wamr build fails with unaligned access
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.
Do you mean that before this change, ubsan reports unaligned access issue, and after this PR, the issue isn't reported again? Maybe I should apply the change for all the targets, including x86-64.
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.
Hi
Now it reports unaligned access but unfortunately I didn't try to fix padding for x86-64 now, and I hope something like that could help
…e#2140) Make `hmu_tree_node` struct packed and add 4 padding bytes before `kfc_tree_root_buf` field in `gc_heap_struct` struct to ensure the `left/right/parent` fields in `hmu_tree_node` are 8-byte aligned on the 64-bit target which doesn't support unaligned memory access. Fix the issue reported in bytecodealliance#2136.
Add padding bytes to ensure the left/right/parent fields in struct hmu_tree_node
are 8-byte aligned on the target which doesn't support unaligned memory access.