Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-50125

UBSAN with ccache doesn't always respect -fsanitize-blacklist options

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 4.7.0, 4.4.2
    • Affects Version/s: None
    • Component/s: Build
    • Labels:
      None
    • Fully Compatible
    • ALL
    • v4.4
    • Dev Platform 2020-08-24, Dev Platform 2020-09-07

      When I build the server on my evergreen workstation with AUBSAN, it crashes with messages like the following:

      {"t":{"$date":"2020-08-05T14:10:35.751+00:00"},"s":"I",  "c":"RECOVERY", "id":23987,   "ctx":"initandlisten","msg":"WiredTiger recoveryTimestamp","attr":{"recoveryTimestamp":{"$timestamp":{"t":0,"i":0}}}}
      src/third_party/murmurhash3/MurmurHash3.cpp:92:49: runtime error: addition of unsigned offset to 0x7ffe6ba480d0 overflowed to 0x7ffe6ba480c0
      SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior src/third_party/murmurhash3/MurmurHash3.cpp:92:49 in
      

      I've also seen messages from Snappy. These errors are surprising, as they're in files covered by etc/ubsan.blacklist which I would expect to suppress them. On a hunch, I tried disabling ccache, and the resulting mongod binaries appear to work. I found this Github issue which appears to describe the problem: https://github.com/ccache/ccache/issues/174 It was tagged as being a part of their 3.5 epic. The version of ccache on the evergreen workstations appears to be version 3.4.1.

      The SCons invokation which produced the failing binaries:

      python ./buildscripts/scons.py --dbg=on --opt=on --variables-files=etc/scons/mongodbtoolchain_v3_clang.vars --allocator=system --sanitize=address,undefined --ninja=next generate-ninja MONGO_VERSION="0.0.0" MONGO_GIT_HASH="unknown" CCACHE=ccache
      

      The corrected invokation:

      python ./buildscripts/scons.py --dbg=on --opt=on --variables-files=etc/scons/mongodbtoolchain_v3_clang.vars --allocator=system --sanitize=address,undefined --ninja=next generate-ninja MONGO_VERSION="0.0.0" MONGO_GIT_HASH="unknown"
      

            Assignee:
            ryan.egesdahl@mongodb.com Ryan Egesdahl (Inactive)
            Reporter:
            spencer.jackson@mongodb.com Spencer Jackson
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: