Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-37615

Clang based static analysis false postive reports on UNINIT_VAR

    XMLWordPrintable

Details

    • Bug
    • Status: In Review (View Workflow)
    • Critical
    • Resolution: Unresolved
    • 10.11
    • 10.11
    • Compiling
    • None
    • Not for Release Notes

    Description

      Problem:

      Infer, the static analysis tool selected to scan our codebase causes lots of errors on UNINIT_VAR.

      Infer is clang based, but doesn't support UBSAN.

      $ cmake -DWITH_UBSAN=ON -DCMAKE_C_COMPILER=/usr/local/lib/infer/infer/lib/wrappers/clang -DCMAKE_CXX_COMPILER=/usr/local/lib/infer/infer/lib/wrappers/clang++ ../mariadb-server-rebase/
      -- The C compiler identification is Clang 20.1.1
      -- The CXX compiler identification is Clang 20.1.1
      -- Detecting C compiler ABI info
      -- Detecting C compiler ABI info - done
      -- Check for working C compiler: /usr/local/lib/infer/infer/lib/wrappers/clang - skipped
      -- Detecting C compile features
      -- Detecting C compile features - done
      -- Detecting CXX compiler ABI info
      -- Detecting CXX compiler ABI info - done
      -- Check for working CXX compiler: /usr/local/lib/infer/infer/lib/wrappers/clang++ - skipped
      -- Detecting CXX compile features
      -- Detecting CXX compile features - done
      -- Running cmake version 3.31.6
      ...have_C__fsanitize_undefined__fno_sanitize_alignment__U_FORTIFY_SOURCE__DWITH_UBSAN
      -- Performing Test have_C__fsanitize_undefined__fno_sanitize_alignment__U_FORTIFY_SOURCE__DWITH_UBSAN - Failed
      -- Performing Test have_CXX__fsanitize_undefined__fno_sanitize_alignment__U_FORTIFY_SOURCE__DWITH_UBSAN
      -- Performing Test have_CXX__fsanitize_undefined__fno_sanitize_alignment__U_FORTIFY_SOURCE__DWITH_UBSAN - Failed
      

      The failing test on WITH_UBSAN result in no UBSAN removal of fake initialization and the result is full of uninitialised value is read and a dead store.

      Solution:

      As added in 0c80ddb519bd06efbd7ccf2a2487b2503cd16db5 the build with error on any clang base uninitialised warning.

      With this in place, the original _clang_ proposed in MDEV-36542.

      Attachments

        Issue Links

          Activity

            People

              monty Michael Widenius
              danblack Daniel Black
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.