Skip to content

Conversation

@frej
Copy link
Contributor

@frej frej commented May 13, 2025

Previously all bifs selected by the erl_internal:comp_op/2 predicate was erroneously considered safe from an aliasing perspective. This is not true as they, depending on the argument types, could access internal elements of a term which has been destructively updated. As this makes the destructive update visible, this is illegal and should not happen.

To fix this problem, we have to consider all comparison bifs as aliasing operations, thus avoiding the problem described above. Unfortunately this is a very pessimistic solution, and by making use of type information we can avoid forced aliasing when it can be determined that the comparison bif will be reduced to a simple tag test.

This is less conservative fix than the one presented in #9833.

Closes #9813.

@github-actions
Copy link
Contributor

github-actions bot commented May 13, 2025

CT Test Results

    2 files    333 suites   8m 23s ⏱️
  847 tests   843 ✅ 4 💤 0 ❌
5 602 runs  5 598 ✅ 4 💤 0 ❌

Results for commit 3df731a.

♻️ This comment has been updated with latest results.

To speed up review, make sure that you have read Contributing to Erlang/OTP and that all checks pass.

See the TESTING and DEVELOPMENT HowTo guides for details about how to run test locally.

Artifacts

// Erlang/OTP Github Action Bot

frej and others added 2 commits May 13, 2025 12:49
Previously all bifs selected by the erl_internal:comp_op/2 predicate
was erroneously considered safe from an aliasing perspective. This is
not true as they, depending on the argument types, could access
internal elements of a term which has been destructively updated. As
this makes the destructive update visible, this is illegal and should
not happen.

To fix this problem, we have to consider all comparison bifs as
aliasing operations, thus avoiding the problem described
above. Unfortunately this is a very pessimistic solution, and by
making use of type information we can avoid forced aliasing when it
can be determined that the comparison bif will be reduced to a simple
tag test.

This is less conservative fix than the one presented in erlang#9833.

Co-authored-by: Isabell H. <isabell@erlang.org>
Closes erlang#9813.
@frej frej force-pushed the frej/fix-gh9813 branch from d120a04 to 3df731a Compare May 13, 2025 10:51
@frej
Copy link
Contributor Author

frej commented May 13, 2025

Hang on, I based this on the completely wrong base. Re-pushed now.

@lucioleKi lucioleKi added team:VM Assigned to OTP team VM testing currently being tested, tag is used by OTP internal CI labels May 13, 2025
@lucioleKi lucioleKi self-assigned this May 13, 2025
@lucioleKi lucioleKi requested a review from jhogberg May 13, 2025 12:11
@lucioleKi lucioleKi merged commit 624ddf0 into erlang:master May 14, 2025
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

Potential compiler bug with OTP-28 release candidates

3 participants