Uploaded image for project: 'MariaDB Connector/C'
  1. MariaDB Connector/C
  2. CONC-483

Workaround for MSAN bug needed

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • None
    • N/A
    • None
    • None

    Description

      marko is hitting MSAN issues with C/C due to a bug in MSAN and needs the following workaround applied:

      diff --git a/libmariadb/mariadb_stmt.c b/libmariadb/mariadb_stmt.c
      index 8f5bddc..e15e1bd 100644
      --- a/libmariadb/mariadb_stmt.c
      +++ b/libmariadb/mariadb_stmt.c
      @@ -1,5 +1,5 @@
       /****************************************************************************
      -  Copyright (C) 2012 Monty Program AB
      +  Copyright (C) 2012, 2020, MariaDB Corporation.
       
         This library is free software; you can redistribute it and/or
         modify it under the terms of the GNU Library General Public
      @@ -56,7 +56,12 @@
       #include <mysql/client_plugin.h>
       #include <ma_common.h>
       #include "ma_priv.h"
      -
      +#ifndef __has_feature
      +# define __has_feature(x) 0
      +#endif
      +#if __has_feature(memory_sanitizer)
      +# include <sanitizer/msan_interface.h>
      +#endif
       
       #define UPDATE_STMT_ERROR(stmt)\
       SET_CLIENT_STMT_ERROR((stmt), (stmt)->mysql->net.last_errno, (stmt)->mysql->net.sqlstate, (stmt)->mysql->net.last_error)
      @@ -542,7 +547,13 @@ int store_param(MYSQL_STMT *stmt, int column, unsigned char **p, unsigned long r
           (*p) += 4;
           break;
         case MYSQL_TYPE_DOUBLE:
      +#if __has_feature(memory_sanitizer)         /* QQ: MSAN has double trouble? */
      +    __msan_check_mem_is_initialized(buf, sizeof(double));
      +#endif
           float8store(*p, (*(double *)buf));
      +#if __has_feature(memory_sanitizer)        /* QQ: MSAN has double trouble? */
      +    __msan_unpoison(*p, sizeof(double));
      +#endif
           (*p) += 8;
           break;
         case MYSQL_TYPE_LONGLONG:
      

      Attachments

        Issue Links

          Activity

            People

              georg Georg Richter
              LinuxJedi Andrew Hutchings (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

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