fix: System shared memory boundary check - #8335
Merged
Merged
Conversation
yinggeh
commented
Aug 7, 2025
| create_byte_size=create_byte_size, | ||
| register_offset=register_offset, | ||
| ) | ||
| offset = 1 |
Contributor
Author
There was a problem hiding this comment.
Smaller offset for stricter check.
yinggeh
commented
Aug 7, 2025
| error_msg = [] | ||
| self._configure_server() | ||
| create_byte_size = self.SYS_PAGE_SIZE + self.DEFAULT_SHM_BYTE_SIZE | ||
| register_offset = self.SYS_PAGE_SIZE |
Contributor
Author
There was a problem hiding this comment.
Before this fix, out-of-bound would not be triggered if register_offset is non-zero.
yinggeh
commented
Aug 7, 2025
| size_t shm_region_size = 0; | ||
| if (it->second->byte_size_ > 0) { | ||
| shm_region_end += it->second->byte_size_ - 1; | ||
| shm_region_size += it->second->byte_size_; |
Contributor
Author
There was a problem hiding this comment.
Remove -1 for better readability.
Contributor
There was a problem hiding this comment.
Thanks! This actually avoids a potential unsigned integer underflow if both offset and byte_size are 0. I had just encountered this underflow last week.
tanmayv25
approved these changes
Aug 8, 2025
yinggeh
added a commit
that referenced
this pull request
Aug 9, 2025
mc-nv
pushed a commit
that referenced
this pull request
Aug 11, 2025
mc-nv
added a commit
that referenced
this pull request
Aug 14, 2025
22 tasks
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.
What does the PR do?
Followup from the original request. Similar bug in shared memory boundary checks.
Modify test cases to include
register_offsetin boundary checks.Checklist
<commit_type>: <Title>Commit Type:
Check the conventional commit type
box here and add the label to the github PR.
Related PRs:
#8334
Where should the reviewer start?
Test plan:
L0_shared_memory
32964778
Caveats:
Background
Related Issues: (use one of the action keywords Closes / Fixes / Resolves / Relates to)