[packages/mysql/MYSQL_5_5] Rel 5. Backport MariaDB 5.5.63-5.5.68 security fixes

arekm arekm at pld-linux.org
Mon Nov 2 13:11:24 CET 2026


commit 8dcf8e63bced8118d19e79b5021b88d6bb688e2e
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date:   Mon Nov 2 13:09:20 2026 +0100

    Rel 5. Backport MariaDB 5.5.63-5.5.68 security fixes
    
    Also start mysqld at an absolute nice level, find it in /proc with
    grep -a, add BR pam-devel and libaio-devel, fix the dead Source0 URL.
    
    Fixes CVE-2021-2144, CVE-2021-2007, CVE-2020-2922, CVE-2020-2812,
    CVE-2020-2780, CVE-2020-2752, CVE-2020-2574, CVE-2019-2974,
    CVE-2019-2805, CVE-2019-2740, CVE-2019-2739, CVE-2019-2737,
    CVE-2019-2627, CVE-2019-2614, CVE-2019-2529.

 mysql-binlog-index-strncmp.patch    | 15 +++++++++
 mysql-client-plugin-name.patch      | 23 +++++++++++++
 mysql-client-scramble-length.patch  | 18 ++++++++++
 mysql-client-unpack-fields.patch    | 45 +++++++++++++++++++++++++
 mysql-concat-off-by-one.patch       | 15 +++++++++
 mysql-event-scheduler-leak.patch    | 14 ++++++++
 mysql-heartbeat-ident-len.patch     | 24 +++++++++++++
 mysql-install-plugin-path.patch     | 18 ++++++++++
 mysql-is-prepare-view-uaf.patch     | 28 ++++++++++++++++
 mysql-nested-comment-binlog.patch   | 36 ++++++++++++++++++++
 mysql-plugin-empty-name.patch       | 15 +++++++++
 mysql-register-slave-cleanup.patch  | 34 +++++++++++++++++++
 mysql-rows-event-kill.patch         | 67 +++++++++++++++++++++++++++++++++++++
 mysql-strntoull10rnd-exponent.patch | 30 +++++++++++++++++
 mysql-union-subquery-fields.patch   | 38 +++++++++++++++++++++
 mysql-updatexml-uaf.patch           | 34 +++++++++++++++++++
 mysql-user-table-columns.patch      | 23 +++++++++++++
 mysql-yacc-stack-leak.patch         | 31 +++++++++++++++++
 mysql.init                          |  5 +--
 mysql.spec                          | 48 +++++++++++++++++++++++---
 20 files changed, 554 insertions(+), 7 deletions(-)
---
diff --git a/mysql.spec b/mysql.spec
index 0b6e5e0..4025330 100644
--- a/mysql.spec
+++ b/mysql.spec
@@ -34,14 +34,14 @@ Summary(uk.UTF-8):	MySQL - швидкий SQL-сервер
 Summary(zh_CN.UTF-8):	MySQL数据库服务器
 Name:		mysql
 Version:	5.5.62
-Release:	4
+Release:	5
 License:	GPL + MySQL FLOSS Exception
 Group:		Applications/Databases
 # Source0Download: http://dev.mysql.com/downloads/mysql/5.5.html#downloads
 # Source0:	http://vesta.informatik.rwth-aachen.de/mysql/Downloads/MySQL-5.5/%{name}-%{version}.tar.gz
-Source0:	http://www.percona.com/redir/downloads/Percona-Server-5.5/LATEST/source/tarball/percona-server-%{version}-%{percona_rel}.tar.gz
+Source0:	https://downloads.percona.com/downloads/Percona-Server-5.5/Percona-Server-%{version}-%{percona_rel}/source/tarball/percona-server-%{version}-%{percona_rel}.tar.gz
 # Source0-md5:	45d793f1886528fa64675e1c12b54796
-Source100:	http://www.sphinxsearch.com/files/sphinx-2.2.11-release.tar.gz
+Source100:	https://sphinxsearch.com/files/sphinx-2.2.11-release.tar.gz
 # Source100-md5:	5cac34f3d78a9d612ca4301abfcbd666
 Source1:	%{name}.init
 Source2:	%{name}.sysconfig
@@ -74,19 +74,38 @@ Patch19:	%{name}-chain-certs.patch
 Patch20:	%{name}-dubious-exports.patch
 
 Patch22:	bug-66589.patch
