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

Fix share-preserve-copy of shared magic ref #5273

Merged

Conversation

sverker
Copy link
Contributor

@sverker sverker commented Oct 7, 2021

Fixes #5271

Example:

    MRef = atomics:new(...),
    persistent_term:put(key, {MRef, MRef}),
    % Let MRef be garbage collected
    {BrokenMRef, BrokenMRef} = persistent_term:get(key),

Would also cause same problem for normal messages passing when built with config --enable-sharing-preserving.

@sverker sverker added team:VM Assigned to OTP team VM fix labels Oct 7, 2021
@sverker sverker self-assigned this Oct 7, 2021
@sverker sverker force-pushed the sverker/erts/persistent_put_shared_magic_ref branch from 03ef571 to cd6012f Compare October 11, 2021 16:59
@sverker sverker added the testing currently being tested, tag is used by OTP internal CI label Oct 11, 2021
@sverker sverker force-pushed the sverker/erts/persistent_put_shared_magic_ref branch from ca20e4c to 9c5d883 Compare October 13, 2021 19:18
If the same magic reference was referred more than once
the reference counter was not increased, leading to later
premature deallocation with all the horrors that could cause.

Example:
Mref = ets:new(x,[]),
persistent_term:put(key, {Mref, Mref}).
into 'sverker/22/copy-shared-magic-ref/OTP-17700'
into 'sverker/23/copy-shared-magic-ref/OTP-17700'
into 'sverker/24/copy-shared-magic-ref/OTP-17700'
with CopyLiterals boolean argument.
to test the sharing preserve copy for combinations of
different term types and degrees of sharing.
@sverker sverker force-pushed the sverker/erts/persistent_put_shared_magic_ref branch from 9c5d883 to 610da14 Compare October 14, 2021 11:11
@sverker sverker merged commit 6b21a16 into erlang:maint Oct 15, 2021
@sverker sverker deleted the sverker/erts/persistent_put_shared_magic_ref branch June 16, 2022 10:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix team:VM Assigned to OTP team VM testing currently being tested, tag is used by OTP internal CI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants