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

Clean initialization for dynamic storage #364

Open
elfenpiff opened this issue Sep 2, 2024 · 0 comments
Open

Clean initialization for dynamic storage #364

elfenpiff opened this issue Sep 2, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@elfenpiff
Copy link
Contributor

elfenpiff commented Sep 2, 2024

Overview

Currently, the initialization of the dynamic storage is handled by setting the permissions to write only during initialization and then adjust them to read/write after the initialization was completed.
But, this approach only works for linux since FreeBSD, MacOs and Windows seem to be unable to adjust the permissions of the shared memory after it was created.

Every posix shared memory based dynamic storage also contains a version number to ensure that non-compatible versions are unable to connect. If the version number is zero it is also regarded as uninitialized. The problem is, that this is undefined behavior but works most of the time since the operating system zero's the memory before providing it to the application.

A cleaner approach would be to use the permissions again. FreeBSD and MacOs use a trampoline file to point to the correct shared memory, due to the name length limitations. Instead of adjusting the shared memory access rights, one could work with the access rights of the trampoline file which would offer a clean solution.
On Windows we could implement a similar approach.

Details

  • The actual concept is affected by it but does not require change, since the algorithm is correct but the platform does not support the permission initialization strategy.
  • The platform needs to support permission adjustments of shared memory after the shared memory was created.
@elfenpiff elfenpiff added the bug Something isn't working label Sep 2, 2024
@elfenpiff elfenpiff mentioned this issue Sep 2, 2024
17 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant