Uploaded image for project: 'WiredTiger'
  1. WiredTiger
  2. WT-8195

MSAN: Fix use-of-uninitialized-value in __wt_dlopen

    • Storage Engines
    • 5
    • Storage - Ra 2021-11-29, Storage - Ra 2022-03-21, Storage - Ra 2022-04-04, NachoCheese - 2023-10-03, Joker - StorEng - 2023-10-17, Asparagus-StorEng - 2023-10-31, 2024-01-09 - I Grew Tired

      In WT-7885, A patch build with tcmalloc enabled caused a memory leak in the format-stress-pull-request task.

      The MSAN leak errors are:
      format-stress-pull-request-test

       [2021/10/01 00:04:41.341]     ==43449==WARNING: MemorySanitizer: use-of-uninitialized-value
       [2021/10/01 00:04:41.341]         #0 0x7ff50eaa8226 in __wt_strdup /data/mci/fef82b3dccae856c402e5a103bb2ccb6/wiredtiger/build_posix/../src/include/misc_inline.h:49:40
       [2021/10/01 00:04:41.341]         #1 0x7ff50eaa7eee in __wt_dlopen /data/mci/fef82b3dccae856c402e5a103bb2ccb6/wiredtiger/build_posix/../src/os_posix/os_dlopen.c:22:5
       [2021/10/01 00:04:41.341]         #2 0x7ff50e8ec1db in __conn_load_extension_int /data/mci/fef82b3dccae856c402e5a103bb2ccb6/wiredtiger/build_posix/../src/conn/conn_api.c:962:5
       [2021/10/01 00:04:41.341]         #3 0x7ff50e8e8a96 in __conn_load_extensions /data/mci/fef82b3dccae856c402e5a103bb2ccb6/wiredtiger/build_posix/../src/conn/conn_api.c:1045:9
       [2021/10/01 00:04:41.341]         #4 0x7ff50e8d6e8b in wiredtiger_open /data/mci/fef82b3dccae856c402e5a103bb2ccb6/wiredtiger/build_posix/../src/conn/conn_api.c:2829:5
       [2021/10/01 00:04:41.341]         #5 0x4c9fec in create_database /data/mci/fef82b3dccae856c402e5a103bb2ccb6/wiredtiger/build_posix/test/format/../../../test/format/wts.c:319:5
       [2021/10/01 00:04:41.341]         #6 0x4cb8f2 in wts_create /data/mci/fef82b3dccae856c402e5a103bb2ccb6/wiredtiger/build_posix/test/format/../../../test/format/wts.c:458:5
       [2021/10/01 00:04:41.341]         #7 0x4c191b in main /data/mci/fef82b3dccae856c402e5a103bb2ccb6/wiredtiger/build_posix/test/format/../../../test/format/t.c:272:13
       [2021/10/01 00:04:41.341]         #8 0x7ff50e1dd0b2 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x270b2)
       [2021/10/01 00:04:41.341]         #9 0x41ee5d in _start (/data/mci/fef82b3dccae856c402e5a103bb2ccb6/wiredtiger/build_posix/test/format/t+0x41ee5d)
       [2021/10/01 00:04:41.341]     SUMMARY: MemorySanitizer: use-of-uninitialized-value /data/mci/fef82b3dccae856c402e5a103bb2ccb6/wiredtiger/build_posix/../src/include/misc_inline.h:49:40 in __wt_strdup
       [2021/10/01 00:04:41.341]     Exiting
      

      Definition of done:
      This ticket will need to fix the MSAN leak when tcmalloc is enabled. After fixing the leak, configure the evergreen yaml file to enable tcmalloc for ubuntu2004-msan variant task

      - name: ubuntu2004-msan
        display_name: "! Ubuntu 20.04 MSAN"
        run_on:
        - ubuntu2004-test
        expansions:
          configure_env_vars:
            # We don't compile C++ for memory sanitized testing as it creates false positives.
            CC=/opt/mongodbtoolchain/v3/bin/clang
            PATH=/opt/mongodbtoolchain/v3/bin:$PATH
            CFLAGS="-fsanitize=memory -fno-omit-frame-pointer -fno-optimize-sibling-calls -O1 -ggdb"
          posix_configure_flags:
            --enable-silent-rules
            --enable-strict
            --enable-diagnostic
            --disable-static
            --enable-tcmalloc
            --prefix=$(pwd)/LOCAL_INSTALL
          smp_command: -j $(grep -c ^processor /proc/cpuinfo)
          make_command: PATH=/opt/mongodbtoolchain/v3/bin:$PATH make
          test_env_vars:
            MSAN_OPTIONS="abort_on_error=1:disable_coredump=0:print_stacktrace=1"
            MSAN_SYMBOLIZER_PATH=/opt/mongodbtoolchain/v3/bin/llvm-symbolizer
            LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libeatmydata.so LD_LIBRARY_PATH=$(pwd)/.libs:$(git rev-parse --show-toplevel)/TCMALLOC_LIB/lib
            PATH=/opt/mongodbtoolchain/v3/bin:$PATH
            top_srcdir=$(pwd)/..
            top_builddir=$(pwd)
            TESTUTIL_SLOW_MACHINE=1
        tasks:
          - name: clang-analyzer
          - name: compile
          - name: compile-production-disable-shared
          - name: compile-production-disable-static
          - name: examples-c-production-disable-shared-test
          - name: examples-c-production-disable-static-test
          - name: format-stress-pull-request-test
          - name: make-check-test
      

            Assignee:
            chenhao.qu@mongodb.com Chenhao Qu
            Reporter:
            jie.chen@mongodb.com Jie Chen
            Will Korteland
            Votes:
            0 Vote for this issue
            Watchers:
            10 Start watching this issue

              Created:
              Updated:
              Resolved: