summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniele Sciascia <daniele.sciascia@galeracluster.com>2020-08-18 10:56:56 +0200
committerJan Lindström <jan.lindstrom@mariadb.com>2020-08-19 13:12:00 +0300
commitfe3284b2cc8cc4f948aa234b3c6f9f2f8cffa027 (patch)
tree17aca91f5005b560389e21805d3623104b1c0305
parent09dd06f14aaf4ba8088f837625020617e5eca7ea (diff)
downloadmariadb-git-fe3284b2cc8cc4f948aa234b3c6f9f2f8cffa027.tar.gz
MDEV-23092 SIGABRT when setting invalid wsrep_provider
Some invalid wsrep_provider paths may be interpreted as a valid directory. For example '/invalid/libgalera_smm.so' with UTF character set is interpreted as '/', which is a valid directory. A early check that wsrep_provider should not be a directory fixes it.
-rw-r--r--mysql-test/suite/wsrep/r/MDEV-23092.result13
-rw-r--r--mysql-test/suite/wsrep/t/MDEV-23092.cnf8
-rw-r--r--mysql-test/suite/wsrep/t/MDEV-23092.test22
-rw-r--r--sql/wsrep_var.cc6
4 files changed, 49 insertions, 0 deletions
diff --git a/mysql-test/suite/wsrep/r/MDEV-23092.result b/mysql-test/suite/wsrep/r/MDEV-23092.result
new file mode 100644
index 00000000000..d88aacf7d5c
--- /dev/null
+++ b/mysql-test/suite/wsrep/r/MDEV-23092.result
@@ -0,0 +1,13 @@
+SET COLLATION_CONNECTION='utf16le_bin';
+SET GLOBAL wsrep_provider='/invalid/path/libgalera_smm.so';
+ERROR 42000: Variable 'wsrep_provider' can't be set to the value of '/'
+SET GLOBAL wsrep_cluster_address='OFF';
+SET GLOBAL wsrep_slave_threads=10;
+SELECT 1;
+1
+1
+SET GLOBAL wsrep_cluster_address='gcomm://';
+SET GLOBAL wsrep_slave_threads=DEFAULT;
+CALL mtr.add_suppression("wsrep_load()");
+CALL mtr.add_suppression("Failed to create a new provider");
+CALL mtr.add_suppression("Failed to load provider");
diff --git a/mysql-test/suite/wsrep/t/MDEV-23092.cnf b/mysql-test/suite/wsrep/t/MDEV-23092.cnf
new file mode 100644
index 00000000000..851f2999a83
--- /dev/null
+++ b/mysql-test/suite/wsrep/t/MDEV-23092.cnf
@@ -0,0 +1,8 @@
+!include ../my.cnf
+
+[mysqld.1]
+wsrep-on=OFF
+binlog-format=ROW
+wsrep-provider=none
+wsrep-cluster-address='gcomm://'
+innodb_autoinc_lock_mode=2
diff --git a/mysql-test/suite/wsrep/t/MDEV-23092.test b/mysql-test/suite/wsrep/t/MDEV-23092.test
new file mode 100644
index 00000000000..92a6e392013
--- /dev/null
+++ b/mysql-test/suite/wsrep/t/MDEV-23092.test
@@ -0,0 +1,22 @@
+#
+# MDEV-23092: SIGABRT in wsrep::server_state::provider when setting
+# invalid wsrep_provider (on optimized builds)
+#
+
+--source include/have_innodb.inc
+--source include/have_wsrep.inc
+--source include/have_binlog_format_row.inc
+
+SET COLLATION_CONNECTION='utf16le_bin';
+--error 1231
+SET GLOBAL wsrep_provider='/invalid/path/libgalera_smm.so';
+SET GLOBAL wsrep_cluster_address='OFF';
+SET GLOBAL wsrep_slave_threads=10;
+SELECT 1;
+
+SET GLOBAL wsrep_cluster_address='gcomm://';
+SET GLOBAL wsrep_slave_threads=DEFAULT;
+
+CALL mtr.add_suppression("wsrep_load()");
+CALL mtr.add_suppression("Failed to create a new provider");
+CALL mtr.add_suppression("Failed to load provider");
diff --git a/sql/wsrep_var.cc b/sql/wsrep_var.cc
index 64362d1c9e2..3649153e172 100644
--- a/sql/wsrep_var.cc
+++ b/sql/wsrep_var.cc
@@ -320,6 +320,12 @@ static int wsrep_provider_verify (const char* provider_str)
{
return 1;
}
+
+ if (MY_S_ISDIR(f_stat.st_mode))
+ {
+ return 1;
+ }
+
return 0;
}