+# Oracle ended 5.5 with 5.5.62; fixes MariaDB 5.5.63-5.5.68 took from MySQL 5.6 or wrote
+Patch100:	%{name}-client-plugin-name.patch
+Patch101:	%{name}-client-scramble-length.patch
+Patch102:	%{name}-client-unpack-fields.patch
+Patch103:	%{name}-strntoull10rnd-exponent.patch
+Patch104:	%{name}-union-subquery-fields.patch
+Patch105:	%{name}-updatexml-uaf.patch
+Patch106:	%{name}-yacc-stack-leak.patch
+Patch107:	%{name}-install-plugin-path.patch
+Patch108:	%{name}-plugin-empty-name.patch
+Patch109:	%{name}-user-table-columns.patch
+Patch110:	%{name}-rows-event-kill.patch
+Patch111:	%{name}-is-prepare-view-uaf.patch
+Patch112:	%{name}-binlog-index-strncmp.patch
+Patch113:	%{name}-event-scheduler-leak.patch
+Patch114:	%{name}-nested-comment-binlog.patch
+Patch115:	%{name}-register-slave-cleanup.patch
+Patch116:	%{name}-heartbeat-ident-len.patch
+Patch117:	%{name}-concat-off-by-one.patch
 URL:		http://www.mysql.com/products/community/
 BuildRequires:	bison >= 1.875
 BuildRequires:	cmake >= 2.6
-BuildRequires:	groff
+BuildRequires:	libaio-devel
 %if "%{pld_release}" == "ac"
 BuildRequires:	libstdc++4-devel >= 5:4.0
 %else
 BuildRequires:	libstdc++-devel >= 5:4.0
 %endif
-BuildRequires:	libtool
 %{?with_tcpd:BuildRequires:	libwrap-devel}
 BuildRequires:	ncurses-devel >= 4.2
 %{?with_ssl:BuildRequires:	openssl-devel >= 0.9.7d}
+BuildRequires:	pam-devel
 %{?with_autodeps:BuildRequires:	perl-DBI}
 BuildRequires:	perl-devel >= 1:5.6.1
 BuildRequires:	readline-devel >= 4.2
@@ -514,6 +533,25 @@ mv sphinx-*/mysqlse storage/sphinx
 
 %patch -P22 -p1
 
+%patch -P100 -p1
+%patch -P101 -p1
+%patch -P102 -p1
+%patch -P103 -p1
+%patch -P104 -p1
+%patch -P105 -p1
+%patch -P106 -p1
+%patch -P107 -p1
+%patch -P108 -p1
+%patch -P109 -p1
+%patch -P110 -p1
+%patch -P111 -p1
+%patch -P112 -p1
+%patch -P113 -p1
+%patch -P114 -p1
+%patch -P115 -p1
+%patch -P116 -p1
+%patch -P117 -p1
+
 # to get these files rebuild
 [ -f sql/sql_yacc.cc ] && rm sql/sql_yacc.cc
 [ -f sql/sql_yacc.h ] && rm sql/sql_yacc.h
