Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 86f52ba2f2c1597d4d4c7450c370c8b77c38cd9f
      
https://github.com/WebKit/WebKit/commit/86f52ba2f2c1597d4d4c7450c370c8b77c38cd9f
  Author: Marcus Plutowski <[email protected]>
  Date:   2026-09-10 (Thu, 10 Sep 2026)

  Changed paths:
    M Source/bmalloc/libpas/src/libpas/pas_mte_config.c
    M Source/bmalloc/libpas/src/libpas/pas_mte_config.h
    M Source/bmalloc/libpas/src/libpas/pas_runtime_config.h

  Log Message:
  -----------
  [libpas] Replace MTE enablement bool with a tri-state
https://bugs.webkit.org/show_bug.cgi?id=323820
rdar://187058868

Reviewed by Yusuke Suzuki.

pas_runtime_config lives in the reserved slots at the start of WTF's
g_config, which is zero-initialized at load time. Previously the MTE
enablement bit was a bool with 0 meaning either uninitialized or
not enabled. However, this means that in order to ensure that the
enablement-state was initialized, a consumer would need to call through
the out-of-line pas_mte_is_mte_enabled function which calls into
dispatch_once_f and is thus too heavy to have on the malloc hot path.

This patch replaces the enablement bool with a tristate so that
consumers can perform a relaxed load to determine whether or not they
need to go down the slow path, now appropriately renamed
pas_mte_is_mte_enabled_slow(). The tristate can be read with a relaxed
load because the slow-path uses dispatch_once_f to ensure that multiple
callers don't actually initialize libpas more than once, and the state
will only be set once.

In the new model, the consumer-facing pas_mte_is_mte_enabled() function
is an inlineable hot-path, while pas_mte_is_mte_enabled_slow() handles
the dispatch_once_f.

* Source/bmalloc/libpas/src/libpas/pas_runtime_config.h: add pas_mte_state,
  replace pas_runtime_config::enabled with mte_state
* Source/bmalloc/libpas/src/libpas/pas_mte_config.h:
(pas_mte_is_mte_enabled_unchecked): report the field as-is, for libpas' own use
(pas_mte_is_mte_disabled_unchecked):
(pas_mte_is_mte_enabled): new inlineable entry point handling all three states
* Source/bmalloc/libpas/src/libpas/pas_mte_config.c:
(pas_mte_do_initialization): accumulate locally, publish with a release store
(pas_mte_is_enabled):
(pas_report_config):
(pas_mte_is_mte_enabled_slow): Renamed from pas_mte_is_mte_enabled.
(pas_mte_is_mte_enabled): Deleted.

Canonical link: https://commits.webkit.org/320852@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to