[all-commits] [llvm/llvm-project] 64d413: [libc++][hardening] Rework macros for enabling the...

Konstantin Varlamov via All-commits all-commits at lists.llvm.org
Wed Nov 8 11:10:13 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 64d413efdd76f2e6464ae6f578161811b9d12411
      https://github.com/llvm/llvm-project/commit/64d413efdd76f2e6464ae6f578161811b9d12411
  Author: Konstantin Varlamov <varconsteq at gmail.com>
  Date:   2023-11-08 (Wed, 08 Nov 2023)

  Changed paths:
    M libcxx/CMakeLists.txt
    R libcxx/cmake/caches/Generic-debug-mode.cmake
    R libcxx/cmake/caches/Generic-hardened-mode-with-abi-breaks.cmake
    R libcxx/cmake/caches/Generic-hardened-mode.cmake
    A libcxx/cmake/caches/Generic-hardening-mode-debug.cmake
    A libcxx/cmake/caches/Generic-hardening-mode-extensive.cmake
    A libcxx/cmake/caches/Generic-hardening-mode-fast-with-abi-breaks.cmake
    A libcxx/cmake/caches/Generic-hardening-mode-fast.cmake
    R libcxx/cmake/caches/Generic-safe-mode.cmake
    M libcxx/docs/Hardening.rst
    M libcxx/docs/ReleaseNotes/18.rst
    M libcxx/docs/UsingLibcxx.rst
    M libcxx/include/__algorithm/comp_ref_type.h
    M libcxx/include/__algorithm/three_way_comp_ref_type.h
    M libcxx/include/__config
    M libcxx/include/__config_site.in
    M libcxx/test/libcxx/algorithms/alg.sorting/alg.heap.operations/make.heap/complexity.pass.cpp
    M libcxx/test/libcxx/algorithms/alg.sorting/assert.min.max.pass.cpp
    M libcxx/test/libcxx/assertions/modes/debug.pass.cpp
    R libcxx/test/libcxx/assertions/modes/debug_mode_disabled_in_tu.pass.cpp
    R libcxx/test/libcxx/assertions/modes/debug_mode_enabled_in_tu.pass.cpp
    R libcxx/test/libcxx/assertions/modes/debug_mode_not_1_or_0.verify.cpp
    A libcxx/test/libcxx/assertions/modes/enabling_assertions_enables_extensive_mode.pass.cpp
    R libcxx/test/libcxx/assertions/modes/enabling_assertions_enables_safe_mode.pass.cpp
    A libcxx/test/libcxx/assertions/modes/extensive.pass.cpp
    A libcxx/test/libcxx/assertions/modes/fast.pass.cpp
    R libcxx/test/libcxx/assertions/modes/hardened.pass.cpp
    R libcxx/test/libcxx/assertions/modes/hardened_and_debug_mutually_exclusive.verify.cpp
    R libcxx/test/libcxx/assertions/modes/hardened_and_safe_mutually_exclusive.verify.cpp
    R libcxx/test/libcxx/assertions/modes/hardened_mode_disabled_in_tu.pass.cpp
    R libcxx/test/libcxx/assertions/modes/hardened_mode_enabled_in_tu.pass.cpp
    R libcxx/test/libcxx/assertions/modes/hardened_mode_not_1_or_0.verify.cpp
    A libcxx/test/libcxx/assertions/modes/hardening_mode_incorrect_value.sh.cpp
    A libcxx/test/libcxx/assertions/modes/none.pass.cpp
    A libcxx/test/libcxx/assertions/modes/override_with_debug_mode.pass.cpp
    A libcxx/test/libcxx/assertions/modes/override_with_extensive_mode.pass.cpp
    A libcxx/test/libcxx/assertions/modes/override_with_fast_mode.pass.cpp
    A libcxx/test/libcxx/assertions/modes/override_with_unchecked_mode.pass.cpp
    R libcxx/test/libcxx/assertions/modes/safe.pass.cpp
    R libcxx/test/libcxx/assertions/modes/safe_and_debug_mutually_exclusive.verify.cpp
    R libcxx/test/libcxx/assertions/modes/safe_mode_disabled_in_tu.pass.cpp
    R libcxx/test/libcxx/assertions/modes/safe_mode_enabled_in_tu.pass.cpp
    R libcxx/test/libcxx/assertions/modes/safe_mode_not_1_or_0.verify.cpp
    R libcxx/test/libcxx/assertions/modes/unchecked.pass.cpp
    M libcxx/test/libcxx/containers/sequences/array/array.zero/assert.back.pass.cpp
    M libcxx/test/libcxx/containers/sequences/array/array.zero/assert.front.pass.cpp
    M libcxx/test/libcxx/containers/sequences/array/array.zero/assert.subscript.pass.cpp
    M libcxx/test/libcxx/containers/sequences/deque/assert.pop_back.empty.pass.cpp
    M libcxx/test/libcxx/containers/sequences/list/list.modifiers/assert.erase_iter.end.pass.cpp
    M libcxx/test/libcxx/containers/sequences/list/list.modifiers/assert.pop_back.empty.pass.cpp
    M libcxx/test/libcxx/containers/sequences/vector/assert.back.empty.pass.cpp
    M libcxx/test/libcxx/containers/sequences/vector/assert.cback.empty.pass.cpp
    M libcxx/test/libcxx/containers/sequences/vector/assert.cfront.empty.pass.cpp
    M libcxx/test/libcxx/containers/sequences/vector/assert.cindex.oob.pass.cpp
    M libcxx/test/libcxx/containers/sequences/vector/assert.front.empty.pass.cpp
    M libcxx/test/libcxx/containers/sequences/vector/assert.index.oob.pass.cpp
    M libcxx/test/libcxx/containers/sequences/vector/assert.pop_back.empty.pass.cpp
    M libcxx/test/libcxx/containers/unord/unord.map/assert.bucket.pass.cpp
    M libcxx/test/libcxx/containers/unord/unord.map/assert.bucket_size.pass.cpp
    M libcxx/test/libcxx/containers/unord/unord.map/assert.max_load_factor.pass.cpp
    M libcxx/test/libcxx/containers/unord/unord.multimap/assert.bucket.pass.cpp
    M libcxx/test/libcxx/containers/unord/unord.multimap/assert.bucket_size.pass.cpp
    M libcxx/test/libcxx/containers/unord/unord.multimap/assert.max_load_factor.pass.cpp
    M libcxx/test/libcxx/containers/unord/unord.multiset/assert.bucket.pass.cpp
    M libcxx/test/libcxx/containers/unord/unord.multiset/assert.bucket_size.pass.cpp
    M libcxx/test/libcxx/containers/unord/unord.multiset/assert.max_load_factor.pass.cpp
    M libcxx/test/libcxx/containers/unord/unord.set/assert.bucket.pass.cpp
    M libcxx/test/libcxx/containers/unord/unord.set/assert.bucket_size.pass.cpp
    M libcxx/test/libcxx/containers/unord/unord.set/assert.max_load_factor.pass.cpp
    M libcxx/test/libcxx/containers/views/mdspan/extents/assert.conversion.pass.cpp
    M libcxx/test/libcxx/containers/views/mdspan/extents/assert.ctor_from_array.pass.cpp
    M libcxx/test/libcxx/containers/views/mdspan/extents/assert.ctor_from_integral.pass.cpp
    M libcxx/test/libcxx/containers/views/mdspan/extents/assert.ctor_from_span.pass.cpp
    M libcxx/test/libcxx/containers/views/mdspan/extents/assert.obs.pass.cpp
    M libcxx/test/libcxx/containers/views/mdspan/layout_left/assert.conversion.pass.cpp
    M libcxx/test/libcxx/containers/views/mdspan/layout_left/assert.ctor.extents.pass.cpp
    M libcxx/test/libcxx/containers/views/mdspan/layout_left/assert.ctor.layout_right.pass.cpp
    M libcxx/test/libcxx/containers/views/mdspan/layout_left/assert.ctor.layout_stride.pass.cpp
    M libcxx/test/libcxx/containers/views/mdspan/layout_left/assert.index_operator.pass.cpp
    M libcxx/test/libcxx/containers/views/mdspan/layout_left/assert.stride.pass.cpp
    M libcxx/test/libcxx/containers/views/mdspan/layout_right/assert.conversion.pass.cpp
    M libcxx/test/libcxx/containers/views/mdspan/layout_right/assert.ctor.extents.pass.cpp
    M libcxx/test/libcxx/containers/views/mdspan/layout_right/assert.ctor.layout_left.pass.cpp
    M libcxx/test/libcxx/containers/views/mdspan/layout_right/assert.ctor.layout_stride.pass.cpp
    M libcxx/test/libcxx/containers/views/mdspan/layout_right/assert.index_operator.pass.cpp
    M libcxx/test/libcxx/containers/views/mdspan/layout_right/assert.stride.pass.cpp
    M libcxx/test/libcxx/containers/views/mdspan/layout_stride/assert.conversion.pass.cpp
    M libcxx/test/libcxx/containers/views/mdspan/layout_stride/assert.ctor.extents_array.pass.cpp
    M libcxx/test/libcxx/containers/views/mdspan/layout_stride/assert.ctor.extents_span.pass.cpp
    M libcxx/test/libcxx/containers/views/mdspan/layout_stride/assert.stride.pass.cpp
    M libcxx/test/libcxx/containers/views/mdspan/mdspan/assert.conversion.pass.cpp
    M libcxx/test/libcxx/containers/views/mdspan/mdspan/assert.index_operator.pass.cpp
    M libcxx/test/libcxx/containers/views/mdspan/mdspan/assert.size.pass.cpp
    M libcxx/test/libcxx/containers/views/views.span/debug.iterator-indexing.pass.cpp
    M libcxx/test/libcxx/containers/views/views.span/span.cons/assert.iter_sent.pass.cpp
    M libcxx/test/libcxx/containers/views/views.span/span.cons/assert.iter_size.pass.cpp
    M libcxx/test/libcxx/containers/views/views.span/span.cons/assert.other_span.pass.cpp
    M libcxx/test/libcxx/containers/views/views.span/span.cons/assert.range.pass.cpp
    M libcxx/test/libcxx/containers/views/views.span/span.elem/assert.back.pass.cpp
    M libcxx/test/libcxx/containers/views/views.span/span.elem/assert.front.pass.cpp
    M libcxx/test/libcxx/containers/views/views.span/span.elem/assert.op_idx.pass.cpp
    M libcxx/test/libcxx/containers/views/views.span/span.sub/assert.first.pass.cpp
    M libcxx/test/libcxx/containers/views/views.span/span.sub/assert.last.pass.cpp
    M libcxx/test/libcxx/containers/views/views.span/span.sub/assert.subspan.pass.cpp
    M libcxx/test/libcxx/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/assert.deallocate.pass.cpp
    M libcxx/test/libcxx/experimental/memory/memory.resource.adaptor/memory.resource.adaptor.mem/assert.deallocate.pass.cpp
    M libcxx/test/libcxx/iterators/assert.advance.pass.cpp
    M libcxx/test/libcxx/iterators/assert.next.pass.cpp
    M libcxx/test/libcxx/iterators/assert.prev.pass.cpp
    M libcxx/test/libcxx/iterators/bounded_iter/dereference.pass.cpp
    M libcxx/test/libcxx/odr_signature.hardening.sh.cpp
    M libcxx/test/libcxx/ranges/range.adaptors/range.drop.while/assert.begin.pass.cpp
    M libcxx/test/libcxx/ranges/range.adaptors/range.lazy.split/range.lazy.split.inner/assert.equal.pass.cpp
    M libcxx/test/libcxx/ranges/range.adaptors/range.lazy.split/range.lazy.split.outer/assert.equal.pass.cpp
    M libcxx/test/libcxx/ranges/range.factories/range.repeat.view/ctor.piecewise.pass.cpp
    M libcxx/test/libcxx/ranges/range.factories/range.repeat.view/ctor.value.bound.pass.cpp
    M libcxx/test/libcxx/strings/basic.string/string.access/assert.back.pass.cpp
    M libcxx/test/libcxx/strings/basic.string/string.access/assert.cback.pass.cpp
    M libcxx/test/libcxx/strings/basic.string/string.access/assert.cfront.pass.cpp
    M libcxx/test/libcxx/strings/basic.string/string.access/assert.cindex.pass.cpp
    M libcxx/test/libcxx/strings/basic.string/string.access/assert.front.pass.cpp
    M libcxx/test/libcxx/strings/basic.string/string.access/assert.index.pass.cpp
    M libcxx/test/libcxx/strings/basic.string/string.modifiers/assert.erase_iter.null.pass.cpp
    M libcxx/test/libcxx/strings/basic.string/string.modifiers/assert.pop_back.pass.cpp
    M libcxx/test/libcxx/strings/string.view/assert.ctor.length.pass.cpp
    M libcxx/test/libcxx/strings/string.view/assert.ctor.pointer.pass.cpp
    M libcxx/test/libcxx/strings/string.view/string.view.iterators/debug.iterator-indexing.pass.cpp
    M libcxx/test/libcxx/thread/futures/futures.promise/assert.set_exception.pass.cpp
    M libcxx/test/libcxx/thread/futures/futures.promise/assert.set_exception_at_thread_exit.pass.cpp
    M libcxx/test/libcxx/thread/thread.barrier/assert.arrive.pass.cpp
    M libcxx/test/libcxx/thread/thread.barrier/assert.ctor.pass.cpp
    M libcxx/test/libcxx/thread/thread.latch/assert.arrive_and_wait.pass.cpp
    M libcxx/test/libcxx/thread/thread.latch/assert.count_down.pass.cpp
    M libcxx/test/libcxx/thread/thread.latch/assert.ctor.pass.cpp
    M libcxx/test/libcxx/thread/thread.semaphore/assert.ctor.pass.cpp
    M libcxx/test/libcxx/thread/thread.semaphore/assert.release.pass.cpp
    M libcxx/test/libcxx/utilities/assert.exception_guard.no_exceptions.pass.cpp
    M libcxx/test/libcxx/utilities/expected/expected.expected/assert.arrow.pass.cpp
    M libcxx/test/libcxx/utilities/expected/expected.expected/assert.deref.pass.cpp
    M libcxx/test/libcxx/utilities/expected/expected.expected/assert.error.pass.cpp
    M libcxx/test/libcxx/utilities/expected/expected.void/assert.deref.pass.cpp
    M libcxx/test/libcxx/utilities/expected/expected.void/assert.error.pass.cpp
    M libcxx/test/libcxx/utilities/optional/optional.object/optional.object.observe/assert.dereference.pass.cpp
    M libcxx/test/libcxx/utilities/optional/optional.object/optional.object.observe/assert.op_arrow.pass.cpp
    M libcxx/test/std/algorithms/alg.sorting/alg.clamp/assert.ranges_clamp.pass.cpp
    M libcxx/test/std/algorithms/alg.sorting/alg.clamp/ranges.clamp.pass.cpp
    M libcxx/test/std/algorithms/alg.sorting/alg.heap.operations/pop.heap/assert.pop_heap.pass.cpp
    M libcxx/test/std/algorithms/alg.sorting/alg.heap.operations/pop.heap/assert.ranges_pop_heap.pass.cpp
    M libcxx/test/std/algorithms/alg.sorting/alg.heap.operations/sort.heap/complexity.pass.cpp
    M libcxx/test/std/algorithms/alg.sorting/alg.heap.operations/sort.heap/ranges_sort_heap.pass.cpp
    M libcxx/test/std/algorithms/alg.sorting/alg.merge/inplace_merge_comp.pass.cpp
    M libcxx/test/std/algorithms/alg.sorting/alg.three.way/lexicographical_compare_three_way_comp.pass.cpp
    M libcxx/test/std/utilities/utility/utility.unreachable/assert.unreachable.pass.cpp
    M libcxx/test/support/container_debug_tests.h
    M libcxx/test/support/test.support/test_check_assertion.pass.cpp
    M libcxx/utils/ci/buildkite-pipeline.yml
    M libcxx/utils/ci/run-buildbot
    M libcxx/utils/data/ignore_format.txt
    M libcxx/utils/libcxx/test/params.py

  Log Message:
  -----------
  [libc++][hardening] Rework macros for enabling the hardening mode. (#70575)

1. Instead of using individual "boolean" macros, have an "enum" macro
`_LIBCPP_HARDENING_MODE`. This avoids issues with macros being
mutually exclusive and makes overriding the hardening mode within a TU
more straightforward.

2. Rename the safe mode to debug-lite.

This brings the code in line with the RFC:
https://discourse.llvm.org/t/rfc-hardening-in-libc/73925

Fixes #65101




More information about the All-commits mailing list