-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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 the failure memory order argument to compareExchangeStrong #22049
Conversation
EWS run on previous version of this PR (hash 202718e) |
EWS run on previous version of this PR (hash a96afde) |
EWS run on previous version of this PR (hash dd07c43) |
EWS run on previous version of this PR (hash b476b50) |
EWS run on previous version of this PR (hash f19157d) |
@kkinnunen-apple Could you please review this? |
@aproskuryakov Do you think this is safe to merge? Considering the failure only means we have to acquire anyway, no behavior should really change. I would be surprised if it generated different binary honestly. |
I am not familiar with this code, neither WebKit side nor C++ library side. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will need a review from someone who's familiar with WTF::Atomic
.
I think the change is good, but you should have explained better in your changelog that the status quo is undefined behavior. Can you update your commit message to reflect that?
From https://en.cppreference.com/w/cpp/atomic/atomic/compare_exchange
If failure is stronger than success or(until C++17) is one of std::memory_order_release and std::memory_order_acq_rel, the behavior is undefined.
Done! |
EWS run on previous version of this PR (hash d811db7) |
EWS run on previous version of this PR (hash ef1bc7b) |
EWS run on previous version of this PR (hash 886c433) |
EWS run on previous version of this PR (hash a7ba673) |
@aproskuryakov Can we please merge this? |
Please add the url above in the commit message as well. The url provides details to explain that this is the correct fix. Thanks. |
@MenloDorian Can we please merge this now? |
I'll merge this later today. |
EWS run on previous version of this PR (hash dc080e5) |
Alright. I added the requested changes to the actual pull request message. |
EWS run on current version of this PR (hash 83b9eb4) |
https://bugs.webkit.org/show_bug.cgi?id=266649 Reviewed by Kimmo Kinnunen. The failure memory order cannot be release or acq_rel. Clang since llvm/llvm-project@fed5644 diagnoses an invalid argument. Furthermore, the current way it is written is undefined behavior anyway. From https://en.cppreference.com/w/cpp/atomic/atomic/compare_exchange: "If failure is stronger than success or(until C++17) is one of std::memory_order_release and std::memory_order_acq_rel, the behavior is undefined." * Source/WebKit/Platform/IPC/StreamClientConnectionBuffer.h: (IPC::StreamClientConnectionBuffer::tryAcquire): Use memory_order_acquire as fallback. * Source/WebKit/Platform/IPC/StreamServerConnectionBuffer.h: (IPC::StreamServerConnectionBuffer::tryAcquire): Ditto. Canonical link: https://commits.webkit.org/272461@main
83b9eb4
to
d2ba4a0
Compare
Committed 272461@main (d2ba4a0): https://commits.webkit.org/272461@main Reviewed commits have been landed. Closing PR #22049 and removing active labels. |
d2ba4a0
83b9eb4
π§ͺ styleπ iosπ macπ wpeπ wincairoπ ios-simπ mac-AS-debugπ§ͺ wpe-wk2π§ͺ webkitperlπ§ͺ ios-wk2π§ͺ api-macπ§ͺ api-wpeπ§ͺ ios-wk2-wptπ§ͺ mac-wk1π gtkπ§ͺ api-iosπ§ͺ mac-wk2π§ͺ gtk-wk2π tvπ§ͺ mac-AS-debug-wk2π§ͺ api-gtkπ tv-simπ§ͺ mac-wk2-stressπ watchπ watch-sim