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

StructStoreShared::revalidate() may leave an inconsistent state #6

Open
mertemba opened this issue Mar 6, 2023 · 0 comments
Open

Comments

@mertemba
Copy link
Owner

mertemba commented Mar 6, 2023

In this section:
https://github.com/jellysheep/structstore/blob/e118e694314b5face75181ff6d6ea0bd11719687/src/structstore_shared.hpp#L207-L231

If the call to mmap_existing_shm() fails/throws and revalidate() returns early, the struct is left in an inconsistent state (shm_ptr probably points to inaccessible memory; shm_fd is open, but apparently fails checks in mmap_existing_shm()).
To mitigate this, the two functions should update the members only when all checks were successful.

cc @joruof

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

No branches or pull requests

1 participant