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

coll/barrier: fix op undercount and buffer overflow for non-power-of-two #67

Merged
merged 1 commit into from
Jan 26, 2024

Conversation

omor1
Copy link
Member

@omor1 omor1 commented Jan 25, 2024

For non-power-of-two node counts, the barrier code would undercount the number of required iterations by one and, therefore, the number of scheduled operations by two. This would result in underallocating the buffer for scheduled operations and, subsequently, a buffer overflow, which would trash memory used internally by malloc and cause a crash.

Fix this by counting correctly. This overcounts (and overallocates) the scheduled operations for power-of-two node counts, but this is harmless, other than allocating an additional 80 bytes.

@omor1 omor1 requested a review from JiakunYan January 25, 2024 21:50
@JiakunYan JiakunYan merged commit 8abbbeb into master Jan 26, 2024
9 checks passed
@omor1 omor1 deleted the fix/barrier branch February 7, 2024 04:17
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.

2 participants