Fix bug 4822 - gex_Segment_Attach() does not validate the size argument#7
Merged
Merged
Conversation
2635e2c to
6931f75
Compare
bonachea
requested changes
May 14, 2026
Member
bonachea
left a comment
There was a problem hiding this comment.
Thanks for the quick fix!
One minor cosmetic request, otherwise LGTM based on source inspection
This commit adds checks on the `size` argument to `gex_Segment_Attach()` which were inadvertently lost early in the GASNet-1 to GASNet-EX transition. Specifically, this enforces all three constraints in the following: > [size] must be a non-zero multiple of GASNET_PAGESIZE, not larger > than gasnet_getMaxLocalSegmentSize() For all three error cases (zero, not page-aligned, or too large) the behavior is to return `GASNET_ERR_BAD_ARG` with the belief that the client might be able to recover. Additionally, while the documentation does not (currently?) require it, the output location `*segment_p` is set to `GEX_SEGMENT_INVALID` to reduce the scope of cascading errors in any clients which do not check the return value. One example failure message (assuming verbose errors are enabled): ``` *** WARNING (proc 0): GASNet gex_Segment_Attach returning an error code: GASNET_ERR_BAD_ARG (Invalid function parameter passed) at /[redacted]/gasnet_internal.c:623 reason: size is too large, exceeds current value of gasnet_getMaxLocalSegmentSize() ```
ec94b67 to
c50e053
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
Adds argument validation to ensure the documented constraints on the
sizeargument togex_Segment_Attach()are satisfied.Status:
The "too large" case tested via
testcore2with smp-conduit, 2 procs, in a Docker container with/dev/shmof size 64MB.The "non-zero" and "multiple of GASNET_PAGESIZE" cases were not directly tested.
A
make run-tests-parwas used to confirm lack of regressions.