Skip to content

Fix shmget wrapper to preserve original key values on first use.#1191

Closed
gkliu wants to merge 1 commit intodmtcp:mainfrom
gkliu:main
Closed

Fix shmget wrapper to preserve original key values on first use.#1191
gkliu wants to merge 1 commit intodmtcp:mainfrom
gkliu:main

Conversation

@gkliu
Copy link
Copy Markdown

@gkliu gkliu commented Mar 1, 2025

When wrapping the shmget function, this PR fixes the handling of non-IPC_PRIVATE keys.

Previously, when VIRTUAL_TO_REAL_SHM_KEY returns -1 (indicating the key is being used for the first time by user code), we need to preserve the original key value rather than attempting to translate it. This ensures that explicit key values specified by the application are maintained correctly.

This fix is important for applications that rely on specific key values for their shared memory regions, as it ensures the DMTCP wrapper doesn't modify these values on first use.

… typically indicates that this key is being used for the first time by user code. In this case, we need to preserve the original key value rather than translating it. This ensures that explicit key values specified by the application are maintained, which is important for applications that rely on specific key values for their shared memory regions.
@karya0
Copy link
Copy Markdown
Member

karya0 commented Mar 2, 2025

Thanks for the bug report and the PR, @gkliu! Unfortunately, this is not enough and so I went ahead and created a new PR #1192 with the fix along with a test case. I hope you won't mind it.

@karya0
Copy link
Copy Markdown
Member

karya0 commented Mar 2, 2025

@gkliu : Please review #1192 and see if that fixes your use case.

@gkliu
Copy link
Copy Markdown
Author

gkliu commented Mar 8, 2025

Many thanks, @karya0. I tested my use cases and they are working well. Really appreciated it!

@gkliu gkliu closed this Mar 8, 2025
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