diff --git a/mysql-binlog-index-strncmp.patch b/mysql-binlog-index-strncmp.patch
new file mode 100644
index 0000000..15a34e4
--- /dev/null
+++ b/mysql-binlog-index-strncmp.patch
@@ -0,0 +1,15 @@
+find_log_pos() compared binlog index entries past the end of the name
+(Bug#28178776; log_in_use() part is already in 5.5.62).
+https://github.com/MariaDB/server/commit/6de2928d5b
+
+--- percona-server-5.5.62-38.14.orig/sql/log.cc
++++ percona-server-5.5.62-38.14/sql/log.cc
+@@ -3664,7 +3664,7 @@ int MYSQL_BIN_LOG::find_log_pos(LOG_INFO *linfo, const char *log_name,
+     // if the log entry matches, null string matching anything
+     if (!log_name ||
+ 	(log_name_len == fname_len-1 && full_fname[log_name_len] == '\n' &&
+-	 !memcmp(full_fname, full_log_name, log_name_len)))
++	 !strncmp(full_fname, full_log_name, log_name_len)))
+     {
+       DBUG_PRINT("info", ("Found log file entry"));
+       full_fname[fname_len-1]= 0;			// remove last \n
diff --git a/mysql-client-plugin-name.patch b/mysql-client-plugin-name.patch
new file mode 100644
index 0000000..f29af1d
--- /dev/null
+++ b/mysql-client-plugin-name.patch
@@ -0,0 +1,23 @@
+A server could make libmysqlclient dlopen() an arbitrary file by naming it
+as the authentication plugin, e.g. "../../tmp/evil".
+MariaDB MDEV-20110 (5.5.65):
+https://github.com/MariaDB/server/commit/82563c5fc0
+https://github.com/MariaDB/server/commit/cc37250a76
+
+--- percona-server-5.5.62-38.14.orig/sql-common/client_plugin.c
++++ percona-server-5.5.62-38.14/sql-common/client_plugin.c
+@@ -348,7 +348,13 @@ mysql_load_plugin_v(MYSQL *mysql, const char *name, int type,
+            mysql->options.extension && mysql->options.extension->plugin_dir ?
+            mysql->options.extension->plugin_dir : PLUGINDIR, "/",
+            name, SO_EXT, NullS);
+-   
++
++  if (strpbrk(name, "()[]!@#$%^&/*;.,'?\\"))
++  {
++    errmsg= "invalid plugin name";
++    goto err;
++  }
++
+   DBUG_PRINT ("info", ("dlopeninig %s", dlpath));
+   /* Open new dll handle */
+   if (!(dlhandle= dlopen(dlpath, RTLD_NOW)))
diff --git a/mysql-client-scramble-length.patch b/mysql-client-scramble-length.patch
new file mode 100644
index 0000000..34efb89
--- /dev/null
+++ b/mysql-client-scramble-length.patch
@@ -0,0 +1,18 @@
+CVE-2020-2574: a handshake whose scramble length runs past the packet end
+made the client read uninitialised memory (Bug#29630767).
+https://github.com/MariaDB/server/commit/4d1c1b23e1
+
+--- percona-server-5.5.62-38.14.orig/sql-common/client.c
++++ percona-server-5.5.62-38.14/sql-common/client.c
+@@ -3847,7 +3847,10 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
+       scramble_data_len= pkt_scramble_len;
+       scramble_plugin= scramble_data + scramble_data_len;
+       if (scramble_data + scramble_data_len > pkt_end)
+-        scramble_data_len= pkt_end - scramble_data;
++      {
++        set_mysql_error(mysql, CR_MALFORMED_PACKET, unknown_sqlstate);
++        goto error;
++      }
+     }
+     else
+     {
diff --git a/mysql-client-unpack-fields.patch b/mysql-client-unpack-fields.patch
new file mode 100644
index 0000000..1359432
--- /dev/null
+++ b/mysql-client-unpack-fields.patch
@@ -0,0 +1,45 @@
+CVE-2020-2752: malformed pre-4.1 field metadata from the server crashed the
+client (Bug#29597896); more field packets than announced also overflowed
+the result array, now checked like in the 4.1 protocol branch.
+https://github.com/MariaDB/server/commit/e8e67bd4a4
+
+--- percona-server-5.5.62-38.14.orig/sql-common/client.c
++++ percona-server-5.5.62-38.14/sql-common/client.c
+@@ -1557,9 +1557,26 @@ unpack_fields(MYSQL *mysql, MYSQL_DATA *data,MEM_ROOT *alloc,uint fields,
+     /* old protocol, for backward compatibility */
+     for (row=data->data; row ; row = row->next,field++)
+     {
++      /* fields count may be wrong */
++      if (field < result || (uint) (field - result) >= fields)
++        DBUG_RETURN(NULL);
++
++      /*
++       If any of the row->data[] below is NULL, it can result in a
++       crash. Error out early as it indicates a malformed packet.
++       For data[0], data[1] and data[5], strmake_root will handle
++       NULL values.
++      */
++      if (!row->data[2] || !row->data[3] || !row->data[4])
++      {
++        free_rows(data);
++        set_mysql_error(mysql, CR_MALFORMED_PACKET, unknown_sqlstate);
++        DBUG_RETURN(0);
++      }
++
+       cli_fetch_lengths(&lengths[0], row->data, default_value ? 6 : 5);
+-      field->org_table= field->table=  strdup_root(alloc,(char*) row->data[0]);
+-      field->name=   strdup_root(alloc,(char*) row->data[1]);
++      field->org_table= field->table=  strmake_root(alloc,(char*) row->data[0], lengths[0]);
++      field->name=   strmake_root(alloc,(char*) row->data[1], lengths[1]);
+       field->length= (uint) uint3korr(row->data[2]);
+       field->type=   (enum enum_field_types) (uchar) row->data[3][0];
+ 
+@@ -1584,7 +1601,7 @@ unpack_fields(MYSQL *mysql, MYSQL_DATA *data,MEM_ROOT *alloc,uint fields,
+         field->flags|= NUM_FLAG;
+       if (default_value && row->data[5])
+       {
+-        field->def=strdup_root(alloc,(char*) row->data[5]);
++        field->def= strmake_root(alloc,(char*) row->data[5], lengths[5]);
+ 	field->def_length= lengths[5];
+       }
+       else
diff --git a/mysql-concat-off-by-one.patch b/mysql-concat-off-by-one.patch
new file mode 100644
index 0000000..ca8b65e
--- /dev/null
+++ b/mysql-concat-off-by-one.patch
@@ -0,0 +1,15 @@
+CONCAT() treated an argument starting right after its work buffer as a
+substring of it and rewrote the buffer in place.
+https://github.com/MariaDB/server/commit/69bd73173d
+
+--- percona-server-5.5.62-38.14.orig/sql/item_strfunc.cc
++++ percona-server-5.5.62-38.14/sql/item_strfunc.cc
+@@ -540,7 +540,7 @@ String *Item_func_concat::val_str(String *str)
+ 	use_as_buff=str;			// Put next arg here
+       }
+       else if (tmp_value.is_alloced() && res2->ptr() >= tmp_value.ptr() &&
+-	       res2->ptr() <= tmp_value.ptr() + tmp_value.alloced_length())
++	       res2->ptr() < tmp_value.ptr() + tmp_value.alloced_length())
+       {
+ 	/*
+ 	  This happens really seldom:
diff --git a/mysql-event-scheduler-leak.patch b/mysql-event-scheduler-leak.patch
new file mode 100644
index 0000000..f1c0fcc
--- /dev/null
+++ b/mysql-event-scheduler-leak.patch
@@ -0,0 +1,14 @@
+The event scheduler never freed its THD mem_root, memory grew with every
+scheduled event until the server ran out of it (Bug#30628268).
+https://github.com/MariaDB/server/commit/39c60116e8
+
+--- percona-server-5.5.62-38.14.orig/sql/event_scheduler.cc
++++ percona-server-5.5.62-38.14/sql/event_scheduler.cc
+@@ -509,6 +509,7 @@ Event_scheduler::run(THD *thd)
+       DBUG_PRINT("info", ("job_data is NULL, the thread was killed"));
+     }
+     DBUG_PRINT("info", ("state=%s", scheduler_states_names[state].str));
++    free_root(thd->mem_root, MYF(0));
+   }
+ 
+   LOCK_DATA();
diff --git a/mysql-heartbeat-ident-len.patch b/mysql-heartbeat-ident-len.patch
new file mode 100644
index 0000000..60b44ca
--- /dev/null
+++ b/mysql-heartbeat-ident-len.patch
@@ -0,0 +1,24 @@
+The slave error path for a bad heartbeat event read the log name with
+strlen() past the end of the event.
+https://github.com/MariaDB/server/commit/5683c113b8
+
+--- percona-server-5.5.62-38.14.orig/sql/slave.cc
++++ percona-server-5.5.62-38.14/sql/slave.cc
+@@ -4090,7 +4090,7 @@ static int queue_event(Master_info* mi,const char* buf, ulong event_len)
+       error= ER_SLAVE_HEARTBEAT_FAILURE;
+       error_msg.append(STRING_WITH_LEN("inconsistent heartbeat event content;"));
+       error_msg.append(STRING_WITH_LEN("the event's data: log_file_name "));
+-      error_msg.append(hb.get_log_ident(), (uint) strlen(hb.get_log_ident()));
++      error_msg.append(hb.get_log_ident(), (uint) hb.get_ident_len());
+       error_msg.append(STRING_WITH_LEN(" log_pos "));
+       llstr(hb.log_pos, llbuf);
+       error_msg.append(llbuf, strlen(llbuf));
+@@ -4117,7 +4117,7 @@ static int queue_event(Master_info* mi,const char* buf, ulong event_len)
+       error= ER_SLAVE_HEARTBEAT_FAILURE;
+       error_msg.append(STRING_WITH_LEN("heartbeat is not compatible with local info;"));
+       error_msg.append(STRING_WITH_LEN("the event's data: log_file_name "));
+-      error_msg.append(hb.get_log_ident(), (uint) strlen(hb.get_log_ident()));
++      error_msg.append(hb.get_log_ident(), (uint) hb.get_ident_len());
+       error_msg.append(STRING_WITH_LEN(" log_pos "));
+       llstr(hb.log_pos, llbuf);
+       error_msg.append(llbuf, strlen(llbuf));
diff --git a/mysql-install-plugin-path.patch b/mysql-install-plugin-path.patch
new file mode 100644
index 0000000..47d0750
--- /dev/null
+++ b/mysql-install-plugin-path.patch
@@ -0,0 +1,18 @@
+INSTALL PLUGIN with invalid characters in SONAME hung the server, the path
+check ran before the charset check (Bug#27167197).
+https://github.com/MariaDB/server/commit/8ddb7e3eb7
+
+--- percona-server-5.5.62-38.14.orig/sql/sql_plugin.cc
++++ percona-server-5.5.62-38.14/sql/sql_plugin.cc
+@@ -451,9 +451,9 @@ static st_plugin_dl *plugin_dl_add(const LEX_STRING *dl, int report)
+     This is done to ensure that only approved libraries from the
+     plugin directory are used (to make this even remotely secure).
+   */
+-  if (check_valid_path(dl->str, dl->length) ||
+-      check_string_char_length((LEX_STRING *) dl, "", NAME_CHAR_LEN,
++  if (check_string_char_length((LEX_STRING *) dl, "", NAME_CHAR_LEN,
+                                system_charset_info, 1) ||
++      check_valid_path(dl->str, dl->length) ||
+       plugin_dir_len + dl->length + 1 >= FN_REFLEN)
+   {
+     report_error(report, ER_UDF_NO_PATHS);
diff --git a/mysql-is-prepare-view-uaf.patch b/mysql-is-prepare-view-uaf.patch
new file mode 100644
index 0000000..96d34e9
--- /dev/null
+++ b/mysql-is-prepare-view-uaf.patch
@@ -0,0 +1,28 @@
+A prepared CREATE VIEW over an INFORMATION_SCHEMA table kept a table name
+pointer into a freed temporary table; FLUSH PRIVILEGES before EXECUTE
+read freed memory (MDEV-15907).
+https://github.com/MariaDB/server/commit/e52a4ab693
+
+--- percona-server-5.5.62-38.14.orig/sql/sql_show.cc
++++ percona-server-5.5.62-38.14/sql/sql_show.cc
+@@ -7531,8 +7531,6 @@ int mysql_schema_table(THD *thd, LEX *lex, TABLE_LIST *table_list)
+     table->alias_name_used= my_strcasecmp(table_alias_charset,
+                                           table_list->schema_table_name,
+                                           table_list->alias);
+-  table_list->table_name= table->s->table_name.str;
+-  table_list->table_name_length= table->s->table_name.length;
+   table_list->table= table;
+   table->next= thd->derived_tables;
+   thd->derived_tables= table;
+--- percona-server-5.5.62-38.14.orig/sql/table.cc
++++ percona-server-5.5.62-38.14/sql/table.cc
+@@ -4587,7 +4587,8 @@ const char *Field_iterator_table_ref::get_table_name()
+     return natural_join_it.column_ref()->table_name();
+ 
+   DBUG_ASSERT(!strcmp(table_ref->table_name,
+-                      table_ref->table->s->table_name.str));
++                      table_ref->table->s->table_name.str) ||
++              table_ref->schema_table);
+   return table_ref->table_name;
+ }
+ 
diff --git a/mysql-nested-comment-binlog.patch b/mysql-nested-comment-binlog.patch
new file mode 100644
index 0000000..ae6041f
--- /dev/null
+++ b/mysql-nested-comment-binlog.patch
@@ -0,0 +1,36 @@
+A nested comment inside a false version comment was binlogged as is and
+broke the statement on the slave (Bug#28388217).
+https://github.com/mysql/mysql-server/commit/60ce6d5998
+
+--- percona-server-5.5.62-38.14.orig/sql/sql_lex.cc
++++ percona-server-5.5.62-38.14/sql/sql_lex.cc
+@@ -830,17 +830,27 @@ static inline uint int_token(const char *str,uint length)
+ */
+ bool consume_comment(Lex_input_stream *lip, int remaining_recursions_permitted)
+ {
++  // only one level of nested comments are allowed
++  DBUG_ASSERT(remaining_recursions_permitted == 0 ||
++              remaining_recursions_permitted == 1);
+   uchar c;
+   while (! lip->eof())
+   {
+     c= lip->yyGet();
+ 
+-    if (remaining_recursions_permitted > 0)
++    if (remaining_recursions_permitted == 1)
+     {
+       if ((c == '/') && (lip->yyPeek() == '*'))
+       {
++        lip->yyUnput('(');  // Replace nested "/*..." with "(*..."
++        lip->yySkip();      // and skip "("
++
+         lip->yySkip(); /* Eat asterisk */
+-        consume_comment(lip, remaining_recursions_permitted-1);
++        if (consume_comment(lip, 0))
++          return true;
++
++        lip->yyUnput(')');  // Replace "...*/" with "...*)"
++        lip->yySkip();      // and skip ")"
+         continue;
+       }
+     }
diff --git a/mysql-plugin-empty-name.patch b/mysql-plugin-empty-name.patch
new file mode 100644
index 0000000..29725d7
--- /dev/null
+++ b/mysql-plugin-empty-name.patch
@@ -0,0 +1,15 @@
+A row with an empty name in mysql.plugin crashed the server at startup
+(Bug#27302459).
+https://github.com/mysql/mysql-server/commit/8cd3cd8b07
+
+--- percona-server-5.5.62-38.14.orig/sql/sql_plugin.cc
++++ percona-server-5.5.62-38.14/sql/sql_plugin.cc
+@@ -672,7 +672,7 @@ static struct st_plugin_int *plugin_find_internal(const LEX_STRING *name, int ty
+ {
+   uint i;
+   DBUG_ENTER("plugin_find_internal");
+-  if (! initialized)
++  if (!initialized || !name->str)
+     DBUG_RETURN(0);
+ 
+   mysql_mutex_assert_owner(&LOCK_plugin);
diff --git a/mysql-register-slave-cleanup.patch b/mysql-register-slave-cleanup.patch
new file mode 100644
index 0000000..c6834e5
--- /dev/null
+++ b/mysql-register-slave-cleanup.patch
@@ -0,0 +1,34 @@
+COM_REGISTER_SLAVE without COM_BINLOG_DUMP left a stale entry with a
+dangling THD pointer in the slave list (Bug#29915479).
+https://github.com/MariaDB/server/commit/6bb28e0bc5
+
+--- percona-server-5.5.62-38.14.orig/sql/sql_class.cc
++++ percona-server-5.5.62-38.14/sql/sql_class.cc
+@@ -60,6 +60,7 @@
+ #include "debug_sync.h"
+ #include "sql_parse.h"                          // is_update_query
+ #include "sql_callback.h"
++#include "repl_failsafe.h"                      // unregister_slave
+ 
+ /*
+   The following is used to initialise Table_ident with a internal
+@@ -1608,6 +1609,9 @@ THD::~THD()
+   mysql_audit_free_thd(this);
+   if (rli_slave)
+     rli_slave->cleanup_after_session();
++#ifdef HAVE_REPLICATION
++  unregister_slave(this, true, true);
++#endif
+ #endif
+ 
+   free_root(&main_mem_root, MYF(0));
+--- percona-server-5.5.62-38.14.orig/sql/sql_parse.cc
++++ percona-server-5.5.62-38.14/sql/sql_parse.cc
+@@ -1319,7 +1319,6 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
+       general_log_print(thd, command, "Log: '%s'  Pos: %ld", packet+10,
+                       (long) pos);
+       mysql_binlog_send(thd, thd->strdup(packet + 10), (my_off_t) pos, flags);
+-      unregister_slave(thd,1,1);
+       /*  fake COM_QUIT -- if we get here, the thread needs to terminate */
+       error = TRUE;
+       break;
diff --git a/mysql-rows-event-kill.patch b/mysql-rows-event-kill.patch
new file mode 100644
index 0000000..2294529
--- /dev/null
+++ b/mysql-rows-event-kill.patch
@@ -0,0 +1,67 @@
+KILL of a slave SQL thread while a row event opened its tables closed them
+twice and crashed the server.
+https://github.com/mysql/mysql-server/commit/2f72a2a575
+
+--- percona-server-5.5.62-38.14.orig/sql/log_event.cc
++++ percona-server-5.5.62-38.14/sql/log_event.cc
+@@ -8051,23 +8051,20 @@ int Rows_log_event::do_apply_event(Relay_log_info const *rli)
+ 
+     if (open_and_lock_tables(thd, rli->tables_to_lock, FALSE, 0))
+     {
+-      uint actual_error= thd->stmt_da->sql_errno();
+-      if (thd->is_slave_error || thd->is_fatal_error)
++      if (thd->is_error())
+       {
+         /*
+           Error reporting borrowed from Query_log_event with many excessive
+-          simplifications. 
++          simplifications.
+           We should not honour --slave-skip-errors at this point as we are
+-          having severe errors which should not be skiped.
++          having severe errors which should not be skipped.
+         */
+-        rli->report(ERROR_LEVEL, actual_error,
++        rli->report(ERROR_LEVEL, thd->stmt_da->sql_errno(),
+                     "Error executing row event: '%s'",
+-                    (actual_error ? thd->stmt_da->message() :
+-                     "unexpected success or fatal error"));
++                     thd->stmt_da->message());
+         thd->is_slave_error= 1;
+       }
+-      const_cast<Relay_log_info*>(rli)->slave_close_thread_tables(thd);
+-      DBUG_RETURN(actual_error);
++      DBUG_RETURN(1);
+     }
+ 
+     /*
+--- percona-server-5.5.62-38.14.orig/sql/log_event_old.cc
++++ percona-server-5.5.62-38.14/sql/log_event_old.cc
+@@ -101,21 +101,20 @@ Old_rows_log_event::do_apply_event(Old_rows_log_event *ev, const Relay_log_info
+ 
+     if (open_and_lock_tables(ev_thd, rli->tables_to_lock, FALSE, 0))
+     {
+-      uint actual_error= ev_thd->stmt_da->sql_errno();
+-      if (ev_thd->is_slave_error || ev_thd->is_fatal_error)
++      if (ev_thd->is_error())
+       {
+         /*
+           Error reporting borrowed from Query_log_event with many excessive
+-          simplifications (we don't honour --slave-skip-errors)
++          simplifications.
++          We should not honour --slave-skip-errors at this point as we are
++          having severe errors which should not be skipped.
+         */
+-        rli->report(ERROR_LEVEL, actual_error,
++        rli->report(ERROR_LEVEL, ev_thd->stmt_da->sql_errno(),
+                     "Error '%s' on opening tables",
+-                    (actual_error ? ev_thd->stmt_da->message() :
+-                     "unexpected success or fatal error"));
++                    ev_thd->stmt_da->message());
+         ev_thd->is_slave_error= 1;
+       }
+-      const_cast<Relay_log_info*>(rli)->slave_close_thread_tables(thd);
+-      DBUG_RETURN(actual_error);
++      DBUG_RETURN(1);
+     }
+ 
+     /*
diff --git a/mysql-strntoull10rnd-exponent.patch b/mysql-strntoull10rnd-exponent.patch
new file mode 100644
index 0000000..254470d
--- /dev/null
+++ b/mysql-strntoull10rnd-exponent.patch
@@ -0,0 +1,30 @@
+CVE-2019-2974: a huge exponent in a string converted to an integer
+overflowed the shift and crashed the server (Bug#29723340).
+https://github.com/MariaDB/server/commit/719ac0ad4a
+
+--- percona-server-5.5.62-38.14.orig/strings/ctype-simple.c
++++ percona-server-5.5.62-38.14/strings/ctype-simple.c
+@@ -1511,10 +1511,20 @@ exp:    /* [ E [ <sign> ] <unsigned integer> ] */
+         if (++str == end)
+           goto ret_sign;
+       }
+-      for (exponent= 0 ;
+-           str < end && (ch= (uchar) (*str - '0')) < 10;
+-           str++)
++      if (shift > 0 && !negative_exp)
++        goto ret_too_big;
++      for (exponent= 0 ; str < end && (ch= (uchar) (*str - '0')) < 10; str++)
+       {
++        if (negative_exp)
++        {
++          if (exponent - shift > DIGITS_IN_ULONGLONG)
++            goto ret_zero;
++        }
++        else
++        {
++          if (exponent + shift > DIGITS_IN_ULONGLONG)
++            goto ret_too_big;
++        }
+         exponent= exponent * 10 + ch;
+       }
+       shift+= negative_exp ? -exponent : exponent;
diff --git a/mysql-union-subquery-fields.patch b/mysql-union-subquery-fields.patch
new file mode 100644
index 0000000..495204f
--- /dev/null
+++ b/mysql-union-subquery-fields.patch
@@ -0,0 +1,38 @@
+CVE-2019-2529: a UNION in a subquery reserved outer columns for its first
+query block only, then indexed past the array (Bug#28499924).
+https://github.com/MariaDB/server/commit/b20d94da35
+
+--- percona-server-5.5.62-38.14.orig/sql/sql_yacc.yy
++++ percona-server-5.5.62-38.14/sql/sql_yacc.yy
+@@ -14263,19 +14263,21 @@ subselect_end:
+             lex->current_select = lex->current_select->return_after_parsing();
+             lex->nest_level--;
+             lex->current_select->n_child_sum_items += child->n_sum_items;
+-            /*
+-              A subselect can add fields to an outer select. Reserve space for
+-              them.
+-            */
+-            lex->current_select->select_n_where_fields+=
+-            child->select_n_where_fields;
+ 
+             /*
+-              Aggregate functions in having clause may add fields to an outer
+-              select. Count them also.
++              A subquery (and all the subsequent query blocks in a UNION) can
++              add columns to an outer query block. Reserve space for them.
++              Aggregate functions in having clause can also add fields to an
++              outer select.
+             */
+-            lex->current_select->select_n_having_items+=
+-            child->select_n_having_items;
++            for (SELECT_LEX *temp= child->master_unit()->first_select();
++                 temp != NULL; temp= temp->next_select())
++            {
++              lex->current_select->select_n_where_fields+=
++                temp->select_n_where_fields;
++              lex->current_select->select_n_having_items+=
++                temp->select_n_having_items;
++            }
+           }
+         ;
+ 
diff --git a/mysql-updatexml-uaf.patch b/mysql-updatexml-uaf.patch
new file mode 100644
index 0000000..60243f9
--- /dev/null
+++ b/mysql-updatexml-uaf.patch
@@ -0,0 +1,34 @@
+CVE-2019-2740: the XPath parse tree kept pointers into a freed local buffer
+(Bug#27312862).
+https://github.com/MariaDB/server/commit/c5e9674300
+
+--- percona-server-5.5.62-38.14.orig/sql/item_xmlfunc.cc
++++ percona-server-5.5.62-38.14/sql/item_xmlfunc.cc
+@@ -2587,7 +2587,7 @@ my_xpath_parse(MY_XPATH *xpath, const char *str, const char *strend)
+ 
+ void Item_xml_str_func::fix_length_and_dec()
+ {
+-  String *xp, tmp;
++  String *xp;
+   MY_XPATH xpath;
+   int rc;
+ 
+@@ -2612,7 +2612,7 @@ void Item_xml_str_func::fix_length_and_dec()
+     return;
+   }
+ 
+-  if (!(xp= args[1]->val_str(&tmp)))
++  if (!(xp= args[1]->val_str(&xpath_tmp_value)))
+     return;
+   my_xpath_init(&xpath);
+   xpath.cs= collation.collation;
+--- percona-server-5.5.62-38.14.orig/sql/item_xmlfunc.h
++++ percona-server-5.5.62-38.14/sql/item_xmlfunc.h
+@@ -25,6 +25,7 @@ class Item_xml_str_func: public Item_str_func
+ protected:
+   String tmp_value, pxml;
+   Item *nodeset_func;
++  String xpath_tmp_value;
+ public:
+   Item_xml_str_func(Item *a, Item *b): 
+     Item_str_func(a,b) 
diff --git a/mysql-user-table-columns.patch b/mysql-user-table-columns.patch
new file mode 100644
index 0000000..874d299
--- /dev/null
+++ b/mysql-user-table-columns.patch
@@ -0,0 +1,23 @@
+A mysql.user table without the Password column crashed FLUSH PRIVILEGES
+(Bug#28986737).
+https://github.com/mysql/mysql-server/commit/e02123c17c
+
+--- percona-server-5.5.62-38.14.orig/sql/sql_acl.cc
++++ percona-server-5.5.62-38.14/sql/sql_acl.cc
+@@ -1214,8 +1214,16 @@ static my_bool acl_load(THD *thd, TABLE_LIST *tables)
+ 
+   init_read_record(&read_record_info,thd,table=tables[1].table,NULL,1,0,FALSE);
+   table->use_all_columns();
++
++  if (table->s->fields <= MYSQL_USER_FIELD_PASSWORD)
++  {
++    sql_print_error("Fatal error: mysql.user table is damaged with missing "
++                   "password column.");
++    goto end;
++  }
+   password_length= table->field[2]->field_length /
+     table->field[2]->charset()->mbmaxlen;
++
+   if (password_length < SCRAMBLED_PASSWORD_CHAR_LENGTH_323)
+   {
+     sql_print_error("Fatal error: mysql.user table is damaged or in "
diff --git a/mysql-yacc-stack-leak.patch b/mysql-yacc-stack-leak.patch
new file mode 100644
index 0000000..97f1563
--- /dev/null
+++ b/mysql-yacc-stack-leak.patch
@@ -0,0 +1,31 @@
+CVE-2019-2805: the parser stack grown by my_yyoverflow() leaked when the
+parser state was reset (Bug#29419820).
+https://github.com/MariaDB/server/commit/7473a71a28
+
+--- percona-server-5.5.62-38.14.orig/sql/sql_lex.h
++++ percona-server-5.5.62-38.14/sql/sql_lex.h
+@@ -2694,15 +2694,18 @@ public:
+ class Yacc_state
+ {
+ public:
+-  Yacc_state()
+-  {
+-    reset();
+-  }
++  Yacc_state() : yacc_yyss(NULL), yacc_yyvs(NULL) { reset(); }
+ 
+   void reset()
+   {
+-    yacc_yyss= NULL;
+-    yacc_yyvs= NULL;
++    if (yacc_yyss != NULL) {
++      my_free(yacc_yyss);
++      yacc_yyss = NULL;
++    }
++    if (yacc_yyvs != NULL) {
++      my_free(yacc_yyvs);
++      yacc_yyvs = NULL;
++    }
+     m_set_signal_info.clear();
+     m_lock_type= TL_READ_DEFAULT;
+     m_mdl_type= MDL_SHARED_READ;
diff --git a/mysql.init b/mysql.init
index 2ed9cec..5376a41 100755
--- a/mysql.init
+++ b/mysql.init
@@ -123,7 +123,7 @@ mysqlstatus() {
 	fi
 
 	if [ "$mode" = "start" ]; then
-		MYSQL_GREP_PID=$(grep -lE "^/usr/sbin/mysqld.*${MYSQL_PIDFILE}" /proc/[0-9]*/cmdline 2> /dev/null | awk -F "/" '{ print $3; exit; }')
+		MYSQL_GREP_PID=$(grep -alE "^/usr/sbin/mysqld.*${MYSQL_PIDFILE}" /proc/[0-9]*/cmdline 2> /dev/null | awk -F "/" '{ print $3; exit; }')
 		if [ -n "$MYSQL_GREP_PID" ]; then
 			MYSQL_PID=$MYSQL_GREP_PID
 			if grep -qa "$MYSQL_PIDFILE" /proc/$MYSQL_PID/cmdline 2> /dev/null; then
@@ -288,7 +288,8 @@ mysqlstart() {
 	# SERVICE_LIMITS isn't applied automatically: mysqld is started directly, not via daemon()
 	_daemon_set_ulimits
 
-	TMPDIR=/tmp nice -n ${SERVICE_RUN_NICE_LEVEL:-$DEFAULT_SERVICE_RUN_NICE_LEVEL} \
+	# absolute nice level, as daemon() sets it; nice -n alone adds to the caller's level
+	TMPDIR=/tmp nice -n $((${SERVICE_RUN_NICE_LEVEL:-$DEFAULT_SERVICE_RUN_NICE_LEVEL} - $(nice))) \
 		/usr/bin/setsid /usr/sbin/mysqld \
 			--defaults-file=$MYSQL_CONFIG \
 			--datadir=$MYSQL_DATA_DIR \
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/mysql.git/commitdiff/8dcf8e63bced8118d19e79b5021b88d6bb688e2e



More information about the pld-cvs-commit mailing list