diff --git a/.cirrus.yml b/.cirrus.yml index ad5e2901b..28ddf8309 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -20,7 +20,7 @@ environment: CCACHE_MAXSIZE: "2G" lint_task: - skip: $CIRRUS_CRON == '' && $CIRRUS_PR == '' + skip: $CIRRUS_PR == '' container: dockerfile: ci/Dockerfile cpu: 4 @@ -56,7 +56,7 @@ lint_task: path: build/ci clang17_ubuntu_debug_task: - skip: $CIRRUS_BRANCH != 'main' && $CIRRUS_TAG == '' + skip: $CIRRUS_TAG == '' container: dockerfile: ci/Dockerfile diff --git a/CHANGES b/CHANGES index 64a90861d..4b2829074 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,23 @@ +1.10.0-dev.103 | 2024-01-09 14:00:44 +0100 + + * Remove references to Cirrus cron task. (Benjamin Bannier, Corelight) + + We do not schedule CI runs with cron anymore. + + * Run CI ASAN task also for PRs. (Benjamin Bannier, Corelight) + + * Skip tests around stack size on macos with ASAN. (Benjamin Bannier, Corelight) + + These tests produce false positives on macos with ASAN which seem hard + to get rid of. Disable them on the smallest possible subset of setups. + + * Fix ASAN false positives introduces with d332827aee7d70cdb642631d7a289751e1d8a36a. (Benjamin Bannier, Corelight) + + Since the logging changes of d332827aee7d70cdb642631d7a289751e1d8a36a + ASAN reports false positives on e.g., macos-13.6.2 with its + clang-1500.0.40.1. This patch slightly reorganizes the code so these + false positiives are not triggered. + 1.10.0-dev.98 | 2024-01-09 13:55:27 +0100 * Bump dependencies. (Benjamin Bannier, Corelight) diff --git a/VERSION b/VERSION index c4c108aa1..380ae78fa 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.10.0-dev.98 +1.10.0-dev.103 diff --git a/hilti/runtime/src/fiber.cc b/hilti/runtime/src/fiber.cc index 38f5568b3..2e67bedb5 100644 --- a/hilti/runtime/src/fiber.cc +++ b/hilti/runtime/src/fiber.cc @@ -124,7 +124,12 @@ void __fiber_switch_trampoline(void* argsp) { auto from = args->from; auto to = args->to; - HILTI_RT_FIBER_DEBUG("stack-switcher", fmt("switching from %s to %s", *from, *to)); + // Explicitly put the log message on the stack to work around ASAN false positives on macos. + if ( detail::unsafeGlobalState()->debug_logger && + detail::unsafeGlobalState()->debug_logger->isEnabled(debug_stream_fibers) ) { + const auto msg = fmt("switching from %s to %s", from, to); + HILTI_RT_FIBER_DEBUG("stack-switcher", msg); + } if ( from->_type == detail::Fiber::Type::SharedStack ) from->_stack_buffer.save(); @@ -351,8 +356,13 @@ void ASAN_NO_OPTIMIZE detail::Fiber::_finishSwitchFiber(const char* tag) { size_t prev_size = 0; __sanitizer_finish_switch_fiber(current->_asan.fake_stack, &prev_bottom, &prev_size); - HILTI_RT_FIBER_DEBUG(tag, fmt("asan-finish: prev-stack=%s/%zu fake-stack=%p", prev_bottom, prev_size, - current->_asan.fake_stack)); + // Explicitly put the log message on the stack to work around ASAN false positives on macos. + if ( detail::unsafeGlobalState()->debug_logger && + detail::unsafeGlobalState()->debug_logger->isEnabled(debug_stream_fibers) ) { + const auto msg = + fmt("asan-finish: prev-stack=%s/%zu fake-stack=%p", prev_bottom, prev_size, current->_asan.fake_stack); + HILTI_RT_FIBER_DEBUG(tag, msg); + } // By construction, the very first time this method is called, we must just // have finished switching over from the main fiber. Record its stack. diff --git a/hilti/runtime/src/tests/fiber.cc b/hilti/runtime/src/tests/fiber.cc index 328f1ace1..3174b22d6 100644 --- a/hilti/runtime/src/tests/fiber.cc +++ b/hilti/runtime/src/tests/fiber.cc @@ -324,8 +324,16 @@ static int fibo(int i) { return x; } +bool isMacosAsan() { +#if defined(HILTI_HAVE_ASAN) && defined(__APPLE__) + return true; +#else + return false; +#endif +} -TEST_CASE("stack-size-check") { +// This test produces false positives on macos with ASAN. +TEST_CASE("stack-size-check" * doctest::skip(isMacosAsan())) { hilti::rt::init(); auto f = [&](hilti::rt::resumable::Handle* r) { diff --git a/tests/Baseline/spicy.rt.stack-check/output b/tests/Baseline/spicy.rt.stack-check/output index f2f6b5550..59c54f0e4 100644 --- a/tests/Baseline/spicy.rt.stack-check/output +++ b/tests/Baseline/spicy.rt.stack-check/output @@ -1,2 +1,2 @@ ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. -[error] terminating with uncaught exception of type hilti::rt::StackSizeExceeded: not enough stack space remaining (<...>/stack-check.spicy:18:5) +[error] terminating with uncaught exception of type hilti::rt::StackSizeExceeded: not enough stack space remaining (<...>/stack-check.spicy:21:5) diff --git a/tests/spicy/rt/stack-check.spicy b/tests/spicy/rt/stack-check.spicy index 8b1715060..5554264d9 100644 --- a/tests/spicy/rt/stack-check.spicy +++ b/tests/spicy/rt/stack-check.spicy @@ -1,7 +1,10 @@ +# This test produces false positives on macos with ASAN. +# @TEST-REQUIRES: ! sh ./isMacosAsan.sh +# # @TEST-EXEC-FAIL: echo . | spicy-driver %INPUT >output 2>&1 # @TEST-EXEC: btest-diff output # -# Check that stack overflows are caught before we crash. +# @TEST-DOC: Check that stack overflows are caught before we crash. module Foo; @@ -23,3 +26,7 @@ function fibo(n: int64) : int64 { public type X = unit() { x: int8 { fibo(100000); } }; + +# @TEST-START-FILE isMacosAsan.sh +have-sanitizer && [[ "$OSTYPE" == "darwin"* ]] +# @TEST-END-FILE