diff options
| author | Vijay Anusuri <vanusuri@mvista.com> | 2026-03-24 14:07:41 +0530 |
|---|---|---|
| committer | Gyorgy Sarvari <skandigraun@gmail.com> | 2026-03-24 10:40:05 +0100 |
| commit | 553e138481b03ff4dffa12aeb0bd257ee64faa38 (patch) | |
| tree | 80d5f070bdf2a50af0b4f01529f2b83622942563 | |
| parent | 144725f1e36675fe4d76c6f8a73c00cc6c66ebe0 (diff) | |
| download | meta-openembedded-553e138481b03ff4dffa12aeb0bd257ee64faa38.tar.gz | |
mariadb: Fix CVE-2025-13699
Pick commits according to [1]
[1] https://jira.mariadb.org/browse/MDEV-37483
Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com>
| -rw-r--r-- | meta-oe/recipes-dbs/mysql/mariadb.inc | 2 | ||||
| -rw-r--r-- | meta-oe/recipes-dbs/mysql/mariadb/CVE-2025-13699-1.patch | 90 | ||||
| -rw-r--r-- | meta-oe/recipes-dbs/mysql/mariadb/CVE-2025-13699-2.patch | 173 |
3 files changed, 265 insertions, 0 deletions
diff --git a/meta-oe/recipes-dbs/mysql/mariadb.inc b/meta-oe/recipes-dbs/mysql/mariadb.inc index d15b19725a..6ad19a15dc 100644 --- a/meta-oe/recipes-dbs/mysql/mariadb.inc +++ b/meta-oe/recipes-dbs/mysql/mariadb.inc | |||
| @@ -36,6 +36,8 @@ SRC_URI = "https://archive.mariadb.org/${BP}/source/${BP}.tar.gz \ | |||
| 36 | file://CVE-2025-21490.patch \ | 36 | file://CVE-2025-21490.patch \ |
| 37 | file://CVE-2025-30722.patch \ | 37 | file://CVE-2025-30722.patch \ |
| 38 | file://CVE-2025-30693.patch \ | 38 | file://CVE-2025-30693.patch \ |
| 39 | file://CVE-2025-13699-1.patch \ | ||
| 40 | file://CVE-2025-13699-2.patch \ | ||
| 39 | " | 41 | " |
| 40 | SRC_URI:append:libc-musl = " file://ppc-remove-glibc-dep.patch" | 42 | SRC_URI:append:libc-musl = " file://ppc-remove-glibc-dep.patch" |
| 41 | 43 | ||
diff --git a/meta-oe/recipes-dbs/mysql/mariadb/CVE-2025-13699-1.patch b/meta-oe/recipes-dbs/mysql/mariadb/CVE-2025-13699-1.patch new file mode 100644 index 0000000000..bf526ddfac --- /dev/null +++ b/meta-oe/recipes-dbs/mysql/mariadb/CVE-2025-13699-1.patch | |||
| @@ -0,0 +1,90 @@ | |||
| 1 | From 75b000372b6d2e2dcabb280ff5f3f1e48f994ca8 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Sergei Golubchik <serg@mariadb.org> | ||
| 3 | Date: Fri, 22 Aug 2025 13:21:57 +0200 | ||
| 4 | Subject: [PATCH] cleanup: reusable build_path_for_table() function | ||
| 5 | |||
| 6 | Upstream-Status: Backport [https://github.com/MariaDB/server/commit/75b000372b6d2e2dcabb280ff5f3f1e48f994ca8] | ||
| 7 | CVE: CVE-2025-13699 #Dependency Patch | ||
| 8 | Signed-off-by: Vijay Anusuri <vanusuri@mvista.com> | ||
| 9 | --- | ||
| 10 | client/mysqldump.c | 31 ++++++++++++++++--------------- | ||
| 11 | client/mysqlimport.c | 2 +- | ||
| 12 | 2 files changed, 17 insertions(+), 16 deletions(-) | ||
| 13 | |||
| 14 | diff --git a/client/mysqldump.c b/client/mysqldump.c | ||
| 15 | index 19a2a8109e4ed..3cff3d94b67b9 100644 | ||
| 16 | --- a/client/mysqldump.c | ||
| 17 | +++ b/client/mysqldump.c | ||
| 18 | @@ -1837,6 +1837,17 @@ static char *cover_definer_clause(const char *stmt_str, | ||
| 19 | return query_str; | ||
| 20 | } | ||
| 21 | |||
| 22 | + | ||
| 23 | +static const char* build_path_for_table(char *to, const char *dir, | ||
| 24 | + const char *table, const char *ext) | ||
| 25 | +{ | ||
| 26 | + char tmp_path[FN_REFLEN]; | ||
| 27 | + convert_dirname(tmp_path, path, NULL); | ||
| 28 | + my_load_path(tmp_path, tmp_path, NULL); | ||
| 29 | + return fn_format(to, table, tmp_path, ext, MYF(MY_UNPACK_FILENAME)); | ||
| 30 | +} | ||
| 31 | + | ||
| 32 | + | ||
| 33 | /* | ||
| 34 | Open a new .sql file to dump the table or view into | ||
| 35 | |||
| 36 | @@ -1851,12 +1862,9 @@ static char *cover_definer_clause(const char *stmt_str, | ||
| 37 | */ | ||
| 38 | static FILE* open_sql_file_for_table(const char* table, int flags) | ||
| 39 | { | ||
| 40 | - FILE* res; | ||
| 41 | - char filename[FN_REFLEN], tmp_path[FN_REFLEN]; | ||
| 42 | - convert_dirname(tmp_path,path,NullS); | ||
| 43 | - res= my_fopen(fn_format(filename, table, tmp_path, ".sql", 4), | ||
| 44 | - flags, MYF(MY_WME)); | ||
| 45 | - return res; | ||
| 46 | + char filename[FN_REFLEN]; | ||
| 47 | + return my_fopen(build_path_for_table(filename, path, table, ".sql"), | ||
| 48 | + flags, MYF(MY_WME)); | ||
| 49 | } | ||
| 50 | |||
| 51 | |||
| 52 | @@ -4043,15 +4051,9 @@ static void dump_table(const char *table, const char *db, const uchar *hash_key, | ||
| 53 | |||
| 54 | if (path) | ||
| 55 | { | ||
| 56 | - char filename[FN_REFLEN], tmp_path[FN_REFLEN]; | ||
| 57 | + char filename[FN_REFLEN]; | ||
| 58 | |||
| 59 | - /* | ||
| 60 | - Convert the path to native os format | ||
| 61 | - and resolve to the full filepath. | ||
| 62 | - */ | ||
| 63 | - convert_dirname(tmp_path,path,NullS); | ||
| 64 | - my_load_path(tmp_path, tmp_path, NULL); | ||
| 65 | - fn_format(filename, table, tmp_path, ".txt", MYF(MY_UNPACK_FILENAME)); | ||
| 66 | + build_path_for_table(filename, path, table, ".txt"); | ||
| 67 | |||
| 68 | /* Must delete the file that 'INTO OUTFILE' will write to */ | ||
| 69 | my_delete(filename, MYF(0)); | ||
| 70 | @@ -4060,7 +4062,6 @@ static void dump_table(const char *table, const char *db, const uchar *hash_key, | ||
| 71 | to_unix_path(filename); | ||
| 72 | |||
| 73 | /* now build the query string */ | ||
| 74 | - | ||
| 75 | dynstr_append_checked(&query_string, "SELECT /*!40001 SQL_NO_CACHE */ "); | ||
| 76 | dynstr_append_checked(&query_string, select_field_names.str); | ||
| 77 | dynstr_append_checked(&query_string, " INTO OUTFILE '"); | ||
| 78 | diff --git a/client/mysqlimport.c b/client/mysqlimport.c | ||
| 79 | index 5682df1166850..736d8ba81e4db 100644 | ||
| 80 | --- a/client/mysqlimport.c | ||
| 81 | +++ b/client/mysqlimport.c | ||
| 82 | @@ -339,7 +339,7 @@ static int write_to_table(char *filename, MYSQL *mysql) | ||
| 83 | DBUG_ENTER("write_to_table"); | ||
| 84 | DBUG_PRINT("enter",("filename: %s",filename)); | ||
| 85 | |||
| 86 | - fn_format(tablename, filename, "", "", 1 | 2); /* removes path & ext. */ | ||
| 87 | + fn_format(tablename, filename, "", "", MYF(MY_REPLACE_DIR | MY_REPLACE_EXT)); | ||
| 88 | if (!opt_local_file) | ||
| 89 | strmov(hard_path,filename); | ||
| 90 | else | ||
diff --git a/meta-oe/recipes-dbs/mysql/mariadb/CVE-2025-13699-2.patch b/meta-oe/recipes-dbs/mysql/mariadb/CVE-2025-13699-2.patch new file mode 100644 index 0000000000..271613682e --- /dev/null +++ b/meta-oe/recipes-dbs/mysql/mariadb/CVE-2025-13699-2.patch | |||
| @@ -0,0 +1,173 @@ | |||
| 1 | From ff12ec86a5898a5a4a4eeb77be26ecbd711b3128 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Sergei Golubchik <serg@mariadb.org> | ||
| 3 | Date: Sat, 23 Aug 2025 09:11:42 +0200 | ||
| 4 | Subject: [PATCH] MDEV-37483 mariadb-dump -T doesn't convert table names | ||
| 5 | |||
| 6 | use my_charset_filename to build file names from table names. | ||
| 7 | this guarantees that file name will be always valid for any | ||
| 8 | table name, no matter what characters it contains and what file name | ||
| 9 | rules local filesystem has. | ||
| 10 | |||
| 11 | mariadb-import now converts back, if possible. | ||
| 12 | |||
| 13 | Upstream-Status: Backport [https://github.com/MariaDB/server/commit/ff12ec86a5898a5a4a4eeb77be26ecbd711b312] | ||
| 14 | CVE: CVE-2025-13699 | ||
| 15 | Signed-off-by: Vijay Anusuri <vanusuri@mvista.com> | ||
| 16 | --- | ||
| 17 | client/mysqldump.c | 13 +++++++-- | ||
| 18 | client/mysqlimport.c | 10 +++++++ | ||
| 19 | mysql-test/main/mysqldump.result | 46 ++++++++++++++++++++++++++++++++ | ||
| 20 | mysql-test/main/mysqldump.test | 42 +++++++++++++++++++++++++++++ | ||
| 21 | 4 files changed, 109 insertions(+), 2 deletions(-) | ||
| 22 | |||
| 23 | diff --git a/client/mysqldump.c b/client/mysqldump.c | ||
| 24 | index 3cff3d94b67b9..7372498ffebff 100644 | ||
| 25 | --- a/client/mysqldump.c | ||
| 26 | +++ b/client/mysqldump.c | ||
| 27 | @@ -1841,10 +1841,19 @@ static char *cover_definer_clause(const char *stmt_str, | ||
| 28 | static const char* build_path_for_table(char *to, const char *dir, | ||
| 29 | const char *table, const char *ext) | ||
| 30 | { | ||
| 31 | - char tmp_path[FN_REFLEN]; | ||
| 32 | + char filename[FN_REFLEN], tmp_path[FN_REFLEN]; | ||
| 33 | convert_dirname(tmp_path, path, NULL); | ||
| 34 | my_load_path(tmp_path, tmp_path, NULL); | ||
| 35 | - return fn_format(to, table, tmp_path, ext, MYF(MY_UNPACK_FILENAME)); | ||
| 36 | + if (check_if_legal_tablename(table)) | ||
| 37 | + strxnmov(filename, sizeof(filename) - 1, table, "@@@", NULL); | ||
| 38 | + else | ||
| 39 | + { | ||
| 40 | + uint errors, len; | ||
| 41 | + len= my_convert(filename, sizeof(filename) - 1, &my_charset_filename, | ||
| 42 | + table, (uint32)strlen(table), charset_info, &errors); | ||
| 43 | + filename[len]= 0; | ||
| 44 | + } | ||
| 45 | + return fn_format(to, filename, tmp_path, ext, MYF(MY_UNPACK_FILENAME)); | ||
| 46 | } | ||
| 47 | |||
| 48 | |||
| 49 | diff --git a/client/mysqlimport.c b/client/mysqlimport.c | ||
| 50 | index 736d8ba81e4db..4d826742a8dca 100644 | ||
| 51 | --- a/client/mysqlimport.c | ||
| 52 | +++ b/client/mysqlimport.c | ||
| 53 | @@ -340,6 +340,16 @@ static int write_to_table(char *filename, MYSQL *mysql) | ||
| 54 | DBUG_PRINT("enter",("filename: %s",filename)); | ||
| 55 | |||
| 56 | fn_format(tablename, filename, "", "", MYF(MY_REPLACE_DIR | MY_REPLACE_EXT)); | ||
| 57 | + if (strchr(tablename, '@')) | ||
| 58 | + { | ||
| 59 | + uint errors, len; | ||
| 60 | + const char *csname= my_default_csname(); /* see MYSQL_SET_CHARSET_NAME */ | ||
| 61 | + CHARSET_INFO *cs= get_charset_by_csname(csname, MY_CS_PRIMARY, MYF(0)); | ||
| 62 | + len= my_convert(escaped_name, sizeof(escaped_name) - 1, cs, tablename, | ||
| 63 | + (uint32)strlen(tablename), &my_charset_filename, &errors); | ||
| 64 | + if (!errors) | ||
| 65 | + strmake(tablename, escaped_name, len); | ||
| 66 | + } | ||
| 67 | if (!opt_local_file) | ||
| 68 | strmov(hard_path,filename); | ||
| 69 | else | ||
| 70 | diff --git a/mysql-test/main/mysqldump.result b/mysql-test/main/mysqldump.result | ||
| 71 | index 7cf8a40b5c805..dd70c664d6116 100644 | ||
| 72 | --- a/mysql-test/main/mysqldump.result | ||
| 73 | +++ b/mysql-test/main/mysqldump.result | ||
| 74 | @@ -6624,3 +6624,49 @@ SET character_set_client = @saved_cs_client; | ||
| 75 | drop view `v'1"2`; | ||
| 76 | drop table t1; | ||
| 77 | # End of 10.5 tests | ||
| 78 | +# | ||
| 79 | +# MDEV-37483 mariadb-dump -T doesn't convert table names | ||
| 80 | +# | ||
| 81 | +set names latin1; | ||
| 82 | +create database foo; | ||
| 83 | +use foo; | ||
| 84 | +create table `con_schöne_grüße` (a int) select 1 as a; | ||
| 85 | +create table `con` (b int) select 2 as b; | ||
| 86 | +create table `con/bar` (c int) select 3 as c; | ||
| 87 | +create table `con@home` (d int) select 4 as d; | ||
| 88 | +drop database foo; | ||
| 89 | +use test; | ||
| 90 | +con@002fbar.sql | ||
| 91 | +con@002fbar.txt | ||
| 92 | +con@@@.sql | ||
| 93 | +con@@@.txt | ||
| 94 | +con@home.sql | ||
| 95 | +con@home.txt | ||
| 96 | +con_sch@1ine_gr@1o@1je.sql | ||
| 97 | +con_sch@1ine_gr@1o@1je.txt | ||
| 98 | +show tables; | ||
| 99 | +Tables_in_test | ||
| 100 | +con | ||
| 101 | +con/bar | ||
| 102 | +con@home | ||
| 103 | +con_schöne_grüße | ||
| 104 | +test.con: Records: 1 Deleted: 0 Skipped: 0 Warnings: 0 | ||
| 105 | +test.con/bar: Records: 1 Deleted: 0 Skipped: 0 Warnings: 0 | ||
| 106 | +test.con@home: Records: 1 Deleted: 0 Skipped: 0 Warnings: 0 | ||
| 107 | +select * from `con_schöne_grüße`; | ||
| 108 | +a | ||
| 109 | +1 | ||
| 110 | +select * from `con`; | ||
| 111 | +b | ||
| 112 | +2 | ||
| 113 | +select * from `con/bar`; | ||
| 114 | +c | ||
| 115 | +3 | ||
| 116 | +select * from `con@home`; | ||
| 117 | +d | ||
| 118 | +4 | ||
| 119 | +drop table `con_schöne_grüße`; | ||
| 120 | +drop table `con`; | ||
| 121 | +drop table `con/bar`; | ||
| 122 | +drop table `con@home`; | ||
| 123 | +# End of 10.6 tests | ||
| 124 | diff --git a/mysql-test/main/mysqldump.test b/mysql-test/main/mysqldump.test | ||
| 125 | index 6ffe3a8af419b..971e7f29fa806 100644 | ||
| 126 | --- a/mysql-test/main/mysqldump.test | ||
| 127 | +++ b/mysql-test/main/mysqldump.test | ||
| 128 | @@ -3035,3 +3035,45 @@ drop view `v'1"2`; # "' | ||
| 129 | drop table t1; | ||
| 130 | |||
| 131 | --echo # End of 10.5 tests | ||
| 132 | + | ||
| 133 | +--echo # | ||
| 134 | +--echo # MDEV-37483 mariadb-dump -T doesn't convert table names | ||
| 135 | +--echo # | ||
| 136 | +set names latin1; | ||
| 137 | +create database foo; | ||
| 138 | +use foo; | ||
| 139 | + | ||
| 140 | +create table `con_schöne_grüße` (a int) select 1 as a; | ||
| 141 | +create table `con` (b int) select 2 as b; | ||
| 142 | +create table `con/bar` (c int) select 3 as c; | ||
| 143 | +create table `con@home` (d int) select 4 as d; | ||
| 144 | +exec $MYSQL_DUMP foo --tab $MYSQLTEST_VARDIR/tmp; | ||
| 145 | +drop database foo; | ||
| 146 | +use test; | ||
| 147 | +move_file $MYSQLTEST_VARDIR/tmp/con@0040home.sql $MYSQLTEST_VARDIR/tmp/con@home.sql; | ||
| 148 | +move_file $MYSQLTEST_VARDIR/tmp/con@0040home.txt $MYSQLTEST_VARDIR/tmp/con@home.txt; | ||
| 149 | +list_files $MYSQLTEST_VARDIR/tmp con*; | ||
| 150 | +exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/con@@@.sql; | ||
| 151 | +exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/con@002fbar.sql; | ||
| 152 | +exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/con_sch@1ine_gr@1o@1je.sql; | ||
| 153 | +exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/con@home.sql; | ||
| 154 | +show tables; | ||
| 155 | +exec $MYSQL_IMPORT test $MYSQLTEST_VARDIR/tmp/con@@@.txt; | ||
| 156 | +exec $MYSQL_IMPORT test $MYSQLTEST_VARDIR/tmp/con@002fbar.txt; | ||
| 157 | +if (`select @@version like '10.6.%'`) { | ||
| 158 | +# utf8 console output on Windows is fixed in MDEV-26713, until then | ||
| 159 | +--disable_result_log | ||
| 160 | +} | ||
| 161 | +exec $MYSQL_IMPORT test $MYSQLTEST_VARDIR/tmp/con_sch@1ine_gr@1o@1je.txt; | ||
| 162 | +--enable_result_log | ||
| 163 | +exec $MYSQL_IMPORT test $MYSQLTEST_VARDIR/tmp/con@home.txt; | ||
| 164 | +select * from `con_schöne_grüße`; | ||
| 165 | +select * from `con`; | ||
| 166 | +select * from `con/bar`; | ||
| 167 | +select * from `con@home`; | ||
| 168 | +drop table `con_schöne_grüße`; | ||
| 169 | +drop table `con`; | ||
| 170 | +drop table `con/bar`; | ||
| 171 | +drop table `con@home`; | ||
| 172 | + | ||
| 173 | +--echo # End of 10.6 tests | ||
