Cheng Shao pushed to branch wip/terrorjack/asan at Glasgow Haskell Compiler / GHC

Commits:

8 changed files:

Changes:

  • .gitlab/generate-ci/gen_ci.hs
    ... ... @@ -162,6 +162,7 @@ data BuildConfig
    162 162
                     , tablesNextToCode :: Bool
    
    163 163
                     , threadSanitiser :: Bool
    
    164 164
                     , ubsan :: Bool
    
    165
    +                , asan :: Bool
    
    165 166
                     , noSplitSections :: Bool
    
    166 167
                     , validateNonmovingGc :: Bool
    
    167 168
                     , textWithSIMDUTF :: Bool
    
    ... ... @@ -188,6 +189,7 @@ mkJobFlavour BuildConfig{..} = Flavour buildFlavour opts
    188 189
                [HostFullyStatic | hostFullyStatic] ++
    
    189 190
                [ThreadSanitiser | threadSanitiser] ++
    
    190 191
                [UBSan | ubsan] ++
    
    192
    +           [ASan | asan] ++
    
    191 193
                [NoSplitSections | noSplitSections, buildFlavour == Release ] ++
    
    192 194
                [BootNonmovingGc | validateNonmovingGc ] ++
    
    193 195
                [TextWithSIMDUTF | textWithSIMDUTF]
    
    ... ... @@ -201,11 +203,12 @@ data FlavourTrans =
    201 203
         | HostFullyStatic
    
    202 204
         | ThreadSanitiser
    
    203 205
         | UBSan
    
    206
    +    | ASan
    
    204 207
         | NoSplitSections
    
    205 208
         | BootNonmovingGc
    
    206 209
         | TextWithSIMDUTF
    
    207 210
     
    
    208
    -data BaseFlavour = Release | Validate | SlowValidate deriving Eq
    
    211
    +data BaseFlavour = Release | QuickValidate | Validate | SlowValidate deriving Eq
    
    209 212
     
    
    210 213
     -----------------------------------------------------------------------------
    
    211 214
     -- Build Configurations
    
    ... ... @@ -230,6 +233,7 @@ vanilla = BuildConfig
    230 233
       , tablesNextToCode = True
    
    231 234
       , threadSanitiser = False
    
    232 235
       , ubsan = False
    
    236
    +  , asan = False
    
    233 237
       , noSplitSections = False
    
    234 238
       , validateNonmovingGc = False
    
    235 239
       , textWithSIMDUTF = False
    
    ... ... @@ -283,8 +287,14 @@ llvm = vanilla { llvmBootstrap = True }
    283 287
     tsan :: BuildConfig
    
    284 288
     tsan = vanilla { threadSanitiser = True }
    
    285 289
     
    
    286
    -enableUBSan :: BuildConfig
    
    287
    -enableUBSan = vanilla { withDwarf = True, ubsan = True }
    
    290
    +enableUBSanASan :: BuildConfig
    
    291
    +enableUBSanASan =
    
    292
    +  vanilla
    
    293
    +    { buildFlavour = QuickValidate,
    
    294
    +      withDwarf = True,
    
    295
    +      ubsan = True,
    
    296
    +      asan = True
    
    297
    +    }
    
    288 298
     
    
    289 299
     noTntc :: BuildConfig
    
    290 300
     noTntc = vanilla { tablesNextToCode = False }
    
    ... ... @@ -372,6 +382,7 @@ flavourString :: Flavour -> String
    372 382
     flavourString (Flavour base trans) = base_string base ++ concatMap (("+" ++) . flavour_string) trans
    
    373 383
       where
    
    374 384
         base_string Release = "release"
    
    385
    +    base_string QuickValidate = "quick-validate"
    
    375 386
         base_string Validate = "validate"
    
    376 387
         base_string SlowValidate = "slow-validate"
    
    377 388
     
    
    ... ... @@ -381,6 +392,7 @@ flavourString (Flavour base trans) = base_string base ++ concatMap (("+" ++) . f
    381 392
         flavour_string HostFullyStatic = "host_fully_static"
    
    382 393
         flavour_string ThreadSanitiser = "thread_sanitizer_cmm"
    
    383 394
         flavour_string UBSan = "ubsan"
    
    395
    +    flavour_string ASan = "asan"
    
    384 396
         flavour_string NoSplitSections = "no_split_sections"
    
    385 397
         flavour_string BootNonmovingGc = "boot_nonmoving_gc"
    
    386 398
         flavour_string TextWithSIMDUTF = "text_simdutf"
    
    ... ... @@ -1213,15 +1225,24 @@ fedora_x86 =
    1213 1225
       , hackage_doc_job (disableValidate (standardBuildsWithConfig Amd64 (Linux Fedora43) releaseConfig))
    
    1214 1226
       , disableValidate (standardBuildsWithConfig Amd64 (Linux Fedora43) dwarf)
    
    1215 1227
       , disableValidate (standardBuilds Amd64 (Linux Fedora43))
    
    1216
    -    -- For UBSan jobs, only enable for validate/nightly pipelines.
    
    1217
    -    -- Also disable docs since it's not the point for UBSan jobs.
    
    1228
    +    -- For UBSan/ASan jobs, only enable for validate/nightly
    
    1229
    +    -- pipelines. Also disable docs since it's not the point for
    
    1230
    +    -- UBSan/ASan jobs.
    
    1231
    +    --
    
    1232
    +    -- See
    
    1233
    +    -- https://github.com/llvm/llvm-project/blob/llvmorg-21.1.8/compiler-rt/lib/sanitizer_common/sanitizer_flags.inc
    
    1234
    +    -- for ASAN options help, for now these are required to pass the
    
    1235
    +    -- testsuite
    
    1218 1236
       , modifyJobs
    
    1219 1237
           ( setVariable "HADRIAN_ARGS" "--docs=none"
    
    1220 1238
               . addVariable
    
    1221 1239
                 "UBSAN_OPTIONS"
    
    1222 1240
                 "suppressions=$CI_PROJECT_DIR/rts/.ubsan-suppressions"
    
    1241
    +          . addVariable
    
    1242
    +            "ASAN_OPTIONS"
    
    1243
    +            "detect_leaks=false:handle_segv=0:handle_sigfpe=0:verify_asan_link_order=false"
    
    1223 1244
           )
    
    1224
    -      $ validateBuilds Amd64 (Linux Fedora43) enableUBSan
    
    1245
    +      $ validateBuilds Amd64 (Linux Fedora43) enableUBSanASan
    
    1225 1246
       ]
    
    1226 1247
       where
    
    1227 1248
         hackage_doc_job = rename (<> "-hackage") . modifyJobs (addVariable "HADRIAN_ARGS" "--haddock-for-hackage")
    

  • .gitlab/jobs.yaml
    ... ... @@ -2942,7 +2942,7 @@
    2942 2942
           "XZ_OPT": "-9"
    
    2943 2943
         }
    
    2944 2944
       },
    
    2945
    -  "nightly-x86_64-linux-fedora43-release": {
    
    2945
    +  "nightly-x86_64-linux-fedora43-quick-validate+debug_info+ubsan+asan": {
    
    2946 2946
         "after_script": [
    
    2947 2947
           ".gitlab/ci.sh save_cache",
    
    2948 2948
           ".gitlab/ci.sh save_test_output",
    
    ... ... @@ -2953,7 +2953,7 @@
    2953 2953
         "artifacts": {
    
    2954 2954
           "expire_in": "8 weeks",
    
    2955 2955
           "paths": [
    
    2956
    -        "ghc-x86_64-linux-fedora43-release.tar.xz",
    
    2956
    +        "ghc-x86_64-linux-fedora43-quick-validate+debug_info+ubsan+asan.tar.xz",
    
    2957 2957
             "junit.xml",
    
    2958 2958
             "unexpected-test-output.tar.gz"
    
    2959 2959
           ],
    
    ... ... @@ -2995,17 +2995,20 @@
    2995 2995
           "x86_64-linux"
    
    2996 2996
         ],
    
    2997 2997
         "variables": {
    
    2998
    +      "ASAN_OPTIONS": "detect_leaks=false:handle_segv=0:handle_sigfpe=0:verify_asan_link_order=false",
    
    2998 2999
           "BIGNUM_BACKEND": "gmp",
    
    2999
    -      "BIN_DIST_NAME": "ghc-x86_64-linux-fedora43-release",
    
    3000
    -      "BUILD_FLAVOUR": "release",
    
    3000
    +      "BIN_DIST_NAME": "ghc-x86_64-linux-fedora43-quick-validate+debug_info+ubsan+asan",
    
    3001
    +      "BUILD_FLAVOUR": "quick-validate+debug_info+ubsan+asan",
    
    3001 3002
           "CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
    
    3003
    +      "HADRIAN_ARGS": "--docs=none",
    
    3002 3004
           "INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
    
    3003 3005
           "RUNTEST_ARGS": "",
    
    3004
    -      "TEST_ENV": "x86_64-linux-fedora43-release",
    
    3006
    +      "TEST_ENV": "x86_64-linux-fedora43-quick-validate+debug_info+ubsan+asan",
    
    3007
    +      "UBSAN_OPTIONS": "suppressions=$CI_PROJECT_DIR/rts/.ubsan-suppressions",
    
    3005 3008
           "XZ_OPT": "-9"
    
    3006 3009
         }
    
    3007 3010
       },
    
    3008
    -  "nightly-x86_64-linux-fedora43-release-hackage": {
    
    3011
    +  "nightly-x86_64-linux-fedora43-release": {
    
    3009 3012
         "after_script": [
    
    3010 3013
           ".gitlab/ci.sh save_cache",
    
    3011 3014
           ".gitlab/ci.sh save_test_output",
    
    ... ... @@ -3062,14 +3065,13 @@
    3062 3065
           "BIN_DIST_NAME": "ghc-x86_64-linux-fedora43-release",
    
    3063 3066
           "BUILD_FLAVOUR": "release",
    
    3064 3067
           "CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
    
    3065
    -      "HADRIAN_ARGS": "--haddock-for-hackage",
    
    3066 3068
           "INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
    
    3067 3069
           "RUNTEST_ARGS": "",
    
    3068 3070
           "TEST_ENV": "x86_64-linux-fedora43-release",
    
    3069 3071
           "XZ_OPT": "-9"
    
    3070 3072
         }
    
    3071 3073
       },
    
    3072
    -  "nightly-x86_64-linux-fedora43-validate": {
    
    3074
    +  "nightly-x86_64-linux-fedora43-release-hackage": {
    
    3073 3075
         "after_script": [
    
    3074 3076
           ".gitlab/ci.sh save_cache",
    
    3075 3077
           ".gitlab/ci.sh save_test_output",
    
    ... ... @@ -3080,7 +3082,7 @@
    3080 3082
         "artifacts": {
    
    3081 3083
           "expire_in": "8 weeks",
    
    3082 3084
           "paths": [
    
    3083
    -        "ghc-x86_64-linux-fedora43-validate.tar.xz",
    
    3085
    +        "ghc-x86_64-linux-fedora43-release.tar.xz",
    
    3084 3086
             "junit.xml",
    
    3085 3087
             "unexpected-test-output.tar.gz"
    
    3086 3088
           ],
    
    ... ... @@ -3123,16 +3125,17 @@
    3123 3125
         ],
    
    3124 3126
         "variables": {
    
    3125 3127
           "BIGNUM_BACKEND": "gmp",
    
    3126
    -      "BIN_DIST_NAME": "ghc-x86_64-linux-fedora43-validate",
    
    3127
    -      "BUILD_FLAVOUR": "validate",
    
    3128
    +      "BIN_DIST_NAME": "ghc-x86_64-linux-fedora43-release",
    
    3129
    +      "BUILD_FLAVOUR": "release",
    
    3128 3130
           "CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
    
    3131
    +      "HADRIAN_ARGS": "--haddock-for-hackage",
    
    3129 3132
           "INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
    
    3130 3133
           "RUNTEST_ARGS": "",
    
    3131
    -      "TEST_ENV": "x86_64-linux-fedora43-validate",
    
    3134
    +      "TEST_ENV": "x86_64-linux-fedora43-release",
    
    3132 3135
           "XZ_OPT": "-9"
    
    3133 3136
         }
    
    3134 3137
       },
    
    3135
    -  "nightly-x86_64-linux-fedora43-validate+debug_info": {
    
    3138
    +  "nightly-x86_64-linux-fedora43-validate": {
    
    3136 3139
         "after_script": [
    
    3137 3140
           ".gitlab/ci.sh save_cache",
    
    3138 3141
           ".gitlab/ci.sh save_test_output",
    
    ... ... @@ -3143,7 +3146,7 @@
    3143 3146
         "artifacts": {
    
    3144 3147
           "expire_in": "8 weeks",
    
    3145 3148
           "paths": [
    
    3146
    -        "ghc-x86_64-linux-fedora43-validate+debug_info.tar.xz",
    
    3149
    +        "ghc-x86_64-linux-fedora43-validate.tar.xz",
    
    3147 3150
             "junit.xml",
    
    3148 3151
             "unexpected-test-output.tar.gz"
    
    3149 3152
           ],
    
    ... ... @@ -3186,16 +3189,16 @@
    3186 3189
         ],
    
    3187 3190
         "variables": {
    
    3188 3191
           "BIGNUM_BACKEND": "gmp",
    
    3189
    -      "BIN_DIST_NAME": "ghc-x86_64-linux-fedora43-validate+debug_info",
    
    3190
    -      "BUILD_FLAVOUR": "validate+debug_info",
    
    3192
    +      "BIN_DIST_NAME": "ghc-x86_64-linux-fedora43-validate",
    
    3193
    +      "BUILD_FLAVOUR": "validate",
    
    3191 3194
           "CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
    
    3192 3195
           "INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
    
    3193 3196
           "RUNTEST_ARGS": "",
    
    3194
    -      "TEST_ENV": "x86_64-linux-fedora43-validate+debug_info",
    
    3197
    +      "TEST_ENV": "x86_64-linux-fedora43-validate",
    
    3195 3198
           "XZ_OPT": "-9"
    
    3196 3199
         }
    
    3197 3200
       },
    
    3198
    -  "nightly-x86_64-linux-fedora43-validate+debug_info+ubsan": {
    
    3201
    +  "nightly-x86_64-linux-fedora43-validate+debug_info": {
    
    3199 3202
         "after_script": [
    
    3200 3203
           ".gitlab/ci.sh save_cache",
    
    3201 3204
           ".gitlab/ci.sh save_test_output",
    
    ... ... @@ -3206,7 +3209,7 @@
    3206 3209
         "artifacts": {
    
    3207 3210
           "expire_in": "8 weeks",
    
    3208 3211
           "paths": [
    
    3209
    -        "ghc-x86_64-linux-fedora43-validate+debug_info+ubsan.tar.xz",
    
    3212
    +        "ghc-x86_64-linux-fedora43-validate+debug_info.tar.xz",
    
    3210 3213
             "junit.xml",
    
    3211 3214
             "unexpected-test-output.tar.gz"
    
    3212 3215
           ],
    
    ... ... @@ -3249,14 +3252,12 @@
    3249 3252
         ],
    
    3250 3253
         "variables": {
    
    3251 3254
           "BIGNUM_BACKEND": "gmp",
    
    3252
    -      "BIN_DIST_NAME": "ghc-x86_64-linux-fedora43-validate+debug_info+ubsan",
    
    3253
    -      "BUILD_FLAVOUR": "validate+debug_info+ubsan",
    
    3255
    +      "BIN_DIST_NAME": "ghc-x86_64-linux-fedora43-validate+debug_info",
    
    3256
    +      "BUILD_FLAVOUR": "validate+debug_info",
    
    3254 3257
           "CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
    
    3255
    -      "HADRIAN_ARGS": "--docs=none",
    
    3256 3258
           "INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
    
    3257 3259
           "RUNTEST_ARGS": "",
    
    3258
    -      "TEST_ENV": "x86_64-linux-fedora43-validate+debug_info+ubsan",
    
    3259
    -      "UBSAN_OPTIONS": "suppressions=$CI_PROJECT_DIR/rts/.ubsan-suppressions",
    
    3260
    +      "TEST_ENV": "x86_64-linux-fedora43-validate+debug_info",
    
    3260 3261
           "XZ_OPT": "-9"
    
    3261 3262
         }
    
    3262 3263
       },
    
    ... ... @@ -7097,7 +7098,7 @@
    7097 7098
           "TEST_ENV": "x86_64-linux-deb9-validate"
    
    7098 7099
         }
    
    7099 7100
       },
    
    7100
    -  "x86_64-linux-fedora43-release": {
    
    7101
    +  "x86_64-linux-fedora43-quick-validate+debug_info+ubsan+asan": {
    
    7101 7102
         "after_script": [
    
    7102 7103
           ".gitlab/ci.sh save_cache",
    
    7103 7104
           ".gitlab/ci.sh save_test_output",
    
    ... ... @@ -7108,7 +7109,7 @@
    7108 7109
         "artifacts": {
    
    7109 7110
           "expire_in": "2 weeks",
    
    7110 7111
           "paths": [
    
    7111
    -        "ghc-x86_64-linux-fedora43-release.tar.xz",
    
    7112
    +        "ghc-x86_64-linux-fedora43-quick-validate+debug_info+ubsan+asan.tar.xz",
    
    7112 7113
             "junit.xml",
    
    7113 7114
             "unexpected-test-output.tar.gz"
    
    7114 7115
           ],
    
    ... ... @@ -7134,7 +7135,7 @@
    7134 7135
         ],
    
    7135 7136
         "rules": [
    
    7136 7137
           {
    
    7137
    -        "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-fedora43-release(\\s|$).*/)) || (($ONLY_JOBS == null) && ((\"true\" == \"true\")))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
    
    7138
    +        "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-fedora43-quick-validate\\+debug_info\\+ubsan\\+asan(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/))))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
    
    7138 7139
             "when": "on_success"
    
    7139 7140
           }
    
    7140 7141
         ],
    
    ... ... @@ -7150,16 +7151,19 @@
    7150 7151
           "x86_64-linux"
    
    7151 7152
         ],
    
    7152 7153
         "variables": {
    
    7154
    +      "ASAN_OPTIONS": "detect_leaks=false:handle_segv=0:handle_sigfpe=0:verify_asan_link_order=false",
    
    7153 7155
           "BIGNUM_BACKEND": "gmp",
    
    7154
    -      "BIN_DIST_NAME": "ghc-x86_64-linux-fedora43-release",
    
    7155
    -      "BUILD_FLAVOUR": "release",
    
    7156
    +      "BIN_DIST_NAME": "ghc-x86_64-linux-fedora43-quick-validate+debug_info+ubsan+asan",
    
    7157
    +      "BUILD_FLAVOUR": "quick-validate+debug_info+ubsan+asan",
    
    7156 7158
           "CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
    
    7159
    +      "HADRIAN_ARGS": "--docs=none",
    
    7157 7160
           "INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
    
    7158 7161
           "RUNTEST_ARGS": "",
    
    7159
    -      "TEST_ENV": "x86_64-linux-fedora43-release"
    
    7162
    +      "TEST_ENV": "x86_64-linux-fedora43-quick-validate+debug_info+ubsan+asan",
    
    7163
    +      "UBSAN_OPTIONS": "suppressions=$CI_PROJECT_DIR/rts/.ubsan-suppressions"
    
    7160 7164
         }
    
    7161 7165
       },
    
    7162
    -  "x86_64-linux-fedora43-release-hackage": {
    
    7166
    +  "x86_64-linux-fedora43-release": {
    
    7163 7167
         "after_script": [
    
    7164 7168
           ".gitlab/ci.sh save_cache",
    
    7165 7169
           ".gitlab/ci.sh save_test_output",
    
    ... ... @@ -7196,7 +7200,7 @@
    7196 7200
         ],
    
    7197 7201
         "rules": [
    
    7198 7202
           {
    
    7199
    -        "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-fedora43-release(\\s|$).*/)) || (($ONLY_JOBS == null) && (\"disabled\" != \"disabled\"))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
    
    7203
    +        "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-fedora43-release(\\s|$).*/)) || (($ONLY_JOBS == null) && ((\"true\" == \"true\")))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
    
    7200 7204
             "when": "on_success"
    
    7201 7205
           }
    
    7202 7206
         ],
    
    ... ... @@ -7216,13 +7220,12 @@
    7216 7220
           "BIN_DIST_NAME": "ghc-x86_64-linux-fedora43-release",
    
    7217 7221
           "BUILD_FLAVOUR": "release",
    
    7218 7222
           "CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
    
    7219
    -      "HADRIAN_ARGS": "--haddock-for-hackage",
    
    7220 7223
           "INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
    
    7221 7224
           "RUNTEST_ARGS": "",
    
    7222 7225
           "TEST_ENV": "x86_64-linux-fedora43-release"
    
    7223 7226
         }
    
    7224 7227
       },
    
    7225
    -  "x86_64-linux-fedora43-validate": {
    
    7228
    +  "x86_64-linux-fedora43-release-hackage": {
    
    7226 7229
         "after_script": [
    
    7227 7230
           ".gitlab/ci.sh save_cache",
    
    7228 7231
           ".gitlab/ci.sh save_test_output",
    
    ... ... @@ -7233,7 +7236,7 @@
    7233 7236
         "artifacts": {
    
    7234 7237
           "expire_in": "2 weeks",
    
    7235 7238
           "paths": [
    
    7236
    -        "ghc-x86_64-linux-fedora43-validate.tar.xz",
    
    7239
    +        "ghc-x86_64-linux-fedora43-release.tar.xz",
    
    7237 7240
             "junit.xml",
    
    7238 7241
             "unexpected-test-output.tar.gz"
    
    7239 7242
           ],
    
    ... ... @@ -7259,7 +7262,7 @@
    7259 7262
         ],
    
    7260 7263
         "rules": [
    
    7261 7264
           {
    
    7262
    -        "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-fedora43-validate(\\s|$).*/)) || (($ONLY_JOBS == null) && (\"disabled\" != \"disabled\"))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
    
    7265
    +        "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-fedora43-release(\\s|$).*/)) || (($ONLY_JOBS == null) && (\"disabled\" != \"disabled\"))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
    
    7263 7266
             "when": "on_success"
    
    7264 7267
           }
    
    7265 7268
         ],
    
    ... ... @@ -7276,15 +7279,16 @@
    7276 7279
         ],
    
    7277 7280
         "variables": {
    
    7278 7281
           "BIGNUM_BACKEND": "gmp",
    
    7279
    -      "BIN_DIST_NAME": "ghc-x86_64-linux-fedora43-validate",
    
    7280
    -      "BUILD_FLAVOUR": "validate",
    
    7282
    +      "BIN_DIST_NAME": "ghc-x86_64-linux-fedora43-release",
    
    7283
    +      "BUILD_FLAVOUR": "release",
    
    7281 7284
           "CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
    
    7285
    +      "HADRIAN_ARGS": "--haddock-for-hackage",
    
    7282 7286
           "INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
    
    7283 7287
           "RUNTEST_ARGS": "",
    
    7284
    -      "TEST_ENV": "x86_64-linux-fedora43-validate"
    
    7288
    +      "TEST_ENV": "x86_64-linux-fedora43-release"
    
    7285 7289
         }
    
    7286 7290
       },
    
    7287
    -  "x86_64-linux-fedora43-validate+debug_info": {
    
    7291
    +  "x86_64-linux-fedora43-validate": {
    
    7288 7292
         "after_script": [
    
    7289 7293
           ".gitlab/ci.sh save_cache",
    
    7290 7294
           ".gitlab/ci.sh save_test_output",
    
    ... ... @@ -7295,7 +7299,7 @@
    7295 7299
         "artifacts": {
    
    7296 7300
           "expire_in": "2 weeks",
    
    7297 7301
           "paths": [
    
    7298
    -        "ghc-x86_64-linux-fedora43-validate+debug_info.tar.xz",
    
    7302
    +        "ghc-x86_64-linux-fedora43-validate.tar.xz",
    
    7299 7303
             "junit.xml",
    
    7300 7304
             "unexpected-test-output.tar.gz"
    
    7301 7305
           ],
    
    ... ... @@ -7321,7 +7325,7 @@
    7321 7325
         ],
    
    7322 7326
         "rules": [
    
    7323 7327
           {
    
    7324
    -        "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-fedora43-validate\\+debug_info(\\s|$).*/)) || (($ONLY_JOBS == null) && (\"disabled\" != \"disabled\"))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
    
    7328
    +        "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-fedora43-validate(\\s|$).*/)) || (($ONLY_JOBS == null) && (\"disabled\" != \"disabled\"))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
    
    7325 7329
             "when": "on_success"
    
    7326 7330
           }
    
    7327 7331
         ],
    
    ... ... @@ -7338,15 +7342,15 @@
    7338 7342
         ],
    
    7339 7343
         "variables": {
    
    7340 7344
           "BIGNUM_BACKEND": "gmp",
    
    7341
    -      "BIN_DIST_NAME": "ghc-x86_64-linux-fedora43-validate+debug_info",
    
    7342
    -      "BUILD_FLAVOUR": "validate+debug_info",
    
    7345
    +      "BIN_DIST_NAME": "ghc-x86_64-linux-fedora43-validate",
    
    7346
    +      "BUILD_FLAVOUR": "validate",
    
    7343 7347
           "CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
    
    7344 7348
           "INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
    
    7345 7349
           "RUNTEST_ARGS": "",
    
    7346
    -      "TEST_ENV": "x86_64-linux-fedora43-validate+debug_info"
    
    7350
    +      "TEST_ENV": "x86_64-linux-fedora43-validate"
    
    7347 7351
         }
    
    7348 7352
       },
    
    7349
    -  "x86_64-linux-fedora43-validate+debug_info+ubsan": {
    
    7353
    +  "x86_64-linux-fedora43-validate+debug_info": {
    
    7350 7354
         "after_script": [
    
    7351 7355
           ".gitlab/ci.sh save_cache",
    
    7352 7356
           ".gitlab/ci.sh save_test_output",
    
    ... ... @@ -7357,7 +7361,7 @@
    7357 7361
         "artifacts": {
    
    7358 7362
           "expire_in": "2 weeks",
    
    7359 7363
           "paths": [
    
    7360
    -        "ghc-x86_64-linux-fedora43-validate+debug_info+ubsan.tar.xz",
    
    7364
    +        "ghc-x86_64-linux-fedora43-validate+debug_info.tar.xz",
    
    7361 7365
             "junit.xml",
    
    7362 7366
             "unexpected-test-output.tar.gz"
    
    7363 7367
           ],
    
    ... ... @@ -7383,7 +7387,7 @@
    7383 7387
         ],
    
    7384 7388
         "rules": [
    
    7385 7389
           {
    
    7386
    -        "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-fedora43-validate\\+debug_info\\+ubsan(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/))))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
    
    7390
    +        "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-fedora43-validate\\+debug_info(\\s|$).*/)) || (($ONLY_JOBS == null) && (\"disabled\" != \"disabled\"))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
    
    7387 7391
             "when": "on_success"
    
    7388 7392
           }
    
    7389 7393
         ],
    
    ... ... @@ -7400,14 +7404,12 @@
    7400 7404
         ],
    
    7401 7405
         "variables": {
    
    7402 7406
           "BIGNUM_BACKEND": "gmp",
    
    7403
    -      "BIN_DIST_NAME": "ghc-x86_64-linux-fedora43-validate+debug_info+ubsan",
    
    7404
    -      "BUILD_FLAVOUR": "validate+debug_info+ubsan",
    
    7407
    +      "BIN_DIST_NAME": "ghc-x86_64-linux-fedora43-validate+debug_info",
    
    7408
    +      "BUILD_FLAVOUR": "validate+debug_info",
    
    7405 7409
           "CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
    
    7406
    -      "HADRIAN_ARGS": "--docs=none",
    
    7407 7410
           "INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
    
    7408 7411
           "RUNTEST_ARGS": "",
    
    7409
    -      "TEST_ENV": "x86_64-linux-fedora43-validate+debug_info+ubsan",
    
    7410
    -      "UBSAN_OPTIONS": "suppressions=$CI_PROJECT_DIR/rts/.ubsan-suppressions"
    
    7412
    +      "TEST_ENV": "x86_64-linux-fedora43-validate+debug_info"
    
    7411 7413
         }
    
    7412 7414
       },
    
    7413 7415
       "x86_64-linux-rocky8-validate": {
    

  • rts/Task.c
    ... ... @@ -183,6 +183,7 @@ freeTask (Task *task)
    183 183
             stgFree(incall);
    
    184 184
         }
    
    185 185
         for (incall = task->spare_incalls; incall != NULL; incall = next) {
    
    186
    +        __ghc_asan_unpoison_memory_region(incall, sizeof(InCall));
    
    186 187
             next = incall->next;
    
    187 188
             stgFree(incall);
    
    188 189
         }
    
    ... ... @@ -252,6 +253,7 @@ newInCall (Task *task)
    252 253
     
    
    253 254
         if (task->spare_incalls != NULL) {
    
    254 255
             incall = task->spare_incalls;
    
    256
    +        __ghc_asan_unpoison_memory_region(incall, sizeof(InCall));
    
    255 257
             task->spare_incalls = incall->next;
    
    256 258
             task->n_spare_incalls--;
    
    257 259
         } else {
    
    ... ... @@ -283,6 +285,7 @@ endInCall (Task *task)
    283 285
             stgFree(incall);
    
    284 286
         } else {
    
    285 287
             incall->next = task->spare_incalls;
    
    288
    +        __ghc_asan_poison_memory_region(incall, sizeof(InCall));
    
    286 289
             task->spare_incalls = incall;
    
    287 290
             task->n_spare_incalls++;
    
    288 291
         }
    

  • rts/include/Stg.h
    ... ... @@ -335,6 +335,7 @@ external prototype return neither of these types to workaround #11395.
    335 335
     #include "stg/MachRegsForHost.h"
    
    336 336
     #include "stg/Regs.h"
    
    337 337
     #include "stg/Ticky.h"
    
    338
    +#include "rts/ASANUtils.h"
    
    338 339
     #include "rts/TSANUtils.h"
    
    339 340
     
    
    340 341
     #if IN_STG_CODE
    

  • rts/include/rts/ASANUtils.h
    1
    +#pragma once
    
    2
    +
    
    3
    +#if defined(__SANITIZE_ADDRESS__)
    
    4
    +#define ASAN_ENABLED
    
    5
    +#elif defined(__has_feature)
    
    6
    +#if __has_feature(address_sanitizer)
    
    7
    +#define ASAN_ENABLED
    
    8
    +#endif
    
    9
    +#endif
    
    10
    +
    
    11
    +#if defined(ASAN_ENABLED)
    
    12
    +#include <sanitizer/asan_interface.h>
    
    13
    +#define USED_IF_ASAN
    
    14
    +#else
    
    15
    +#include <stdlib.h>
    
    16
    +#define USED_IF_ASAN __attribute__((unused))
    
    17
    +#endif
    
    18
    +
    
    19
    +static inline void
    
    20
    +__ghc_asan_poison_memory_region(void const volatile *addr USED_IF_ASAN,
    
    21
    +                                size_t size USED_IF_ASAN) {
    
    22
    +#if defined(ASAN_ENABLED)
    
    23
    +  __asan_poison_memory_region(addr, size);
    
    24
    +#endif
    
    25
    +}
    
    26
    +
    
    27
    +static inline void
    
    28
    +__ghc_asan_unpoison_memory_region(void const volatile *addr USED_IF_ASAN,
    
    29
    +                                  size_t size USED_IF_ASAN) {
    
    30
    +#if defined(ASAN_ENABLED)
    
    31
    +  __asan_unpoison_memory_region(addr, size);
    
    32
    +#endif
    
    33
    +}

  • rts/rts.cabal
    ... ... @@ -289,6 +289,7 @@ library
    289 289
                             -- ^ generated
    
    290 290
                             rts/ghc_ffi.h
    
    291 291
                             rts/Adjustor.h
    
    292
    +                        rts/ASANUtils.h
    
    292 293
                             rts/ExecPage.h
    
    293 294
                             rts/BlockSignals.h
    
    294 295
                             rts/Bytecodes.h
    

  • rts/sm/BlockAlloc.c
    ... ... @@ -261,6 +261,8 @@ initGroup(bdescr *head)
    261 261
           head[i].flags = 0;
    
    262 262
       }
    
    263 263
     #endif
    
    264
    +
    
    265
    +  __ghc_asan_unpoison_memory_region(head->start, (W_)head->blocks * BLOCK_SIZE);
    
    264 266
     }
    
    265 267
     
    
    266 268
     #if SIZEOF_VOID_P == SIZEOF_LONG
    
    ... ... @@ -474,6 +476,7 @@ alloc_mega_group (uint32_t node, StgWord mblocks)
    474 476
             bd = alloc_mega_group_from_free_list(&deferred_free_mblock_list[node], n, &best);
    
    475 477
             if(bd)
    
    476 478
             {
    
    479
    +            __ghc_asan_unpoison_memory_region(bd->start, (W_)bd->blocks * BLOCK_SIZE);
    
    477 480
                 return bd;
    
    478 481
             }
    
    479 482
             else if(!best)
    
    ... ... @@ -490,6 +493,7 @@ alloc_mega_group (uint32_t node, StgWord mblocks)
    490 493
     
    
    491 494
         if (bd)
    
    492 495
         {
    
    496
    +        __ghc_asan_unpoison_memory_region(bd->start, (W_)bd->blocks * BLOCK_SIZE);
    
    493 497
             return bd;
    
    494 498
         }
    
    495 499
         else if (best)
    
    ... ... @@ -500,6 +504,7 @@ alloc_mega_group (uint32_t node, StgWord mblocks)
    500 504
                               (best_mblocks-mblocks)*MBLOCK_SIZE);
    
    501 505
     
    
    502 506
             best->blocks = MBLOCK_GROUP_BLOCKS(best_mblocks - mblocks);
    
    507
    +        __ghc_asan_unpoison_memory_region(MBLOCK_ROUND_DOWN(bd), mblocks * MBLOCK_SIZE);
    
    503 508
             initMBlock(MBLOCK_ROUND_DOWN(bd), node);
    
    504 509
         }
    
    505 510
         else
    
    ... ... @@ -878,6 +883,8 @@ free_mega_group (bdescr *mg)
    878 883
     
    
    879 884
             IF_DEBUG(sanity, checkFreeListSanity());
    
    880 885
         }
    
    886
    +
    
    887
    +    __ghc_asan_poison_memory_region(mg->start, (W_)mg->blocks * BLOCK_SIZE);
    
    881 888
     }
    
    882 889
     
    
    883 890
     static void
    
    ... ... @@ -925,6 +932,8 @@ free_deferred_mega_groups (uint32_t node)
    925 932
             // coalesce forwards
    
    926 933
             coalesce_mblocks(mg);
    
    927 934
     
    
    935
    +        __ghc_asan_poison_memory_region(mg->start, (W_)mg->blocks * BLOCK_SIZE);
    
    936
    +
    
    928 937
             // initialize search for next round
    
    929 938
             prev = mg;
    
    930 939
             bd = prev->link;
    
    ... ... @@ -1045,6 +1054,8 @@ freeGroup(bdescr *p)
    1045 1054
       setup_tail(p);
    
    1046 1055
       free_list_insert(node,p);
    
    1047 1056
     
    
    1057
    +  __ghc_asan_poison_memory_region(p->start, (W_)p->blocks * BLOCK_SIZE);
    
    1058
    +
    
    1048 1059
       IF_DEBUG(sanity, checkFreeListSanity());
    
    1049 1060
     }
    
    1050 1061
     
    

  • rts/sm/MBlock.c
    ... ... @@ -579,6 +579,8 @@ getMBlocks(uint32_t n)
    579 579
     
    
    580 580
         ret = getCommittedMBlocks(n);
    
    581 581
     
    
    582
    +    __ghc_asan_unpoison_memory_region(ret, (W_)n * MBLOCK_SIZE);
    
    583
    +
    
    582 584
         debugTrace(DEBUG_gc, "allocated %d megablock(s) at %p",n,ret);
    
    583 585
     
    
    584 586
         mblocks_allocated += n;
    
    ... ... @@ -611,6 +613,8 @@ freeMBlocks(void *addr, uint32_t n)
    611 613
     
    
    612 614
         mblocks_allocated -= n;
    
    613 615
     
    
    616
    +    __ghc_asan_poison_memory_region(addr, (W_)n * MBLOCK_SIZE);
    
    617
    +
    
    614 618
         decommitMBlocks(addr, n);
    
    615 619
     }
    
    616 620