1. 25 Aug, 2016 3 commits
    • Sivert Sorumgard's avatar
      Bug#24388753: PRIVILEGE ESCALATION USING MYSQLD_SAFE · 48bd8b16
      Sivert Sorumgard authored
      [This is the 5.5/5.6 version of the bugfix].
      
      The problem was that it was possible to write log files ending
      in .ini/.cnf that later could be parsed as an options file.
      This made it possible for users to specify startup options
      without the permissions to do so.
      
      This patch fixes the problem by disallowing general query log
      and slow query log to be written to files ending in .ini and .cnf.
      48bd8b16
    • Jon Olav Hauglid's avatar
      Bug#24388746: PRIVILEGE ESCALATION AND RACE CONDITION USING CREATE TABLE · 4e547386
      Jon Olav Hauglid authored
      During REPAIR TABLE of a MyISAM table, a temporary data file (.TMD)
      is created. When repair finishes, this file is renamed to the original
      .MYD file. The problem was that during this rename, we copied the
      stats from the old file to the new file with chmod/chown. If a user
      managed to replace the temporary file before chmod/chown was executed,
      it was possible to get an arbitrary file with the privileges of the
      mysql user.
      
      This patch fixes the problem by not copying stats from the old
      file to the new file. This is not needed as the new file was
      created with the correct stats. This fix only changes server
      behavior - external utilities such as myisamchk still does
      chmod/chown.
      
      No test case provided since the problem involves synchronization
      with file system operations.
      4e547386
    • Terje Rosten's avatar
      Bug#24464380 PRIVILEGE ESCALATION USING MYSQLD_SAFE · 684a165f
      Terje Rosten authored
      Argument to malloc-lib must be included in restricted list of
      directories, symlink guards added, and mysqld and mysqld-version
      options restricted to command line only. Don't redirect errors to
      stderr.
      684a165f
  2. 05 Aug, 2016 1 commit
    • Neha Kumari's avatar
      Bug#23540182:MYSQLBINLOG DOES NOT FREE THE EXISTING CONNECTION BEFORE OPENING NEW REMOTE ONE · 22eec689
      Neha Kumari authored
      It happens when you are trying to read two or more log files from a
      remote server using mysqlbinlog utility.
      
      The reason for this is no matching mysql_close() that concludes the
      life time of 'mysql' struct describing connection to the server.
      This happens when mysqlbinlog is invoked with connecting to the server
      and requesting more than one binlog file. In such case
      dump_remote_log_entries() keeps calling safe_connect() per eachfile,
      never caring to invoke mysql_close(). Only the final safe_connect()'s
      allocation effect are cleaned by the base code.
      That is with 2 files there's one 'mysql' connection descriptor struct
      uncleaned/deallocated.
      
      We are backporting the bug 21255763 (pushed in mysql-trunk)
      in the earlier version of MySQL starting from 5.5 to 5.7.
      which was pushed in mysql-trunk.
      
      Fix:
      Invoke mysql_close() just before mysql_init() in safe_connect()
      defined in mysqlbinlog.cc. That makes possibly previously used 'mysql' be
      reclaimed prior a new one is allocated.
      22eec689
  3. 04 Aug, 2016 1 commit
  4. 03 Aug, 2016 2 commits
    • Kailasnath Nagarkar's avatar
      Bug #19984392 : MEDIUMINT: STACK BUFFER OVERFLOW IN PROTOCOL_TEXT::STORE_LONG · 322afb2c
      Kailasnath Nagarkar authored
      ISSUE: Queries with mediumint as column when operated with
      long long type of data results in buffer overflow in
      store_long function.
      
      The merging rule specified for (MYSQL_TYPE_LONGLONG
      MYSQL_TYPE_INT24) is MYSQL_TYPE_LONG. Due to this store_long
      function was getting called which resulted in buffer overflow.
      
      SOLUTION:
      The correct merging rule for (MYSQL_TYPE_LONGLONG,
      MYSQL_TYPE_INT24) should be MYSQL_TYPE_LONGLONG.
      So, instead of function store_long, function store_longlong
      is called which correctly handles the type MYSQL_TYPE_LONGLONG.
      
      External Bug #23645238 is a duplicate of this issue.
      322afb2c
    • Sreeharsha Ramanavarapu's avatar
      Bug #24380263: INCORRECT BEHAVIOR WITH PARAMETER AND · 8bb95e9a
      Sreeharsha Ramanavarapu authored
                     DERIVED TABLE IN JOIN
      
      ISSUE:
      ------
      This problem occurs under the following conditions:
      1) A parameter is used in the select-list of a derived table.
      2) The derived table is part of a JOIN.
      
      SOLUTION:
      ---------
      When a derived table is materialized, a temporary table is
      created. This temporary table creates a field each for the
      items in the select-list of the derived table. This set of
      fields is later used to setup the join.
      
      Currently no field is created in the temporary table if a
      parameter is used in the select-list.
      
      Create a field for the parameter. By default Item_param's
      result type in a prepared statement is set to
      STRING_RESULT. This can change during the execute phase
      depending on the user variable. But since the execute phase
      creates its own temporary table, it will be handled
      separately.
      
      This is a backport of the fix for BUG#22392374.
      8bb95e9a
  5. 29 Jul, 2016 1 commit
  6. 25 Jul, 2016 2 commits
    • Neha Kumari's avatar
      BUG#23509275 :DBUG_PRINT in THD::decide_logging_format prints incorrectly, access out-of-bound · a63a250d
      Neha Kumari authored
      Problem:
      In debug builds, there is a chance that an out-of-bounds
      read is performed when tables are locked in
      LTM_PRELOCKED_UNDER_LOCK_TABLES mode. It can happen because
      the debug code uses enum values as index for an array of
      mode descriptions, but it only takes into consideration 3
      out of 4 of the enum values.
      
      Fix:
      This patch fixes it by implementing a getter for the enum which
      returns a string representation of the enum,
      effectively removing the out-of-bounds read.
      
      Moreover, it also fixes the lock mode descriptions that
      would be print out in debug builds.
      a63a250d
    • Thayumanavar S's avatar
      BUG#23703568 - IS CLIENT LIBRARY SUPPOSED TO RETRY EINTR INDEFINITELY OR NOT · 2674cf91
      Thayumanavar S authored
      Commit#ebd24626 obsoleted the THREAD and
      THREAD_SAFE_CLIENT preprocessor symbols. This is not removed in the
      sql/net_serv.cc thereby the code that retries on EINTR became dead code.
      Remove the THREAD_SAFE_CLIENT preprocessor directive form sql/net_serv.cc.
      Also check errno for EINTR only if there is an error in preceding read call.
      2674cf91
  7. 22 Jul, 2016 2 commits
    • Arun Kuruvila's avatar
      Bug #23295288: HANDLE_FATAL_SIGNAL (SIG=11) IN · fd31eea9
      Arun Kuruvila authored
                     GET_SERVER_FROM_TABLE_TO_CACHE
      
      Description:- Server received SIG11 in the function,
      "get_server_from_table_to_cache()".
      
      Analysis:- Defining a server with a blank name is not
      handled properly.
      
      Fix:- Modified "get_server_from_table_to_cache()" to
      take care of blank server name.
      fd31eea9
    • Sreeharsha Ramanavarapu's avatar
      Bug #23280699: MYSQLD GOT SIGNAL 11 IN IS_NULL ON SELECT · ac460e58
      Sreeharsha Ramanavarapu authored
                     FROM I_S
      
      Issue:
      ------
      There is a difference in the field type created when the
      following DDLs are used:
      
      1) CREATE TABLE t0 AS SELECT NULL;
      2) CREATE TABLE t0 AS SELECT GREATEST(NULL,NULL);
      
      The first statement creates field of type Field_string and
      the second one creates a field of type Field_null.
      
      This creates a problem when the query mentioned in this bug
      is used. Since the null_ptr is calculated differently for
      Field_null.
      
      Solution:
      ---------
      When there is a function returning null in the select list
      as mentioned above, the field should be of type
      Field_string.
      
      This was fixed in 5.6+ as part of Bug#14021323. This is a
      backport to mysql-5.5.
      
      An incorrect comment in innodb_bug54044.test has been
      corrected in all versions.
      ac460e58
  8. 19 Jul, 2016 1 commit
  9. 07 Jul, 2016 1 commit
  10. 05 Jul, 2016 1 commit
  11. 01 Jul, 2016 1 commit
    • Kailasnath Nagarkar's avatar
      Bug #23296299 : HANDLE_FATAL_SIGNAL (SIG=11) IN · 07a33cdc
      Kailasnath Nagarkar authored
                      MY_TOSORT_UTF32
      
      This patch is specific for mysql-5.5
      
      ISSUE: When a charater that is larger than possible to
      handle is passed to function my_tosort_utf32(), it results
      in segmentation fault. In the scenario mentioned in the bug
      AES_ENCRYPT function is used which returns large value.
      This value is further passed to my_tosort_utf32 function.
      This causes to cross array bound for array uni_plane,
      resulting in segment violation.
      
      SOLUTION:
      This issue has got addressed in 5.6 onward releases
      through worklog 2673.
      
      The fix is similar backport of that.
      Check for maximum character before accessing the array
      uni_plane. In addition to function my_tosort_utf32, the
      same potential problem is also present in functions
      my_tolower_utf16, my_toupper_utf16, my_tosort_utf16,
      my_tolower_utf32, my_toupper_utf32, my_tosort_unicode,
      my_tolower_utf8mb4 and my_toupper_utf8mb4.
      Fixed these functions as well.
      07a33cdc
  12. 30 Jun, 2016 1 commit
    • Christopher Powers's avatar
      Bug#14111584 PB2: PERFSCHEMA.AGGREGATE FAILS ON PB2 SPORADICALLY · 6986645c
      Christopher Powers authored
      Permanently removed test case perfschema.aggregate.
      
      The Performance Schema is generally lock-free, allowing for
      race conditions that might arise from multi-threaded operation
      which occasionally results in temporary and/or minor variances
      when aggregating statistics. This test needs to be redesigned
      to accommodate such variances.
      6986645c
  13. 27 Jun, 2016 1 commit
  14. 20 Jun, 2016 1 commit
    • Thayumanavar S's avatar
      BUG#23080148 - BACKPORT BUG 14653594 AND BUG 20683959 TO · 9f7288e2
      Thayumanavar S authored
                     MYSQL-5.5
      
      The bug asks for a backport of bug#1463594 and bug#20682959. This
      is required because of the fact that if replication is enabled, master
      transaction can commit whereas slave can't commit due to not exact
      'enviroment'. This manifestation is seen in bug#22024200.
      9f7288e2
  15. 17 Jun, 2016 2 commits
    • Terje Rosten's avatar
      BUG#17903583 MYSQL-COMMUNITY-SERVER SHOULD NOT DEPEND ON MYSQL-COMMUNITY-CLIENT (#70985) · 4a3f1c1f
      Terje Rosten authored
      Fix is a backport of BUG#18518216/72230 to MySQL 5.5 and 5.6.
      
      Will also resolve:
      
       BUG#23605713/81384 LIBMYSQLCLIENT.SO.18 MISSING FROM MYSQL 5.7
      
        as mysql-community-libs-5.5 or mysql-community-libs-5.6 can
        installed on EL6 system with libmysqlclient.16 (from MySQL 5.1)
        libmysqlclient.20 (from MySQL 5.7) by doing:
      
        $ rpm --oldpackage -ivh mysql-community-libs-5.5.50-2.el6.x86_64.rpm
      
        Providing a way to have several versions of libmysqlclient installed
        on the same system.
      
      and help:
      
       BUG#23088014/80981 LIBS-COMPAT RPMS SHOULD BE INDEPENDENT OF ALL OTHER SUBPACKAGES
      
        due to less strict coupling between -libs-compat and -common package.
      4a3f1c1f
    • Shishir Jaiswal's avatar
      Bug#23498283 - BUFFER OVERFLOW · 957aefdc
      Shishir Jaiswal authored
      DESCRIPTION
      ===========
      Buffer overflow is reported in Regex library. This can be
      triggered when the data corresponding to argv[1] is >=
      512 bytes resutling in abnormal behaviour.
      
      ANALYSIS
      ========
      Its a straight forward case of SEGFAULT where the target
      buffer is smaller than the source string to be copied.
      A simple pre-copy validation should do.
      
      FIX
      ===
      A check is added before doing strcpy() to ensure that the
      target buffer is big enough to hold the to-be copied data.
      If the check fails, the program aborts.
      957aefdc
  16. 03 Jun, 2016 1 commit
  17. 02 Jun, 2016 2 commits
  18. 30 May, 2016 1 commit
    • Arun Kuruvila's avatar
      Bug#23035296: MAIN.MYSQLDUMP FAILS BECUASE OF UNEXPECTED · 5dc6a77b
      Arun Kuruvila authored
                    ERROR MESSAGE
      
      Description:- Mtr test, "main.mysqldump" is failing with an
      assert when "mysqlimport" client utility is executed with
      the option "--use_threads".
      
      Analysis:- "mysqlimport" uses the option, "--use_threads",
      to spawn worker threads to complete its job in parallel. But
      currently the main thread is not waiting for the worker
      threads to complete its cleanup, rather just wait for the
      worker threads to say its done doing its job. So the cleanup
      is done in a race between the worker threads and the main
      thread. This lead to an assertion failure.
      
      Fix:- "my_thread_join()" is introduced in the main thread to
      join all the worker threads it have spawned. This will let
      the main thread to wait for all the worker threads to
      complete its cleanup before calling "my_end()".
      5dc6a77b
  19. 24 May, 2016 1 commit
    • Sreeharsha Ramanavarapu's avatar
      Bug #23279858: MYSQLD GOT SIGNAL 11 ON SIMPLE SELECT · 115f0828
      Sreeharsha Ramanavarapu authored
                     NAME_CONST QUERY
      
      ISSUE:
      ------
      Using NAME_CONST with a non-constant negated expression as
      value can result in incorrect behavior.
      
      SOLUTION:
      ---------
      The problem can be avoided by checking whether the argument
      is a constant value.
      
      The fix is a backport of Bug#12735545.
      115f0828
  20. 20 May, 2016 1 commit
  21. 18 May, 2016 2 commits
    • Balasubramanian Kandasamy's avatar
      BUG#21879694 - /VAR/LOG/MYSQLD.LOG HAS INCORRECT PERMISSIONS AFTER INSTALLING SERVER FROM REPO · 8281068f
      Balasubramanian Kandasamy authored
      Description:
      This issue doesn't effect any default installation of repo rpms if user uses
      init scripts that are shipped as part of package but will have trouble if
      user tries to createdb or start server manually.
      
      After installing mysql-server from repository(yum,zypper) /var/log/mysqld.log
      is created with logged in user and group permissions instead of with mysql
      user and group permissions,due to which while creating database or starting
      server, it is failing
      
      Fix:
      
      Updated the user and group permissions of the /var/log/mysqld.log and
      /var/log/mysql/mysqld.log (for sles) files to mysql.
      8281068f
    • Karthik Kamath's avatar
      BUG#21142859: FUNCTION UPDATING A VIEW FAILS TO FIND TABLE · 90b9c957
      Karthik Kamath authored
                    THAT ACTUALLY EXISTS
      
      ANALYSIS:
      =========
      Stored functions updating a view where the view table has a
      trigger defined that updates another table, fails reporting
      an error that the table doesn't exist.
      
      If there is a trigger defined on a table, a variable
      'trg_event_map' will be set to a non-zero value after the
      parsed tree creation. This indicates what triggers we need to
      pre-load for the TABLE_LIST when opening an associated table.
      
      During the prelocking phase, the variable 'trg_event_map'
      will not be set for the view table. This value will be set
      after the processing of triggers defined on the table. During
      the processing of sub-statements, 'locked_tables_mode' will be
      set to 'LTM_PRELOCKED' which denotes that further locking
      of tables/functions cannot be done. This results in the other
      table not being locked and thus further processing results in
      an error getting reported.
      
      FIX:
      ====
      During the prelocking of view, the value of 'trg_event_map'
      of the view is copied to 'trg_event_map' of the next table
      in the TABLE_LIST. This results in the locking of tables
      associated with the trigger as well.
      90b9c957
  22. 16 May, 2016 3 commits
    • Sujatha Sivakumar's avatar
      Bug#23251517: SEMISYNC REPLICATION HANGING · ef3f09f0
      Sujatha Sivakumar authored
      Revert following bug fix:
      
      Bug#20685029: SLAVE IO THREAD SHOULD STOP WHEN DISK IS
      FULL
      Bug#21753696: MAKE SHOW SLAVE STATUS NON BLOCKING IF IO
      THREAD WAITS FOR DISK SPACE
      
      This fix results in a deadlock between slave IO thread
      and SQL thread.
      
      (cherry picked from commit e3fea6c6dbb36c6ab21c4ab777224560e9608b53)
      ef3f09f0
    • Shishir Jaiswal's avatar
      Bug#21977380 - POSSIBLE BUFFER OVERFLOW ISSUES · 9d72fb4a
      Shishir Jaiswal authored
      DESCRIPTION
      ===========
      Buffer overflow is reported in a lot of code sections
      spanning across server, client programs, Regex libraries
      etc. If not handled appropriately, they can cause abnormal
      behaviour.
      
      ANALYSIS
      ========
      The reported casea are the ones which are likely to result
      in SEGFAULT, MEMORY LEAK etc.
      
      FIX
      ===
      - sprintf() has been replaced by my_snprintf() to avoid
      buffer overflow.
      - my_free() is done after checking if the pointer isn't
        NULL already and setting it to NULL thereafter at few
        places.
      - Buffer is ensured to be large enough to hold the data.
      - 'unsigned int' (aka 'uint') is replaced with 'size_t'
      to avoid wraparound.
      - Memory is freed (if not done so) after its alloced and
      used.
      - Inserted assert() for size check in InnoDb memcached
      code (from 5.6 onwards)
      - Other minor changes
      
      (cherry picked from commit 3487e20959c940cbd24429afa795ebfc8a01e94f)
      9d72fb4a
    • Shishir Jaiswal's avatar
      Bug#21977380 - POSSIBLE BUFFER OVERFLOW ISSUES · cb297415
      Shishir Jaiswal authored
      DESCRIPTION
      ===========
      Buffer overflow is reported in a lot of code sections
      spanning across server, client programs, Regex libraries
      etc. If not handled appropriately, they can cause abnormal
      behaviour.
      
      ANALYSIS
      ========
      The reported casea are the ones which are likely to result
      in SEGFAULT, MEMORY LEAK etc.
      
      FIX
      ===
      - sprintf() has been replaced by my_snprintf() to avoid
      buffer overflow.
      - my_free() is done after checking if the pointer isn't
        NULL already and setting it to NULL thereafter at few
        places.
      - Buffer is ensured to be large enough to hold the data.
      - 'unsigned int' (aka 'uint') is replaced with 'size_t'
      to avoid wraparound.
      - Memory is freed (if not done so) after its alloced and
      used.
      - Inserted assert() for size check in InnoDb memcached
      code (from 5.6 onwards)
      - Other minor changes
      cb297415
  23. 13 May, 2016 1 commit
    • Sujatha Sivakumar's avatar
      Bug#23251517: SEMISYNC REPLICATION HANGING · df7ecf64
      Sujatha Sivakumar authored
      Revert following bug fix:
      
      Bug#20685029: SLAVE IO THREAD SHOULD STOP WHEN DISK IS
      FULL
      Bug#21753696: MAKE SHOW SLAVE STATUS NON BLOCKING IF IO
      THREAD WAITS FOR DISK SPACE
      
      This fix results in a deadlock between slave IO thread
      and SQL thread.
      df7ecf64
  24. 04 May, 2016 1 commit
    • Sujatha Sivakumar's avatar
      Bug#12818255: READ-ONLY OPTION DOES NOT ALLOW · 818b3a91
      Sujatha Sivakumar authored
      INSERTS/UPDATES ON TEMPORARY TABLES
      Bug#14294223: CHANGES NOT ALLOWED TO TEMPORARY TABLES ON
      READ-ONLY SERVERS
      
      Problem:
      ========
      Running 5.5.14 in read only we can create temporary tables
      but can not insert or update records in the table. When we
      try we get Error 1290 : The MySQL server is running with the
      --read-only option so it cannot execute this statement.
      
      Analysis:
      =========
      This bug is very specific to binlog being enabled and
      binlog-format being stmt/mixed. Standalone server without
      binlog enabled or with row based binlog-mode works fine.
      
      How standalone server and row based replication work:
      =====================================================
      Standalone server and row based replication mark the
      transactions as read_write only when they are modifying
      non temporary tables as part of their current transaction.
      
      Because of this when code enters commit phase it checks
      if a transaction is read_write or not. If the transaction
      is read_write and global read only mode is enabled those
      transaction will fail with 'server is read only mode'
      error.
      
      In the case of statement based mode at the time of writing
      to binary log a binlog handler is created and it is always
      marked as read_write. In case of temporary tables even
      though the engine did not mark the transaction as read_write
      but the new transaction that is started by binlog handler is
      considered as read_write.
      
      Hence in this case when code enters commit phase it finds
      one handler which has a read_write transaction even when
      we are modifying temporary table. This causes the server
      to throw an error when global read-only mode is enabled.
      
      Fix:
      ====
      At the time of commit in "ha_commit_trans" if a read_write
      transaction is found, we should check if this transaction is
      coming from a handler other than binlog_handler. This will
      ensure that there is a genuine read_write transaction being
      sent by the engine apart from binlog_handler and only then
      it should be blocked.
      818b3a91
  25. 02 May, 2016 1 commit
  26. 29 Apr, 2016 1 commit
  27. 22 Apr, 2016 1 commit
    • Nisha Gopalakrishnan's avatar
      BUG#23135731: INSERT WITH DUPLICATE KEY UPDATE REPORTS · 3b6f9aac
      Nisha Gopalakrishnan authored
                    INCORRECT ERROR.
      
      Analysis
      ========
      INSERT with DUPLICATE KEY UPDATE and REPLACE on a table
      where foreign key constraint is defined fails with an
      incorrect 'duplicate entry' error rather than foreign
      key constraint violation error.
      
      As part of the bug fix for BUG#22037930, a new flag
      'HA_CHECK_FK_ERROR' was added while checking for non fatal
      errors to manage FK errors based on the 'IGNORE' flag. For
      INSERT with DUPLICATE KEY UPDATE and REPLACE queries, the
      foreign key constraint violation error was marked as non-fatal,
      even though IGNORE was not set. Hence it continued with the
      duplicate key processing resulting in an incorrect error.
      
      Fix:
      ===
      Foreign key violation errors are treated as non fatal only when
      the IGNORE is not set in the above mentioned queries. Hence reports
      the appropriate foreign key violation error.
      3b6f9aac
  28. 19 Apr, 2016 2 commits
    • Karthik Kamath's avatar
      BUG#22286421: NULL POINTER DEREFERENCE · fbf44eed
      Karthik Kamath authored
      ANALYSIS:
      =========
      A LEX_STRING structure pointer is processed during the
      validation of a stored program name. During this processing,
      there is a possibility of null pointer dereference.
      
      FIX:
      ====
      check_routine_name() is invoked by the parser by supplying a
      non-empty string as the SP name. To avoid any potential calls
      to check_routine_name() with NULL value, a debug assert has
      been added to catch such cases.
      fbf44eed
    • Sujatha Sivakumar's avatar
      Bug#22897202: RPL_IO_THD_WAIT_FOR_DISK_SPACE HAS OCCASIONAL · 3a8f43be
      Sujatha Sivakumar authored
      FAILURES
      
      Analysis:
      =========
      Test script is not ensuring that "assert_grep.inc" should be
      called only after 'Disk is full' error is written to the
      error log.
      
      Test checks for "Queueing master event to the relay log"
      state. But this state is set before invoking 'queue_event'.
      Actual 'Disk is full' error happens at a very lower level.
      It can happen that we might even reset the debug point
      before even the actual disk full simulation occurs and the
      "Disk is full" message will never appear in the error log.
      
      In order to guarentee that we must have some mechanism where
      in after we write "Disk is full" error messge into the error
      log we must signal the test to execute SSS and then reset
      the debug point. So that test is deterministic.
      
      Fix:
      ===
      Added debug sync point to make script deterministic.
      3a8f43be
  29. 14 Apr, 2016 1 commit