[webkit-changes] [WebKit/WebKit] d2ba4a: Fix the failure memory order argument to compareEx...

AtariDreams noreply at github.com
Fri Dec 22 13:05:21 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: d2ba4a07e209c5cb422ff5f5c50802e1f0582438
      https://github.com/WebKit/WebKit/commit/d2ba4a07e209c5cb422ff5f5c50802e1f0582438
  Author: Rose <83477269+AtariDreams at users.noreply.github.com>
  Date:   2023-12-22 (Fri, 22 Dec 2023)

  Changed paths:
    M Source/WebKit/Platform/IPC/StreamClientConnectionBuffer.h
    M Source/WebKit/Platform/IPC/StreamServerConnectionBuffer.h

  Log Message:
  -----------
  Fix the failure memory order argument to compareExchangeStrong
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 at 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




More information about the webkit-changes mailing list