[all-commits] [llvm/llvm-project] fb7d25: [libc++][string] Replace ASAN volatile wrapper wit...

Vitaly Buka via All-commits all-commits at lists.llvm.org
Thu Mar 5 21:10:14 PST 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: fb7d25556a3ac6b48deaa63a9195cf47b830e372
      https://github.com/llvm/llvm-project/commit/fb7d25556a3ac6b48deaa63a9195cf47b830e372
  Author: Vitaly Buka <vitalybuka at google.com>
  Date:   2026-03-05 (Thu, 05 Mar 2026)

  Changed paths:
    M libcxx/include/string

  Log Message:
  -----------
  [libc++][string] Replace ASAN volatile wrapper with memory barrier (#184693)

The previous `_LIBCPP_ASAN_VOLATILE_WRAPPER` approach was used to
prevent
speculative loads of string data before the short/long state was
determined. This patch replaces that mechanism with a more explicit
`__annotate_memory_barrier()` using an empty volatile assembly block.

This PR is inspired by #183457 and by downstream false positive on
`__get_long_size`. It fails same way as `__get_long_pointer` before we
have
`_LIBCPP_ASAN_VOLATILE_WRAPPER`. Barrier approach avoids
expanding `_LIBCPP_ASAN_VOLATILE_WRAPPER` for size_t, and to
in general looks more readable.

I failed to create reasonable reproducer for test, I suspect it requires
precise set of compiler flags, and libc++ site_config which will be hard
to maintain in test.



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


More information about the All-commits mailing list