[Git][ghc/ghc][wip/terrorjack/asan] 42 commits: gitlab-ci: Drop vestigial references to make build system
Cheng Shao pushed to branch wip/terrorjack/asan at Glasgow Haskell Compiler / GHC Commits: 701088db by Ben Gamari at 2026-07-01T10:34:03-04:00 gitlab-ci: Drop vestigial references to make build system - - - - - 62d54a53 by Ben Gamari at 2026-07-01T10:34:03-04:00 gitlab-ci: Add support for running specifying a job's testsuite ways - - - - - 7f97ac2c by Ben Gamari at 2026-07-01T10:34:03-04:00 gitlab-ci: Run llvm testsuite ways in llvm jobs Addresses #25762. - - - - - 7ea75116 by ARATA Mizuki at 2026-07-01T10:34:03-04:00 testsuite: Add normalise_ddump_deriv setup function Some tests check the result of -ddump-deriv, which may contain INLINE pragmas depending on optimization flags. With normalise_ddump_deriv setup function, INLINE pragmas are stripped off. - - - - - c7a8199f by ARATA Mizuki at 2026-07-01T10:34:03-04:00 testsuite: Use -dsuppress-idinfo to make tests more robust Previously, T18052a and T21755 were failing on 'optasm' and 'optllvm' ways because of visibility of unfoldings. - - - - - a12122e5 by ARATA Mizuki at 2026-07-01T10:34:03-04:00 testsuite: Use a trick to keep large objects alive Previously, T17574 and T19381 were failing on 'optasm' and 'optllvm' ways because of compiler optimizations. Change them to use NOINLINE to prevent unwanted optimizations. - - - - - 1a95b327 by ARATA Mizuki at 2026-07-01T10:34:03-04:00 testsuite: Only run T24224 in 'normal' way This test is a frontend-only one and breaks if optimizations are enabled. - - - - - 8abea737 by ARATA Mizuki at 2026-07-01T10:34:03-04:00 testsuite: Ignore T18118's stderr When optimizations are enabled, the compiler emits a warning (You cannot SPECIALISE ...). The message is not important, so ignore it. - - - - - 9453a722 by ARATA Mizuki at 2026-07-01T10:34:03-04:00 testsuite: Mark T816 and tc216 broken with optimizations These tests are about type checking, so we should not care too much if they are broken with optimizations. See #26952 - - - - - 0aef9ec0 by Ben Gamari at 2026-07-01T10:34:03-04:00 testsuite: ds014 is not longer broken It now appears to pass in the ways it was marked as broken in. Closes #14901. - - - - - 4692d1e4 by Ben Gamari at 2026-07-01T10:34:03-04:00 testsuite: Only run stack cloning tests in the normal way These are too dependent upon code generation specifics to pass in most other ways. - - - - - c154df26 by ARATA Mizuki at 2026-07-01T10:34:03-04:00 testsuite: Update options_ghc_fbyte-code The `-fbyte-code` option used to be overriden by `-fllvm` but it is no longer true since !14872 was merged. I updated the test to accept the new behavior. Closes #27049 - - - - - 5d8bb7b5 by ARATA Mizuki at 2026-07-01T10:34:03-04:00 testsuite: Only run T22744 in 'normal' way This test takes a long time on optimized ways. - - - - - d1e74c8e by ARATA Mizuki at 2026-07-01T10:34:03-04:00 testsuite: Disable tests that use -finfo-table-map on llvm ways Currently, -finfo-table-map does not work with -fllvm. See #26435 - - - - - 3bf38c84 by ARATA Mizuki at 2026-07-01T10:34:03-04:00 testsuite: Don't run T24726 on optimized ways If optimizations are enabled, the rewrite rule just fires and -drule-check will report nothing. - - - - - e4eef116 by ARATA Mizuki at 2026-07-01T10:34:03-04:00 testsuite: Use -fno-unoptimized-core-for-interpreter when running LinkableUsage01/02 Optimizations for the bytecode interpreter are considered experimental, and need a flag to be enabled. - - - - - 234a9872 by ARATA Mizuki at 2026-07-01T10:34:03-04:00 testsuite: Suppress unwanted optimizations on T25284 - - - - - 99a2af2f by ARATA Mizuki at 2026-07-01T10:34:03-04:00 testsuite: Don't run stack_big_ret with optimizations Stack layout may change with optimizations enabled. - - - - - 04c836df by ARATA Mizuki at 2026-07-01T10:34:04-04:00 testsuite: Mark memo001 broken on optimized ways See #27396 - - - - - 1a8a24f4 by ARATA Mizuki at 2026-07-01T10:34:04-04:00 testsuite: Mark syn-perf broken on optimized ways See #27398 - - - - - 40412093 by Duncan Coutts at 2026-07-01T10:34:50-04:00 Add a test for thread scheduler fairness It also tests that the interval timer and context switching works. We also test that fairness is lost when the context switching interval is too coarse for the duration of the test. We add this test before doing surgery on the interval timer, so we have decent coverage. - - - - - 3f34d557 by Duncan Coutts at 2026-07-01T10:34:50-04:00 Make exported stop/startTimer no-ops, and rename internal functions Specifically, internally rename: stop/startTimer to pause/unpauseTimer stop/startTicker to pause/unpauseTicker and keep stop/startTimer as exported functions, but now as no-ops. In the past the stop/startTicker actions were used incorrectly as if they were synchronous, which they are not. See issue #27105. We now document pause/unpackTicker as being async and not to be used for the purpose of concurrency safety. The existing stop/startTimer (note Timer not Ticker, the Timer calls the Ticker!) are also exported from the RTS as a public API. This was historically because the ticker used signals and it was important to suspend the timer signel over a process fork. So these functions were exported to be used by the process and unix libraries. We cannot just remove the RTS exports, but we now make them no-ops, and they can be removed from the process and unix library later. This was already documented in a changelog.d entry no-more-timer-signal but due to changes during the MR process the change to make stop/startTicker into no-ops didn't make it into the earlier MR. - - - - - 02e84e5f by Duncan Coutts at 2026-07-01T10:34:51-04:00 Make exitTicker/exitTimer unconditionally synchronous We never use them asynchronously, and we should never need to do so. And update some related comments. - - - - - 13db6a72 by Duncan Coutts at 2026-07-01T10:34:51-04:00 posix ticker: update and improve comments on (un)pause and exit Clarify what is async vs sync. - - - - - 43d9a07d by Duncan Coutts at 2026-07-01T10:34:51-04:00 posix ticker: split out ppoll/select helper functions Move the #ifdefs out of the main code body by introducing local helper functions and types, which themselves have two implementations (with a common API) based on ppoll or select. This helps improve clarity/readability. - - - - - a5491baa by Duncan Coutts at 2026-07-01T10:34:51-04:00 posix ticker: improve the implementation The existing implementation supported pausing and exiting, with the implementation of pausing reling on a mutex and condition variable. It needed to check the pause and stop shared variables on every iteration. It relies on ppoll or select, to wait on the timeout and also wait on an interrupt fd. The interrupt fd was only used for prompt exit/shutdown, and not for pausing or other notification. The pause only needed a lock and a memory operation, but the pause was not prompt. The resume used a lock, and signaling a cond var. The new implementation uses a somewhat more regular design: every notification is done by setting a shared variable and interrupting/notifying the ticker via the fd. The ticker thread does not need to check any shared variables on normal timer expiry, only when it recevies notification. This may be a micro-optimisation, but the tick occurs 100 times a second by default so any improvements in the hot path are amplified. When the ticker thread does receive notification it can check the various shared variables and update its local state. The blocking relies on using ppoll/select but without a timeout. This avoids the condition var and also allows further notifications when paused (also used for unpausing). This design can be extended with further notification types if needed by using and checking further shared vars (or making existing shared vars an enum or counter). This may be used in future for additional notifications to the ticker thread. This will likely be used to proxy wakeUpRts from a single handler context for example. And this approach, avoiding mutexes, is compatible with use from signal handlers. So overall, it's: * slightly simpler / more regular; * easier to extend with additional notifications; * probably slightly more efficient (but a micro-optimisation); * and supports calling notification from signal handlers - - - - - 5b20821e by Duncan Coutts at 2026-07-01T10:34:51-04:00 posix ticker: further minor local renaming for code clarity Improve the clarity with better choice of names for several local vars and function. - - - - - 1f3ec5e0 by Duncan Coutts at 2026-07-01T10:34:51-04:00 win32 ticker: split out local helper functions - - - - - 596e7307 by Duncan Coutts at 2026-07-01T10:34:51-04:00 win32 ticker: provide guarantee about concurrency and idempotency Use a lock to ensure pause/unpause can be used concurrently. Use a paused variable, protected by the lock, to ensure that pause and unpause are both idempotent. This is what the portable API expects. - - - - - 1870edd7 by Duncan Coutts at 2026-07-01T10:34:51-04:00 win32 ticker: make the initial tick be after one wait interval There is no need to tick immediately. This is consistent with the posix implementation. - - - - - 7c15ab5b by Duncan Coutts at 2026-07-01T10:34:51-04:00 ticker: remove now-unnecessary layer of enable/disable There was an atomic variable used to block *part* of the actions of the tick handler. This still did not make stopTimer synchronous, even for the part of the the handle_tick actions it covered. It also added a more expensive (sequentuially consistent) atomic operation in the hot path for the handle_tick action, whereas our new design requires no atomic ops at all. Now that we have eliminate the need for synchronous stop/startTicker, we don't need this not-quite-working-anyway atomic protocol. The new pause/unpauseTicker is explicitly asynchronous and idempotent. - - - - - 8585f8cb by Duncan Coutts at 2026-07-01T10:34:51-04:00 ticker: add TODOs about issue #27250: too much being done from handle_tick The handle_tick should not perform I/O, block, perform long-running operations or call arbitrary user code. Unfortunately, everything to do with the eventlog (at the moment) falls into all those categories. - - - - - adabf543 by Cheng Shao at 2026-07-01T20:11:40+00:00 rts: add is-valid-utf8.c to .ubsan-suppressions A minor one in `bytestring` that might surface when building with +ubsan using clang. - - - - - 18d4ca75 by Cheng Shao at 2026-07-01T20:11:40+00:00 hadrian: add support for building with AddressSanitizer This patch adds a +asan flavour transformer to hadrian to build all stage1+ C/C++ code with AddressBehaviorSanitizer. This is particularly useful to catch potential out-of-bounds and use-after-free bugs in the RTS codebase. - - - - - b890c3f6 by Cheng Shao at 2026-07-01T20:14:30+00:00 ci: add ubsan+asan job We now have a `x86_64-linux-fedora43-quick-validate+debug_info+ubsan+asan` validate/nightly job with both UBSan/ASan enabled. This is enabled in full-ci pipelines as well as MR pipelines with `test-sanitizer` label. - - - - - 68baf683 by Cheng Shao at 2026-07-01T20:14:33+00:00 rts: add ASAN instrumentation to mblock allocator - - - - - a9ba461a by Cheng Shao at 2026-07-01T20:14:33+00:00 rts: add ASAN instrumentation to mgroup allocator - - - - - 6fd6412b by Cheng Shao at 2026-07-01T20:14:33+00:00 rts: add ASAN instrumentation to block allocator - - - - - c77409a3 by Cheng Shao at 2026-07-01T20:14:33+00:00 rts: add ASAN instrumentation to cap->pinned_object_empty - - - - - b56b8e7a by Cheng Shao at 2026-07-01T20:14:33+00:00 rts: add ASAN instrumentation to gc_thread->free_blocks - - - - - 0cebad39 by Cheng Shao at 2026-07-01T20:14:33+00:00 rts: add ASAN instrumentation to hash table free list - - - - - f796da22 by Cheng Shao at 2026-07-01T20:14:33+00:00 rts: add ASAN instrumentation to per-Task InCall free list - - - - - 59 changed files: - .gitlab/ci.sh - .gitlab/generate-ci/gen_ci.hs - .gitlab/jobs.yaml - hadrian/doc/flavours.md - hadrian/src/Flavour.hs - libraries/base/tests/all.T - libraries/ghc-heap/tests/all.T - rts/.ubsan-suppressions - rts/Hash.c - rts/RtsStartup.c - rts/Schedule.c - rts/Task.c - rts/Ticker.h - rts/Timer.c - rts/Timer.h - rts/include/Stg.h - + rts/include/rts/ASANUtils.h - rts/include/rts/Timer.h - rts/posix/Ticker.c - rts/rts.cabal - rts/sm/BlockAlloc.c - rts/sm/GCUtils.c - rts/sm/MBlock.c - rts/sm/Storage.c - rts/win32/Ticker.c - testsuite/driver/testglobals.py - testsuite/driver/testlib.py - testsuite/tests/arityanal/should_compile/T21755.stderr - testsuite/tests/arityanal/should_compile/all.T - testsuite/tests/bytecode/TLinkable/all.T - testsuite/tests/cmm/should_compile/all.T - + testsuite/tests/concurrent/should_run/T27105.hs - testsuite/tests/concurrent/should_run/all.T - testsuite/tests/core-to-stg/T25284/Cls.hs - testsuite/tests/deSugar/should_fail/all.T - testsuite/tests/deSugar/should_run/all.T - testsuite/tests/deriving/should_compile/all.T - testsuite/tests/driver/options_ghc/Mod_fbyte_code.hs - testsuite/tests/driver/options_ghc/all.T - testsuite/tests/driver/options_ghc/options_ghc_fbyte-code.stderr - testsuite/tests/ffi/should_run/all.T - testsuite/tests/generics/GenDerivOutput.hs - testsuite/tests/generics/GenDerivOutput1_0.hs - testsuite/tests/generics/GenDerivOutput1_1.hs - testsuite/tests/generics/T10604/T10604_deriving.hs - testsuite/tests/generics/T10604/all.T - testsuite/tests/generics/all.T - testsuite/tests/perf/compiler/all.T - testsuite/tests/printer/T18052a.stderr - testsuite/tests/printer/all.T - testsuite/tests/profiling/perf/T23103/all.T - testsuite/tests/profiling/should_run/all.T - testsuite/tests/rts/T17574.hs - testsuite/tests/rts/T18623/all.T - testsuite/tests/rts/T19381.hs - testsuite/tests/rts/all.T - testsuite/tests/rts/ipe/T24005/all.T - testsuite/tests/simplCore/should_compile/all.T - testsuite/tests/typecheck/should_compile/all.T The diff was not included because it is too large. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/aaf7630402b0fe4dcf7fe2e6a44fc1f... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/aaf7630402b0fe4dcf7fe2e6a44fc1f... You're receiving this email because of your account on gitlab.haskell.org.
participants (1)
-
Cheng Shao (@TerrorJack)