Skip to contentSkip to conversation

mariadb: Fix a crash in my_convert()

PATCH Superseded Zoltán Böszörményi 3 participants 14 messages Oct 1, 2025 – Oct 2, 2025 2 messages not in the archive

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 mariadb: Fix a crash in my_convert()

In some cases (most notably when running mysqldump), the server crashes in the my_convert() function, in a code protected by

  #if defined(__i386__) || defined(__x86_64__)
  ...
  #endif

The crash does not happen with the generic code.
Remove the x86[-64] specific optimization.

---
 meta-oe/recipes-dbs/mysql/mariadb.inc         |  1 +
 ...move-x86-specific-loop-in-my_convert.patch | 89 +++++++++++++++++++
 2 files changed, 90 insertions(+)
 create mode 100644 meta-oe/recipes-dbs/mysql/mariadb/0001-Remove-x86-specific-loop-in-my_convert.patch
meta-oe/recipes-dbs/mysql/mariadb.inc +1 -0
index 13e55ebacd..67dd687c02 100644
@@ -24,6 +24,7 @@ SRC_URI = "https://archive.mariadb.org/${BP}/source/${BP}.tar.gz \
            file://0001-Add-missing-includes-cstdint-and-cstdio.patch \
            file://0001-Ensure-compatibility-with-ARMv9-by-updating-.arch-di.patch \
            file://riscv32.patch \
+           file://0001-Remove-x86-specific-loop-in-my_convert.patch \
           "
 SRC_URI[sha256sum] = "1b26c0bb2d025dbfac3b9852d2b7eafda56a171b67ac2e27831ec0414fb7df07"
 
meta-oe/recipes-dbs/mysql/mariadb/0001-Remove-x86-specific-loop-in-my_convert.patch new file +89 -0

89 lines not on this page · raw message

Signature · 1 line
2.51.0
#1 lore raw

PATCH 2/2 mariadb: 11.4.8

11.4.7 fixes a huge performance drop from 11.4.5 to 11.4.6.
https://mariadb.com/docs/release-notes/community-server/mariadb-11-4-series/mariadb-11.4.7-release-notes

11.4.8 fixes several crash problems and other issues.
https://mariadb.com/docs/release-notes/community-server/mariadb-11-4-series/mariadb-11.4.8-release-notes

Removed 0001-aio_linux-Check-if-syscall-exists-before-using-it.patch which is not applicable anymore, the code was rewritten.

Adapted 0001-sql-CMakeLists.txt-fix-gen_lex_hash-not-found.patch to fix fuzz.

Add libxml2-native to DEPENDS in mariadb-native to fix the do_configure failure with the new version.

---
 ...ive_11.4.6.bb => mariadb-native_11.4.8.bb} |  2 +-
 meta-oe/recipes-dbs/mysql/mariadb.inc         |  3 +-
 ...ck-if-syscall-exists-before-using-it.patch | 40 -------------------
 ...Lists.txt-fix-gen_lex_hash-not-found.patch |  6 +--
 .../{mariadb_11.4.6.bb => mariadb_11.4.8.bb}  |  0
 5 files changed, 5 insertions(+), 46 deletions(-)
 rename meta-oe/recipes-dbs/mysql/{mariadb-native_11.4.6.bb => mariadb-native_11.4.8.bb} (92%)
 delete mode 100644 meta-oe/recipes-dbs/mysql/mariadb/0001-aio_linux-Check-if-syscall-exists-before-using-it.patch
 rename meta-oe/recipes-dbs/mysql/{mariadb_11.4.6.bb => mariadb_11.4.8.bb} (100%)
meta-oe/recipes-dbs/mysql/mariadb-native_11.4.8.bb renamed from meta-oe/recipes-dbs/mysql/mariadb-native_11.4.6.bb +1 -1
similarity index 92%
rename from meta-oe/recipes-dbs/mysql/mariadb-native_11.4.6.bb
rename to meta-oe/recipes-dbs/mysql/mariadb-native_11.4.8.bb
index 578357b480..ff48dcd806 100644
@@ -3,7 +3,7 @@ inherit native
 
 PROVIDES += "mysql5-native"
 DEPENDS = "ncurses-native zlib-native bison-native libpcre2-native \
-gnutls-native fmt-native \
+libxml2-native gnutls-native fmt-native \
 "
 
 RDEPENDS:${PN} = ""
meta-oe/recipes-dbs/mysql/mariadb.inc +1 -2
index 67dd687c02..53a24d14bc 100644
@@ -15,7 +15,6 @@ SRC_URI = "https://archive.mariadb.org/${BP}/source/${BP}.tar.gz \
            file://fix-arm-atomic.patch \
            file://0001-Fix-library-LZ4-lookup.patch \
            file://0001-innobase-Define-__NR_futex-if-it-does-not-exist.patch \
-           file://0001-aio_linux-Check-if-syscall-exists-before-using-it.patch \
            file://ssize_t.patch \
            file://sys_futex.patch \
            file://cross-compiling.patch \
@@ -26,7 +25,7 @@ SRC_URI = "https://archive.mariadb.org/${BP}/source/${BP}.tar.gz \
            file://riscv32.patch \
            file://0001-Remove-x86-specific-loop-in-my_convert.patch \
           "
-SRC_URI[sha256sum] = "1b26c0bb2d025dbfac3b9852d2b7eafda56a171b67ac2e27831ec0414fb7df07"
+SRC_URI[sha256sum] = "52fa4dca2c5f80afc1667d523a27c06176d98532298a6b0c31ed73505f49e15c"
 
 UPSTREAM_CHECK_URI = "https://github.com/MariaDB/server/tags"
 
meta-oe/recipes-dbs/mysql/mariadb/0001-aio_linux-Check-if-syscall-exists-before-using-it.patch deleted +0 -40
deleted file mode 100644
index eddfdaaf77..0000000000
@@ -1,40 +0,0 @@
-From f9f019049a9bb09471e8303d4510afae07f225c8 Mon Sep 17 00:00:00 2001
-From: Khem Raj <[email protected]>
-Date: Wed, 18 Aug 2021 06:49:25 +0000
-Subject: [PATCH] aio_linux: Check if syscall exists before using it
-
-Return -ENOSYS if not implememented, fixes build on arches like RISCV32
-Fixes
-tpool/aio_linux.cc:63:20: error: '__NR_io_getevents' was not declared in this scope; did you mean 'io_getevents'?
-   63 |   int ret= syscall(__NR_io_getevents, reinterpret_cast<long>(ctx),
-      |                    ^~~~~~~~~~~~~~~~~
-      |                    io_getevents
-
-Upstream-Status: Pending
-Signed-off-by: Khem Raj <[email protected]>
----
- tpool/aio_linux.cc | 4 ++++
- 1 file changed, 4 insertions(+)
-
-diff --git a/tpool/aio_linux.cc b/tpool/aio_linux.cc
-index 507c6b92..a6adf1af 100644
---- a/tpool/aio_linux.cc
-+++ b/tpool/aio_linux.cc
-@@ -59,6 +59,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 - 1301 USA*/
- */
- static int my_getevents(io_context_t ctx, long min_nr, long nr, io_event *ev)
- {
-+#ifdef __NR_io_getevents
-   int saved_errno= errno;
-   int ret= syscall(__NR_io_getevents, reinterpret_cast<long>(ctx),
-                    min_nr, nr, ev, 0);
-@@ -68,6 +69,9 @@ static int my_getevents(io_context_t ctx, long min_nr, long nr, io_event *ev)
-     errno= saved_errno;
-   }
-   return ret;
-+#else
-+  return -ENOSYS;
-+#endif
- }
- 
- 
meta-oe/recipes-dbs/mysql/mariadb/0001-sql-CMakeLists.txt-fix-gen_lex_hash-not-found.patch +3 -3
index 1475bb1a51..7c73699b08 100644
@@ -18,8 +18,8 @@ diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt
 index 0195555e..507136cb 100644
 --- a/sql/CMakeLists.txt
 +++ b/sql/CMakeLists.txt
-@@ -64,11 +64,18 @@ ${CMAKE_BINARY_DIR}/sql
- ${CMAKE_SOURCE_DIR}/tpool
+@@ -63,11 +63,18 @@
+ ${CMAKE_BINARY_DIR}/sql
  )
  
 -ADD_CUSTOM_COMMAND(
@@ -41,7 +41,7 @@ index 0195555e..507136cb 100644
  
  FIND_PACKAGE(BISON 2.4)
  
-@@ -405,11 +412,18 @@ IF(NOT CMAKE_CROSSCOMPILING OR DEFINED CMAKE_CROSSCOMPILING_EMULATOR)
+@@ -405,11 +412,18 @@
    ADD_EXECUTABLE(gen_lex_hash gen_lex_hash.cc)
  ENDIF()
  
meta-oe/recipes-dbs/mysql/mariadb_11.4.8.bb renamed from meta-oe/recipes-dbs/mysql/mariadb_11.4.6.bb +0 -0
similarity index 100%
rename from meta-oe/recipes-dbs/mysql/mariadb_11.4.6.bb
rename to meta-oe/recipes-dbs/mysql/mariadb_11.4.8.bb
Signature · 1 line
2.51.0
#2 lore raw
In reply to Zoltán Böszörményi
Quoted 82 lines · Zoltán Böszörményi

In some cases (most notably when running mysqldump), the server crashes in the my_convert() function, in a code protected by

  #if defined(__i386__) || defined(__x86_64__)
  ...
  #endif

The crash does not happen with the generic code.
Remove the x86[-64] specific optimization.

---
 meta-oe/recipes-dbs/mysql/mariadb.inc         |  1 +
 ...move-x86-specific-loop-in-my_convert.patch | 89 +++++++++++++++++++
 2 files changed, 90 insertions(+)
 create mode 100644 meta-oe/recipes-dbs/mysql/mariadb/0001-Remove-x86-specific-loop-in-my_convert.patch
meta-oe/recipes-dbs/mysql/mariadb.inc +1 -0
index 13e55ebacd..67dd687c02 100644
@@ -24,6 +24,7 @@ SRC_URI = "https://archive.mariadb.org/${BP}/source/${BP}.tar.gz \
            file://0001-Add-missing-includes-cstdint-and-cstdio.patch \
            file://0001-Ensure-compatibility-with-ARMv9-by-updating-.arch-di.patch \
            file://riscv32.patch \
+           file://0001-Remove-x86-specific-loop-in-my_convert.patch \
           "
 SRC_URI[sha256sum] = "1b26c0bb2d025dbfac3b9852d2b7eafda56a171b67ac2e27831ec0414fb7df07"
 
meta-oe/recipes-dbs/mysql/mariadb/0001-Remove-x86-specific-loop-in-my_convert.patch new file +45 -0
new file mode 100644
index 0000000000..26ba08865a
@@ -0,0 +1,89 @@
+From 79d2a95391abc133e86688696ae21628b7035b2d Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Zolt=C3=A1n=20B=C3=B6sz=C3=B6rm=C3=A9nyi?=
+ <[email protected]>
+Date: Wed, 1 Oct 2025 09:29:04 +0200
+Subject: [PATCH] Remove x86 specific loop in my_convert()
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+mysqldump/mariadb-dump crashes with this backtrace:
+
+| (gdb) bt
+| #0  my_convert (to=<optimized out>, to_length=160, to_cs=0x55b5740fbda0 <my_charset_utf8mb4_general_ci>, from=<optimized out>, from_length=40,
+|     from_cs=0x55b57408bda0 <my_charset_utf8mb3_unicode_ci>, errors=0x7f950c35cd6c) at /usr/src/debug/mariadb/11.8.3/strings/ctype.c:1256
+| #1  0x000055b572d9f4a0 in copy_and_convert (to=0x7f94fc00c9db "Configuratiogicate_log\020automagicate_log\017is_done_message\017is_done_message",
+|     to_length=<optimized out>, to_cs=<optimized out>, from=0x7f94fc059f37 "Configuration downloading from portal...", from_length=40, from_cs=<optimized out>,
+|     errors=0x7f950c35cd6c) at /usr/src/debug/mariadb/11.8.3/sql/sql_string.h:53
+| #2  Protocol::net_store_data_cs (this=0x7f94fc001260, from=0x7f94fc059f37 "Configuration downloading from portal...", length=40, from_cs=<optimized out>,
+|     to_cs=<optimized out>) at /usr/src/debug/mariadb/11.8.3/sql/protocol.cc:114
+| #3  0x000055b572da103f in Protocol::send_result_set_row (this=this@entry=0x7f94fc001260, row_items=row_items@entry=0x7f94fc013418)
+|     at /usr/src/debug/mariadb/11.8.3/sql/protocol.cc:1359
+| #4  0x000055b572e19442 in select_send::send_data (this=0x7f94fc014f78, items=...) at /usr/src/debug/mariadb/11.8.3/sql/sql_class.cc:3294
+| #5  0x000055b572ef7c69 in select_result_sink::send_data_with_check (u=<optimized out>, sent=<optimized out>, this=<optimized out>, items=...)
+|     at /usr/src/debug/mariadb/11.8.3/sql/sql_class.h:6264
+| #6  select_result_sink::send_data_with_check (this=<optimized out>, items=..., u=<optimized out>, sent=<optimized out>)
+|     at /usr/src/debug/mariadb/11.8.3/sql/sql_class.h:6254
+| #7  end_send (join=<optimized out>, join_tab=<optimized out>, end_of_records=<optimized out>) at /usr/src/debug/mariadb/11.8.3/sql/sql_select.cc:25629
+| #8  0x000055b572ec38b6 in evaluate_join_record (join=join@entry=0x7f94fc014fa0, join_tab=join_tab@entry=0x7f94fc016940, error=error@entry=0)
+|     at /usr/src/debug/mariadb/11.8.3/sql/sql_select.cc:24523
+| #9  0x000055b572edcbf2 in sub_select (join=0x7f94fc014fa0, join_tab=0x7f94fc016940, end_of_records=<optimized out>)
+|     at /usr/src/debug/mariadb/11.8.3/sql/sql_select.cc:24290
+| #10 0x000055b572f119c6 in do_select (join=0x7f94fc014fa0, procedure=<optimized out>) at /usr/src/debug/mariadb/11.8.3/sql/sql_select.cc:23801
+| #11 JOIN::exec_inner (this=this@entry=0x7f94fc014fa0) at /usr/src/debug/mariadb/11.8.3/sql/sql_select.cc:5071
+| #12 0x000055b572f11d43 in JOIN::exec (this=this@entry=0x7f94fc014fa0) at /usr/src/debug/mariadb/11.8.3/sql/sql_select.cc:4859
+| #13 0x000055b572f0ffe6 in mysql_select (thd=thd@entry=0x7f94fc000cd8, tables=0x7f94fc013f38, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0,
+|     proc_param=0x0, select_options=551922436864, result=0x7f94fc014f78, unit=0x7f94fc005038, select_lex=0x7f94fc013160)
+|     at /usr/src/debug/mariadb/11.8.3/sql/sql_select.cc:5387
+| #14 0x000055b572f107dd in handle_select (thd=thd@entry=0x7f94fc000cd8, lex=lex@entry=0x7f94fc004f58, result=result@entry=0x7f94fc014f78,
+|     setup_tables_done_option=setup_tables_done_option@entry=0) at /usr/src/debug/mariadb/11.8.3/sql/sql_select.cc:633
+| #15 0x000055b572e77d9e in execute_sqlcom_select (thd=thd@entry=0x7f94fc000cd8, all_tables=0x7f94fc013f38) at /usr/src/debug/mariadb/11.8.3/sql/sql_parse.cc:6190
+| #16 0x000055b572e877be in mysql_execute_command (thd=thd@entry=0x7f94fc000cd8, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false)
+|     at /usr/src/debug/mariadb/11.8.3/sql/sql_parse.cc:3975
+| #17 0x000055b572e88e03 in mysql_parse (thd=0x7f94fc000cd8, rawbuf=<optimized out>, length=<optimized out>, parser_state=<optimized out>)
+|     at /usr/src/debug/mariadb/11.8.3/sql/sql_parse.cc:7905
+| #18 0x000055b572e8b2a1 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x7f94fc000cd8, packet=packet@entry=0x7f94fc0088a9 "",

meta-oe/recipes-dbs/mysql/mariadb/0001-Remove-x86-specific-loop-in-my_convert.patch line 55

Quoted 10 lines
meta-oe/recipes-dbs/mysql/mariadb/0001-Remove-x86-specific-loop-in-my_convert.patch new file +10 -0
+|     packet_length=packet_length@entry=152, blocking=blocking@entry=true) at /usr/src/debug/mariadb/11.8.3/sql/sql_parse.cc:1903
+| #19 0x000055b572e8cf7c in do_command (thd=thd@entry=0x7f94fc000cd8, blocking=blocking@entry=true) at /usr/src/debug/mariadb/11.8.3/sql/sql_parse.cc:1416
+| #20 0x000055b572fcfc0d in do_handle_one_connection (connect=<optimized out>, put_in_cache=true) at /usr/src/debug/mariadb/11.8.3/sql/sql_connect.cc:1415
+| #21 0x000055b572fcffc5 in handle_one_connection (arg=arg@entry=0x55b57943cbd8) at /usr/src/debug/mariadb/11.8.3/sql/sql_connect.cc:1327
+| #22 0x000055b573382440 in pfs_spawn_thread (arg=0x55b5795eb598) at /usr/src/debug/mariadb/11.8.3/storage/perfschema/pfs.cc:2198
+| #23 0x00007f952e8571dd in start_thread (arg=<optimized out>) at pthread_create.c:448
+| #24 0x00007f952e8d318c in __GI___clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
+
+Signed-off-by: Zoltán Böszörményi <[email protected]>
+Upstream-Status: Inappropriate [oe specific]

This seems to be not OE specific, how does it manifest just in OE ?

Quoted 37 lines
meta-oe/recipes-dbs/mysql/mariadb/0001-Remove-x86-specific-loop-in-my_convert.patch new file +34 -1
+---
+ strings/ctype.c | 16 ----------------
+ 1 file changed, 16 deletions(-)
+
+diff --git a/strings/ctype.c b/strings/ctype.c
+index 629514e5e9c..d7e788c693b 100644
+--- a/strings/ctype.c
++++ b/strings/ctype.c
+@@ -1243,22 +1243,6 @@ my_convert(char *to, uint32 to_length, CHARSET_INFO *to_cs,
+
+   length= length2= MY_MIN(to_length, from_length);
+
+-#if defined(__i386__) || defined(__x86_64__)
+-  /*
+-    Special loop for i386, it allows to refer to a
+-    non-aligned memory block as UINT32, which makes
+-    it possible to copy four bytes at once. This
+-    gives about 10% performance improvement comparing
+-    to byte-by-byte loop.
+-  */
+-  for ( ; length >= 4; length-= 4, from+= 4, to+= 4)
+-  {
+-    if ((*(uint32*)from) & 0x80808080)
+-      break;
+-    *((uint32*) to)= *((const uint32*) from);
+-  }
+-#endif /* __i386__ */
+-
+   for (; ; *to++= *from++, length--)
+   {
+     if (!length)
+--
+2.51.0
+
--

2.51.0

#3 lore raw

2025. 10. 01. 18:53 keltezéssel, Khem Raj írta:

Quoted 85 lines · Zoltán Böszörményi
Quoted 84 lines

In some cases (most notably when running mysqldump), the server crashes in the my_convert() function, in a code protected by

   #if defined(__i386__) || defined(__x86_64__)
   ...
   #endif

The crash does not happen with the generic code.
Remove the x86[-64] specific optimization.

---
  meta-oe/recipes-dbs/mysql/mariadb.inc         |  1 +
  ...move-x86-specific-loop-in-my_convert.patch | 89 +++++++++++++++++++
  2 files changed, 90 insertions(+)

create mode 100644 meta-oe/recipes-dbs/mysql/mariadb/0001-Remove-x86-specific-loop-in-my_convert.patch

meta-oe/recipes-dbs/mysql/mariadb.inc +1 -0
index 13e55ebacd..67dd687c02 100644
@@ -24,6 +24,7 @@ SRC_URI = "https://archive.mariadb.org/${BP}/source/${BP}.tar.gz \
             file://0001-Add-missing-includes-cstdint-and-cstdio.patch \
             file://0001-Ensure-compatibility-with-ARMv9-by-updating-.arch-di.patch \
             file://riscv32.patch \
+           file://0001-Remove-x86-specific-loop-in-my_convert.patch \
            "
  SRC_URI[sha256sum] = "1b26c0bb2d025dbfac3b9852d2b7eafda56a171b67ac2e27831ec0414fb7df07"
 
meta-oe/recipes-dbs/mysql/mariadb/0001-Remove-x86-specific-loop-in-my_convert.patch new file +48 -0
new file mode 100644
index 0000000000..26ba08865a
@@ -0,0 +1,89 @@
+From 79d2a95391abc133e86688696ae21628b7035b2d Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Zolt=C3=A1n=20B=C3=B6sz=C3=B6rm=C3=A9nyi?=
+ <[email protected]>
+Date: Wed, 1 Oct 2025 09:29:04 +0200
+Subject: [PATCH] Remove x86 specific loop in my_convert()
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+mysqldump/mariadb-dump crashes with this backtrace:
+
+| (gdb) bt
+| #0  my_convert (to=<optimized out>, to_length=160, to_cs=0x55b5740fbda0 <my_charset_utf8mb4_general_ci>, from=<optimized out>, from_length=40,
+|     from_cs=0x55b57408bda0 <my_charset_utf8mb3_unicode_ci>, errors=0x7f950c35cd6c) at /usr/src/debug/mariadb/11.8.3/strings/ctype.c:1256
+| #1  0x000055b572d9f4a0 in copy_and_convert (to=0x7f94fc00c9db "Configuratiogicate_log\020automagicate_log\017is_done_message\017is_done_message",
+|     to_length=<optimized out>, to_cs=<optimized out>, from=0x7f94fc059f37 "Configuration downloading from portal...", from_length=40, from_cs=<optimized out>,
+|     errors=0x7f950c35cd6c) at /usr/src/debug/mariadb/11.8.3/sql/sql_string.h:53
+| #2  Protocol::net_store_data_cs (this=0x7f94fc001260, from=0x7f94fc059f37 "Configuration downloading from portal...", length=40, from_cs=<optimized out>,
+|     to_cs=<optimized out>) at /usr/src/debug/mariadb/11.8.3/sql/protocol.cc:114
+| #3  0x000055b572da103f in Protocol::send_result_set_row (this=this@entry=0x7f94fc001260, row_items=row_items@entry=0x7f94fc013418)
+|     at /usr/src/debug/mariadb/11.8.3/sql/protocol.cc:1359
+| #4  0x000055b572e19442 in select_send::send_data (this=0x7f94fc014f78, items=...) at /usr/src/debug/mariadb/11.8.3/sql/sql_class.cc:3294
+| #5  0x000055b572ef7c69 in select_result_sink::send_data_with_check (u=<optimized out>, sent=<optimized out>, this=<optimized out>, items=...)
+|     at /usr/src/debug/mariadb/11.8.3/sql/sql_class.h:6264
+| #6  select_result_sink::send_data_with_check (this=<optimized out>, items=..., u=<optimized out>, sent=<optimized out>)
+|     at /usr/src/debug/mariadb/11.8.3/sql/sql_class.h:6254
+| #7  end_send (join=<optimized out>, join_tab=<optimized out>, end_of_records=<optimized out>) at /usr/src/debug/mariadb/11.8.3/sql/sql_select.cc:25629
+| #8  0x000055b572ec38b6 in evaluate_join_record (join=join@entry=0x7f94fc014fa0, join_tab=join_tab@entry=0x7f94fc016940, error=error@entry=0)
+|     at /usr/src/debug/mariadb/11.8.3/sql/sql_select.cc:24523
+| #9  0x000055b572edcbf2 in sub_select (join=0x7f94fc014fa0, join_tab=0x7f94fc016940, end_of_records=<optimized out>)
+|     at /usr/src/debug/mariadb/11.8.3/sql/sql_select.cc:24290
+| #10 0x000055b572f119c6 in do_select (join=0x7f94fc014fa0, procedure=<optimized out>) at /usr/src/debug/mariadb/11.8.3/sql/sql_select.cc:23801
+| #11 JOIN::exec_inner (this=this@entry=0x7f94fc014fa0) at /usr/src/debug/mariadb/11.8.3/sql/sql_select.cc:5071
+| #12 0x000055b572f11d43 in JOIN::exec (this=this@entry=0x7f94fc014fa0) at /usr/src/debug/mariadb/11.8.3/sql/sql_select.cc:4859
+| #13 0x000055b572f0ffe6 in mysql_select (thd=thd@entry=0x7f94fc000cd8, tables=0x7f94fc013f38, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0,
+|     proc_param=0x0, select_options=551922436864, result=0x7f94fc014f78, unit=0x7f94fc005038, select_lex=0x7f94fc013160)
+|     at /usr/src/debug/mariadb/11.8.3/sql/sql_select.cc:5387
+| #14 0x000055b572f107dd in handle_select (thd=thd@entry=0x7f94fc000cd8, lex=lex@entry=0x7f94fc004f58, result=result@entry=0x7f94fc014f78,
+|     setup_tables_done_option=setup_tables_done_option@entry=0) at /usr/src/debug/mariadb/11.8.3/sql/sql_select.cc:633
+| #15 0x000055b572e77d9e in execute_sqlcom_select (thd=thd@entry=0x7f94fc000cd8, all_tables=0x7f94fc013f38) at /usr/src/debug/mariadb/11.8.3/sql/sql_parse.cc:6190
+| #16 0x000055b572e877be in mysql_execute_command (thd=thd@entry=0x7f94fc000cd8, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false)
+|     at /usr/src/debug/mariadb/11.8.3/sql/sql_parse.cc:3975
+| #17 0x000055b572e88e03 in mysql_parse (thd=0x7f94fc000cd8, rawbuf=<optimized out>, length=<optimized out>, parser_state=<optimized out>)
+|     at /usr/src/debug/mariadb/11.8.3/sql/sql_parse.cc:7905
+| #18 0x000055b572e8b2a1 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x7f94fc000cd8, packet=packet@entry=0x7f94fc0088a9 "",
+|     packet_length=packet_length@entry=152, blocking=blocking@entry=true) at /usr/src/debug/mariadb/11.8.3/sql/sql_parse.cc:1903
+| #19 0x000055b572e8cf7c in do_command (thd=thd@entry=0x7f94fc000cd8, blocking=blocking@entry=true) at /usr/src/debug/mariadb/11.8.3/sql/sql_parse.cc:1416
+| #20 0x000055b572fcfc0d in do_handle_one_connection (connect=<optimized out>, put_in_cache=true) at /usr/src/debug/mariadb/11.8.3/sql/sql_connect.cc:1415
Quoted 8 lines

meta-oe/recipes-dbs/mysql/mariadb/0001-Remove-x86-specific-loop-in-my_convert.patch line 55

Quoted 7 lines
meta-oe/recipes-dbs/mysql/mariadb/0001-Remove-x86-specific-loop-in-my_convert.patch new file +7 -0
+| #21 0x000055b572fcffc5 in handle_one_connection (arg=arg@entry=0x55b57943cbd8) at /usr/src/debug/mariadb/11.8.3/sql/sql_connect.cc:1327
+| #22 0x000055b573382440 in pfs_spawn_thread (arg=0x55b5795eb598) at /usr/src/debug/mariadb/11.8.3/storage/perfschema/pfs.cc:2198
+| #23 0x00007f952e8571dd in start_thread (arg=<optimized out>) at pthread_create.c:448
+| #24 0x00007f952e8d318c in __GI___clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
+
+Signed-off-by: Zoltán Böszörményi <[email protected]>
+Upstream-Status: Inappropriate [oe specific]

This seems to be not OE specific, how does it manifest just in OE ?

No idea.

According to the backtrace, it's a crash in the conversion from utf8mb3 to utf8mb4. As such, it may be an unaligned access, likely brought forth by GCC 15. A better fix may be to check the pointer value alignment and only run the optimized code if data pointed by both pointers have 4 byte alignment.

FWIW, we have a special upgrade procedure on several oe builds to carry over crucial data, including the database which may have been created with an old database version using the "utf8" charset, which defaulted to "utf8mb3" in MariaDB a few releases ago. IIRC, that default has changed, or just the recommendation was that "utf8mb4" should be used explicitly.

I am using meta-intel and MACHINE="intel-corei7-64" for a long time.

The crash can be _randomly_ reproduced with oe master and MariaDB 11.4.6, 11.4.8 and 11.8.3 LTS versions but the "special loop for i386" code is also in the 10.11.x and we haven't seen a crash with older Yocto versions. ¯\_(ツ)_/¯

Quoted 37 lines
Quoted 37 lines
meta-oe/recipes-dbs/mysql/mariadb/0001-Remove-x86-specific-loop-in-my_convert.patch new file +34 -1
+---
+ strings/ctype.c | 16 ----------------
+ 1 file changed, 16 deletions(-)
+
+diff --git a/strings/ctype.c b/strings/ctype.c
+index 629514e5e9c..d7e788c693b 100644
+--- a/strings/ctype.c
++++ b/strings/ctype.c
+@@ -1243,22 +1243,6 @@ my_convert(char *to, uint32 to_length, CHARSET_INFO *to_cs,
+
+   length= length2= MY_MIN(to_length, from_length);
+
+-#if defined(__i386__) || defined(__x86_64__)
+-  /*
+-    Special loop for i386, it allows to refer to a
+-    non-aligned memory block as UINT32, which makes
+-    it possible to copy four bytes at once. This
+-    gives about 10% performance improvement comparing
+-    to byte-by-byte loop.
+-  */
+-  for ( ; length >= 4; length-= 4, from+= 4, to+= 4)
+-  {
+-    if ((*(uint32*)from) & 0x80808080)
+-      break;
+-    *((uint32*) to)= *((const uint32*) from);
+-  }
+-#endif /* __i386__ */
+-
+   for (; ; *to++= *from++, length--)
+   {
+     if (!length)
+--
+2.51.0
+
--

2.51.0

#4 lore raw
Quoted 111 lines · Böszörményi Zoltán

2025. 10. 01. 18:53 keltezéssel, Khem Raj írta:

Quoted 85 lines · Zoltán Böszörményi
Quoted 84 lines

In some cases (most notably when running mysqldump), the server crashes in the my_convert() function, in a code protected by

   #if defined(__i386__) || defined(__x86_64__)
   ...
   #endif

The crash does not happen with the generic code.
Remove the x86[-64] specific optimization.

---
  meta-oe/recipes-dbs/mysql/mariadb.inc         |  1 +
  ...move-x86-specific-loop-in-my_convert.patch | 89 +++++++++++++++++++
  2 files changed, 90 insertions(+)

create mode 100644 meta-oe/recipes-dbs/mysql/mariadb/0001-Remove-x86-specific-loop-in-my_convert.patch

meta-oe/recipes-dbs/mysql/mariadb.inc +1 -0
index 13e55ebacd..67dd687c02 100644
@@ -24,6 +24,7 @@ SRC_URI = "https://archive.mariadb.org/${BP}/source/${BP}.tar.gz \
             file://0001-Add-missing-includes-cstdint-and-cstdio.patch \
             file://0001-Ensure-compatibility-with-ARMv9-by-updating-.arch-di.patch \
             file://riscv32.patch \
+           file://0001-Remove-x86-specific-loop-in-my_convert.patch \
            "
  SRC_URI[sha256sum] = "1b26c0bb2d025dbfac3b9852d2b7eafda56a171b67ac2e27831ec0414fb7df07"
 
meta-oe/recipes-dbs/mysql/mariadb/0001-Remove-x86-specific-loop-in-my_convert.patch new file +48 -0
new file mode 100644
index 0000000000..26ba08865a
@@ -0,0 +1,89 @@
+From 79d2a95391abc133e86688696ae21628b7035b2d Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Zolt=C3=A1n=20B=C3=B6sz=C3=B6rm=C3=A9nyi?=
+ <[email protected]>
+Date: Wed, 1 Oct 2025 09:29:04 +0200
+Subject: [PATCH] Remove x86 specific loop in my_convert()
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+mysqldump/mariadb-dump crashes with this backtrace:
+
+| (gdb) bt
+| #0  my_convert (to=<optimized out>, to_length=160, to_cs=0x55b5740fbda0 <my_charset_utf8mb4_general_ci>, from=<optimized out>, from_length=40,
+|     from_cs=0x55b57408bda0 <my_charset_utf8mb3_unicode_ci>, errors=0x7f950c35cd6c) at /usr/src/debug/mariadb/11.8.3/strings/ctype.c:1256
+| #1  0x000055b572d9f4a0 in copy_and_convert (to=0x7f94fc00c9db "Configuratiogicate_log\020automagicate_log\017is_done_message\017is_done_message",
+|     to_length=<optimized out>, to_cs=<optimized out>, from=0x7f94fc059f37 "Configuration downloading from portal...", from_length=40, from_cs=<optimized out>,
+|     errors=0x7f950c35cd6c) at /usr/src/debug/mariadb/11.8.3/sql/sql_string.h:53
+| #2  Protocol::net_store_data_cs (this=0x7f94fc001260, from=0x7f94fc059f37 "Configuration downloading from portal...", length=40, from_cs=<optimized out>,
+|     to_cs=<optimized out>) at /usr/src/debug/mariadb/11.8.3/sql/protocol.cc:114
+| #3  0x000055b572da103f in Protocol::send_result_set_row (this=this@entry=0x7f94fc001260, row_items=row_items@entry=0x7f94fc013418)
+|     at /usr/src/debug/mariadb/11.8.3/sql/protocol.cc:1359
+| #4  0x000055b572e19442 in select_send::send_data (this=0x7f94fc014f78, items=...) at /usr/src/debug/mariadb/11.8.3/sql/sql_class.cc:3294
+| #5  0x000055b572ef7c69 in select_result_sink::send_data_with_check (u=<optimized out>, sent=<optimized out>, this=<optimized out>, items=...)
+|     at /usr/src/debug/mariadb/11.8.3/sql/sql_class.h:6264
+| #6  select_result_sink::send_data_with_check (this=<optimized out>, items=..., u=<optimized out>, sent=<optimized out>)
+|     at /usr/src/debug/mariadb/11.8.3/sql/sql_class.h:6254
+| #7  end_send (join=<optimized out>, join_tab=<optimized out>, end_of_records=<optimized out>) at /usr/src/debug/mariadb/11.8.3/sql/sql_select.cc:25629
+| #8  0x000055b572ec38b6 in evaluate_join_record (join=join@entry=0x7f94fc014fa0, join_tab=join_tab@entry=0x7f94fc016940, error=error@entry=0)
+|     at /usr/src/debug/mariadb/11.8.3/sql/sql_select.cc:24523
+| #9  0x000055b572edcbf2 in sub_select (join=0x7f94fc014fa0, join_tab=0x7f94fc016940, end_of_records=<optimized out>)
+|     at /usr/src/debug/mariadb/11.8.3/sql/sql_select.cc:24290
+| #10 0x000055b572f119c6 in do_select (join=0x7f94fc014fa0, procedure=<optimized out>) at /usr/src/debug/mariadb/11.8.3/sql/sql_select.cc:23801
+| #11 JOIN::exec_inner (this=this@entry=0x7f94fc014fa0) at /usr/src/debug/mariadb/11.8.3/sql/sql_select.cc:5071
+| #12 0x000055b572f11d43 in JOIN::exec (this=this@entry=0x7f94fc014fa0) at /usr/src/debug/mariadb/11.8.3/sql/sql_select.cc:4859
+| #13 0x000055b572f0ffe6 in mysql_select (thd=thd@entry=0x7f94fc000cd8, tables=0x7f94fc013f38, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0,
+|     proc_param=0x0, select_options=551922436864, result=0x7f94fc014f78, unit=0x7f94fc005038, select_lex=0x7f94fc013160)
+|     at /usr/src/debug/mariadb/11.8.3/sql/sql_select.cc:5387
+| #14 0x000055b572f107dd in handle_select (thd=thd@entry=0x7f94fc000cd8, lex=lex@entry=0x7f94fc004f58, result=result@entry=0x7f94fc014f78,
+|     setup_tables_done_option=setup_tables_done_option@entry=0) at /usr/src/debug/mariadb/11.8.3/sql/sql_select.cc:633
+| #15 0x000055b572e77d9e in execute_sqlcom_select (thd=thd@entry=0x7f94fc000cd8, all_tables=0x7f94fc013f38) at /usr/src/debug/mariadb/11.8.3/sql/sql_parse.cc:6190
+| #16 0x000055b572e877be in mysql_execute_command (thd=thd@entry=0x7f94fc000cd8, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false)
+|     at /usr/src/debug/mariadb/11.8.3/sql/sql_parse.cc:3975
+| #17 0x000055b572e88e03 in mysql_parse (thd=0x7f94fc000cd8, rawbuf=<optimized out>, length=<optimized out>, parser_state=<optimized out>)
+|     at /usr/src/debug/mariadb/11.8.3/sql/sql_parse.cc:7905
+| #18 0x000055b572e8b2a1 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x7f94fc000cd8, packet=packet@entry=0x7f94fc0088a9 "",
+|     packet_length=packet_length@entry=152, blocking=blocking@entry=true) at /usr/src/debug/mariadb/11.8.3/sql/sql_parse.cc:1903
+| #19 0x000055b572e8cf7c in do_command (thd=thd@entry=0x7f94fc000cd8, blocking=blocking@entry=true) at /usr/src/debug/mariadb/11.8.3/sql/sql_parse.cc:1416
+| #20 0x000055b572fcfc0d in do_handle_one_connection (connect=<optimized out>, put_in_cache=true) at /usr/src/debug/mariadb/11.8.3/sql/sql_connect.cc:1415
Quoted 8 lines

meta-oe/recipes-dbs/mysql/mariadb/0001-Remove-x86-specific-loop-in-my_convert.patch line 55

Quoted 7 lines
meta-oe/recipes-dbs/mysql/mariadb/0001-Remove-x86-specific-loop-in-my_convert.patch new file +7 -0
+| #21 0x000055b572fcffc5 in handle_one_connection (arg=arg@entry=0x55b57943cbd8) at /usr/src/debug/mariadb/11.8.3/sql/sql_connect.cc:1327
+| #22 0x000055b573382440 in pfs_spawn_thread (arg=0x55b5795eb598) at /usr/src/debug/mariadb/11.8.3/storage/perfschema/pfs.cc:2198
+| #23 0x00007f952e8571dd in start_thread (arg=<optimized out>) at pthread_create.c:448
+| #24 0x00007f952e8d318c in __GI___clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
+
+Signed-off-by: Zoltán Böszörményi <[email protected]>
+Upstream-Status: Inappropriate [oe specific]

This seems to be not OE specific, how does it manifest just in OE ?

No idea.

According to the backtrace, it's a crash in the conversion from utf8mb3 to utf8mb4. As such, it may be an unaligned access, likely brought forth by GCC 15. A better fix may be to check the pointer value alignment and only run the optimized code if data pointed by both pointers have 4 byte alignment.

FWIW, we have a special upgrade procedure on several oe builds to carry over crucial data, including the database which may have been created with an old database version using the "utf8" charset, which defaulted to "utf8mb3" in MariaDB a few releases ago. IIRC, that default has changed, or just the recommendation was that "utf8mb4" should be used explicitly.

Quoted 6 lines

I am using meta-intel and MACHINE="intel-corei7-64" for a long time.

The crash can be _randomly_ reproduced with oe master and MariaDB 11.4.6, 11.4.8 and 11.8.3 LTS versions but the "special loop for i386" code is also in the 10.11.x and we haven't seen a crash with older Yocto versions. ¯\_(ツ)_/¯

Well, it will result in performance regression in character conversion routines for x86. while it is making things work this definitely should be informed upstream

On OE side, can you check if DEFAULTTUNE has changed between working and non-working builds ?

Quoted 38 lines
Quoted 37 lines
Quoted 37 lines
meta-oe/recipes-dbs/mysql/mariadb/0001-Remove-x86-specific-loop-in-my_convert.patch new file +34 -1
+---
+ strings/ctype.c | 16 ----------------
+ 1 file changed, 16 deletions(-)
+
+diff --git a/strings/ctype.c b/strings/ctype.c
+index 629514e5e9c..d7e788c693b 100644
+--- a/strings/ctype.c
++++ b/strings/ctype.c
+@@ -1243,22 +1243,6 @@ my_convert(char *to, uint32 to_length, CHARSET_INFO *to_cs,
+
+   length= length2= MY_MIN(to_length, from_length);
+
+-#if defined(__i386__) || defined(__x86_64__)
+-  /*
+-    Special loop for i386, it allows to refer to a
+-    non-aligned memory block as UINT32, which makes
+-    it possible to copy four bytes at once. This
+-    gives about 10% performance improvement comparing
+-    to byte-by-byte loop.
+-  */
+-  for ( ; length >= 4; length-= 4, from+= 4, to+= 4)
+-  {
+-    if ((*(uint32*)from) & 0x80808080)
+-      break;
+-    *((uint32*) to)= *((const uint32*) from);
+-  }
+-#endif /* __i386__ */
+-
+   for (; ; *to++= *from++, length--)
+   {
+     if (!length)
+--
+2.51.0
+
--

2.51.0

#5 lore raw

2025. 10. 02. 6:28 keltezéssel, Khem Raj írta:

Quoted 112 lines · Böszörményi Zoltán
Quoted 111 lines

2025. 10. 01. 18:53 keltezéssel, Khem Raj írta:

Quoted 85 lines · Zoltán Böszörményi
Quoted 84 lines

In some cases (most notably when running mysqldump), the server crashes in the my_convert() function, in a code protected by

    #if defined(__i386__) || defined(__x86_64__)
    ...
    #endif

The crash does not happen with the generic code.
Remove the x86[-64] specific optimization.

---
   meta-oe/recipes-dbs/mysql/mariadb.inc         |  1 +
   ...move-x86-specific-loop-in-my_convert.patch | 89 +++++++++++++++++++
   2 files changed, 90 insertions(+)

create mode 100644 meta-oe/recipes-dbs/mysql/mariadb/0001-Remove-x86-specific-loop-in-my_convert.patch

meta-oe/recipes-dbs/mysql/mariadb.inc +1 -0
index 13e55ebacd..67dd687c02 100644
@@ -24,6 +24,7 @@ SRC_URI = "https://archive.mariadb.org/${BP}/source/${BP}.tar.gz \
              file://0001-Add-missing-includes-cstdint-and-cstdio.patch \
              file://0001-Ensure-compatibility-with-ARMv9-by-updating-.arch-di.patch \
              file://riscv32.patch \
+           file://0001-Remove-x86-specific-loop-in-my_convert.patch \
             "
   SRC_URI[sha256sum] = "1b26c0bb2d025dbfac3b9852d2b7eafda56a171b67ac2e27831ec0414fb7df07"
 
meta-oe/recipes-dbs/mysql/mariadb/0001-Remove-x86-specific-loop-in-my_convert.patch new file +48 -0
new file mode 100644
index 0000000000..26ba08865a
@@ -0,0 +1,89 @@
+From 79d2a95391abc133e86688696ae21628b7035b2d Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Zolt=C3=A1n=20B=C3=B6sz=C3=B6rm=C3=A9nyi?=
+ <[email protected]>
+Date: Wed, 1 Oct 2025 09:29:04 +0200
+Subject: [PATCH] Remove x86 specific loop in my_convert()
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+mysqldump/mariadb-dump crashes with this backtrace:
+
+| (gdb) bt
+| #0  my_convert (to=<optimized out>, to_length=160, to_cs=0x55b5740fbda0 <my_charset_utf8mb4_general_ci>, from=<optimized out>, from_length=40,
+|     from_cs=0x55b57408bda0 <my_charset_utf8mb3_unicode_ci>, errors=0x7f950c35cd6c) at /usr/src/debug/mariadb/11.8.3/strings/ctype.c:1256
+| #1  0x000055b572d9f4a0 in copy_and_convert (to=0x7f94fc00c9db "Configuratiogicate_log\020automagicate_log\017is_done_message\017is_done_message",
+|     to_length=<optimized out>, to_cs=<optimized out>, from=0x7f94fc059f37 "Configuration downloading from portal...", from_length=40, from_cs=<optimized out>,
+|     errors=0x7f950c35cd6c) at /usr/src/debug/mariadb/11.8.3/sql/sql_string.h:53
+| #2  Protocol::net_store_data_cs (this=0x7f94fc001260, from=0x7f94fc059f37 "Configuration downloading from portal...", length=40, from_cs=<optimized out>,
+|     to_cs=<optimized out>) at /usr/src/debug/mariadb/11.8.3/sql/protocol.cc:114
+| #3  0x000055b572da103f in Protocol::send_result_set_row (this=this@entry=0x7f94fc001260, row_items=row_items@entry=0x7f94fc013418)
+|     at /usr/src/debug/mariadb/11.8.3/sql/protocol.cc:1359
+| #4  0x000055b572e19442 in select_send::send_data (this=0x7f94fc014f78, items=...) at /usr/src/debug/mariadb/11.8.3/sql/sql_class.cc:3294
+| #5  0x000055b572ef7c69 in select_result_sink::send_data_with_check (u=<optimized out>, sent=<optimized out>, this=<optimized out>, items=...)
+|     at /usr/src/debug/mariadb/11.8.3/sql/sql_class.h:6264
+| #6  select_result_sink::send_data_with_check (this=<optimized out>, items=..., u=<optimized out>, sent=<optimized out>)
+|     at /usr/src/debug/mariadb/11.8.3/sql/sql_class.h:6254
+| #7  end_send (join=<optimized out>, join_tab=<optimized out>, end_of_records=<optimized out>) at /usr/src/debug/mariadb/11.8.3/sql/sql_select.cc:25629
+| #8  0x000055b572ec38b6 in evaluate_join_record (join=join@entry=0x7f94fc014fa0, join_tab=join_tab@entry=0x7f94fc016940, error=error@entry=0)
+|     at /usr/src/debug/mariadb/11.8.3/sql/sql_select.cc:24523
+| #9  0x000055b572edcbf2 in sub_select (join=0x7f94fc014fa0, join_tab=0x7f94fc016940, end_of_records=<optimized out>)
+|     at /usr/src/debug/mariadb/11.8.3/sql/sql_select.cc:24290
+| #10 0x000055b572f119c6 in do_select (join=0x7f94fc014fa0, procedure=<optimized out>) at /usr/src/debug/mariadb/11.8.3/sql/sql_select.cc:23801
+| #11 JOIN::exec_inner (this=this@entry=0x7f94fc014fa0) at /usr/src/debug/mariadb/11.8.3/sql/sql_select.cc:5071
+| #12 0x000055b572f11d43 in JOIN::exec (this=this@entry=0x7f94fc014fa0) at /usr/src/debug/mariadb/11.8.3/sql/sql_select.cc:4859
+| #13 0x000055b572f0ffe6 in mysql_select (thd=thd@entry=0x7f94fc000cd8, tables=0x7f94fc013f38, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0,
+|     proc_param=0x0, select_options=551922436864, result=0x7f94fc014f78, unit=0x7f94fc005038, select_lex=0x7f94fc013160)
+|     at /usr/src/debug/mariadb/11.8.3/sql/sql_select.cc:5387
+| #14 0x000055b572f107dd in handle_select (thd=thd@entry=0x7f94fc000cd8, lex=lex@entry=0x7f94fc004f58, result=result@entry=0x7f94fc014f78,
+|     setup_tables_done_option=setup_tables_done_option@entry=0) at /usr/src/debug/mariadb/11.8.3/sql/sql_select.cc:633
+| #15 0x000055b572e77d9e in execute_sqlcom_select (thd=thd@entry=0x7f94fc000cd8, all_tables=0x7f94fc013f38) at /usr/src/debug/mariadb/11.8.3/sql/sql_parse.cc:6190
+| #16 0x000055b572e877be in mysql_execute_command (thd=thd@entry=0x7f94fc000cd8, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false)
+|     at /usr/src/debug/mariadb/11.8.3/sql/sql_parse.cc:3975
+| #17 0x000055b572e88e03 in mysql_parse (thd=0x7f94fc000cd8, rawbuf=<optimized out>, length=<optimized out>, parser_state=<optimized out>)
+|     at /usr/src/debug/mariadb/11.8.3/sql/sql_parse.cc:7905
+| #18 0x000055b572e8b2a1 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x7f94fc000cd8, packet=packet@entry=0x7f94fc0088a9 "",
+|     packet_length=packet_length@entry=152, blocking=blocking@entry=true) at /usr/src/debug/mariadb/11.8.3/sql/sql_parse.cc:1903
+| #19 0x000055b572e8cf7c in do_command (thd=thd@entry=0x7f94fc000cd8, blocking=blocking@entry=true) at /usr/src/debug/mariadb/11.8.3/sql/sql_parse.cc:1416
+| #20 0x000055b572fcfc0d in do_handle_one_connection (connect=<optimized out>, put_in_cache=true) at /usr/src/debug/mariadb/11.8.3/sql/sql_connect.cc:1415
Quoted 8 lines

meta-oe/recipes-dbs/mysql/mariadb/0001-Remove-x86-specific-loop-in-my_convert.patch line 55

Quoted 7 lines
meta-oe/recipes-dbs/mysql/mariadb/0001-Remove-x86-specific-loop-in-my_convert.patch new file +7 -0
+| #21 0x000055b572fcffc5 in handle_one_connection (arg=arg@entry=0x55b57943cbd8) at /usr/src/debug/mariadb/11.8.3/sql/sql_connect.cc:1327
+| #22 0x000055b573382440 in pfs_spawn_thread (arg=0x55b5795eb598) at /usr/src/debug/mariadb/11.8.3/storage/perfschema/pfs.cc:2198
+| #23 0x00007f952e8571dd in start_thread (arg=<optimized out>) at pthread_create.c:448
+| #24 0x00007f952e8d318c in __GI___clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
+
+Signed-off-by: Zoltán Böszörményi <[email protected]>
+Upstream-Status: Inappropriate [oe specific]

This seems to be not OE specific, how does it manifest just in OE ?

No idea.

According to the backtrace, it's a crash in the conversion from utf8mb3 to utf8mb4. As such, it may be an unaligned access, likely brought forth by GCC 15. A better fix may be to check the pointer value alignment and only run the optimized code if data pointed by both pointers have 4 byte alignment.

FWIW, we have a special upgrade procedure on several oe builds to carry over crucial data, including the database which may have been created with an old database version using the "utf8" charset, which defaulted to "utf8mb3" in MariaDB a few releases ago. IIRC, that default has changed, or just the recommendation was that "utf8mb4" should be used explicitly.

I am using meta-intel and MACHINE="intel-corei7-64" for a long time.

Quoted 7 lines
Quoted 4 lines

The crash can be _randomly_ reproduced with oe master and MariaDB 11.4.6, 11.4.8 and 11.8.3 LTS versions but the "special loop for i386" code is also in the 10.11.x and we haven't seen a crash with older Yocto versions. ¯\_(ツ)_/¯

Well, it will result in performance regression in character conversion routines for x86. while it is making things work this definitely should be informed upstream

https://jira.mariadb.org/browse/MDEV-37786

Quoted 2 lines

On OE side, can you check if DEFAULTTUNE has changed between working and non-working builds ?

I will check that.

Quoted 37 lines
Quoted 37 lines
Quoted 37 lines
Quoted 37 lines
meta-oe/recipes-dbs/mysql/mariadb/0001-Remove-x86-specific-loop-in-my_convert.patch new file +34 -1
+---
+ strings/ctype.c | 16 ----------------
+ 1 file changed, 16 deletions(-)
+
+diff --git a/strings/ctype.c b/strings/ctype.c
+index 629514e5e9c..d7e788c693b 100644
+--- a/strings/ctype.c
++++ b/strings/ctype.c
+@@ -1243,22 +1243,6 @@ my_convert(char *to, uint32 to_length, CHARSET_INFO *to_cs,
+
+   length= length2= MY_MIN(to_length, from_length);
+
+-#if defined(__i386__) || defined(__x86_64__)
+-  /*
+-    Special loop for i386, it allows to refer to a
+-    non-aligned memory block as UINT32, which makes
+-    it possible to copy four bytes at once. This
+-    gives about 10% performance improvement comparing
+-    to byte-by-byte loop.
+-  */
+-  for ( ; length >= 4; length-= 4, from+= 4, to+= 4)
+-  {
+-    if ((*(uint32*)from) & 0x80808080)
+-      break;
+-    *((uint32*) to)= *((const uint32*) from);
+-  }
+-#endif /* __i386__ */
+-
+   for (; ; *to++= *from++, length--)
+   {
+     if (!length)
+--
+2.51.0
+
--

2.51.0

A message that is not in the archive (sent off-list or not yet received): [email protected]

#7 lore raw

2025. 10. 02. 6:59 keltezéssel, Zoltan Boszormenyi via lists.openembedded.org írta:

Quoted 151 lines

2025. 10. 02. 6:28 keltezéssel, Khem Raj írta:

Quoted 142 lines · Böszörményi Zoltán
Quoted 141 lines

2025. 10. 01. 18:53 keltezéssel, Khem Raj írta:

Quoted 115 lines · Zoltán Böszörményi
Quoted 114 lines

In some cases (most notably when running mysqldump), the server crashes in the my_convert() function, in a code protected by

    #if defined(__i386__) || defined(__x86_64__)
    ...
    #endif

The crash does not happen with the generic code.
Remove the x86[-64] specific optimization.

---
   meta-oe/recipes-dbs/mysql/mariadb.inc         |  1 + ...move-x86-specific-loop-in-my_convert.patch | 89 +++++++++++++++++++

   2 files changed, 90 insertions(+)

   create mode 100644 meta-oe/recipes-dbs/mysql/mariadb/0001-Remove-x86-specific-loop-in-my_convert.patch

meta-oe/recipes-dbs/mysql/mariadb.inc +1 -0
index 13e55ebacd..67dd687c02 100644
@@ -24,6 +24,7 @@ SRC_URI = "https://archive.mariadb.org/${BP}/source/${BP}.tar.gz \
 file://0001-Add-missing-includes-cstdint-and-cstdio.patch \
 file://0001-Ensure-compatibility-with-ARMv9-by-updating-.arch-di.patch \
               file://riscv32.patch \
+ file://0001-Remove-x86-specific-loop-in-my_convert.patch \

             "
   SRC_URI[sha256sum] = "1b26c0bb2d025dbfac3b9852d2b7eafda56a171b67ac2e27831ec0414fb7df07"

(quoted diff) +0 -0
new file mode 100644
index 0000000000..26ba08865a

b/meta-oe/recipes-dbs/mysql/mariadb/0001-Remove-x86-specific-loop-in-my_convert.patch

meta-oe/recipes-dbs/mysql/mariadb/0001-Remove-x86-specific-loop-in-my_convert.patch new file +13 -0
@@ -0,0 +1,89 @@
+From 79d2a95391abc133e86688696ae21628b7035b2d Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Zolt=C3=A1n=20B=C3=B6sz=C3=B6rm=C3=A9nyi?=
+ <[email protected]>
+Date: Wed, 1 Oct 2025 09:29:04 +0200
+Subject: [PATCH] Remove x86 specific loop in my_convert()
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+mysqldump/mariadb-dump crashes with this backtrace:
+
+| (gdb) bt
+| #0  my_convert (to=<optimized out>, to_length=160, to_cs=0x55b5740fbda0 

<my_charset_utf8mb4_general_ci>, from=<optimized out>, from_length=40,
+|     from_cs=0x55b57408bda0 <my_charset_utf8mb3_unicode_ci>, errors=0x7f950c35cd6c) at /usr/src/debug/mariadb/11.8.3/strings/ctype.c:1256 +| #1  0x000055b572d9f4a0 in copy_and_convert (to=0x7f94fc00c9db "Configuratiogicate_log\020automagicate_log\017is_done_message\017is_done_message", +|     to_length=<optimized out>, to_cs=<optimized out>, from=0x7f94fc059f37 "Configuration downloading from portal...", from_length=40, from_cs=<optimized out>, +|     errors=0x7f950c35cd6c) at /usr/src/debug/mariadb/11.8.3/sql/sql_string.h:53 +| #2  Protocol::net_store_data_cs (this=0x7f94fc001260, from=0x7f94fc059f37 "Configuration downloading from portal...", length=40, from_cs=<optimized out>, +|     to_cs=<optimized out>) at /usr/src/debug/mariadb/11.8.3/sql/protocol.cc:114 +| #3  0x000055b572da103f in Protocol::send_result_set_row (this=this@entry=0x7f94fc001260, row_items=row_items@entry=0x7f94fc013418) +|     at /usr/src/debug/mariadb/11.8.3/sql/protocol.cc:1359
+| #4  0x000055b572e19442 in select_send::send_data (this=0x7f94fc014f78, items=...) at /usr/src/debug/mariadb/11.8.3/sql/sql_class.cc:3294
+| #5  0x000055b572ef7c69 in select_result_sink::send_data_with_check (u=<optimized out>, sent=<optimized out>, this=<optimized out>, items=...)
+|     at /usr/src/debug/mariadb/11.8.3/sql/sql_class.h:6264
+| #6  select_result_sink::send_data_with_check (this=<optimized out>, items=..., u=<optimized out>, sent=<optimized out>)
+|     at /usr/src/debug/mariadb/11.8.3/sql/sql_class.h:6254
+| #7  end_send (join=<optimized out>, join_tab=<optimized out>, end_of_records=<optimized out>) at /usr/src/debug/mariadb/11.8.3/sql/sql_select.cc:25629 +| #8  0x000055b572ec38b6 in evaluate_join_record (join=join@entry=0x7f94fc014fa0, join_tab=join_tab@entry=0x7f94fc016940, error=error@entry=0)
+|     at /usr/src/debug/mariadb/11.8.3/sql/sql_select.cc:24523
+| #9  0x000055b572edcbf2 in sub_select (join=0x7f94fc014fa0, join_tab=0x7f94fc016940, end_of_records=<optimized out>)
+|     at /usr/src/debug/mariadb/11.8.3/sql/sql_select.cc:24290
+| #10 0x000055b572f119c6 in do_select (join=0x7f94fc014fa0, procedure=<optimized out>) at /usr/src/debug/mariadb/11.8.3/sql/sql_select.cc:23801
+| #11 JOIN::exec_inner (this=this@entry=0x7f94fc014fa0) at /usr/src/debug/mariadb/11.8.3/sql/sql_select.cc:5071
+| #12 0x000055b572f11d43 in JOIN::exec (this=this@entry=0x7f94fc014fa0) at /usr/src/debug/mariadb/11.8.3/sql/sql_select.cc:4859
+| #13 0x000055b572f0ffe6 in mysql_select (thd=thd@entry=0x7f94fc000cd8, tables=0x7f94fc013f38, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, +|     proc_param=0x0, select_options=551922436864, result=0x7f94fc014f78, unit=0x7f94fc005038, select_lex=0x7f94fc013160)
+|     at /usr/src/debug/mariadb/11.8.3/sql/sql_select.cc:5387
+| #14 0x000055b572f107dd in handle_select (thd=thd@entry=0x7f94fc000cd8, lex=lex@entry=0x7f94fc004f58, result=result@entry=0x7f94fc014f78,
+| setup_tables_done_option=setup_tables_done_option@entry=0) at /usr/src/debug/mariadb/11.8.3/sql/sql_select.cc:633
+| #15 0x000055b572e77d9e in execute_sqlcom_select (thd=thd@entry=0x7f94fc000cd8, all_tables=0x7f94fc013f38) at /usr/src/debug/mariadb/11.8.3/sql/sql_parse.cc:6190 +| #16 0x000055b572e877be in mysql_execute_command (thd=thd@entry=0x7f94fc000cd8, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false)
+|     at /usr/src/debug/mariadb/11.8.3/sql/sql_parse.cc:3975
+| #17 0x000055b572e88e03 in mysql_parse (thd=0x7f94fc000cd8, rawbuf=<optimized out>, length=<optimized out>, parser_state=<optimized out>)
+|     at /usr/src/debug/mariadb/11.8.3/sql/sql_parse.cc:7905
+| #18 0x000055b572e8b2a1 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x7f94fc000cd8, packet=packet@entry=0x7f94fc0088a9 "",
+|     packet_length=packet_length@entry=152, blocking=blocking@entry=true) at /usr/src/debug/mariadb/11.8.3/sql/sql_parse.cc:1903
+| #19 0x000055b572e8cf7c in do_command (thd=thd@entry=0x7f94fc000cd8, blocking=blocking@entry=true) at /usr/src/debug/mariadb/11.8.3/sql/sql_parse.cc:1416 +| #20 0x000055b572fcfc0d in do_handle_one_connection (connect=<optimized out>, put_in_cache=true) at /usr/src/debug/mariadb/11.8.3/sql/sql_connect.cc:1415 +| #21 0x000055b572fcffc5 in handle_one_connection (arg=arg@entry=0x55b57943cbd8) at /usr/src/debug/mariadb/11.8.3/sql/sql_connect.cc:1327
+| #22 0x000055b573382440 in pfs_spawn_thread (arg=0x55b5795eb598) at

Quoted 8 lines

meta-oe/recipes-dbs/mysql/mariadb/0001-Remove-x86-specific-loop-in-my_convert.patch line 55

Quoted 7 lines

/usr/src/debug/mariadb/11.8.3/storage/perfschema/pfs.cc:2198
+| #23 0x00007f952e8571dd in start_thread (arg=<optimized out>) at pthread_create.c:448 +| #24 0x00007f952e8d318c in __GI___clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78

meta-oe/recipes-dbs/mysql/mariadb/0001-Remove-x86-specific-loop-in-my_convert.patch new file +3 -0
+
+Signed-off-by: Zoltán Böszörményi <[email protected]>
+Upstream-Status: Inappropriate [oe specific]

This seems to be not OE specific, how does it manifest just in OE ?

No idea.

According to the backtrace, it's a crash in the conversion from utf8mb3 to utf8mb4. As such, it may be an unaligned access, likely brought forth by GCC 15. A better fix may be to check the pointer value alignment and only run the optimized code if data pointed by both pointers have 4 byte alignment.

FWIW, we have a special upgrade procedure on several oe builds to carry over crucial data, including the database which may have been created with an old database version using the "utf8" charset, which defaulted to "utf8mb3" in MariaDB a few releases ago. IIRC, that default has changed, or just the recommendation was that "utf8mb4" should be used explicitly.

I am using meta-intel and MACHINE="intel-corei7-64" for a long time.

Quoted 7 lines
Quoted 4 lines

The crash can be _randomly_ reproduced with oe master and MariaDB 11.4.6, 11.4.8 and 11.8.3 LTS versions but the "special loop for i386" code is also in the 10.11.x and we haven't seen a crash with older Yocto versions. ¯\_(ツ)_/¯

Well, it will result in performance regression in character conversion routines for x86. while it is making things work this definitely should be informed upstream

Quoted 6 lines

https://jira.mariadb.org/browse/MDEV-37786

Quoted 2 lines

On OE side, can you check if DEFAULTTUNE has changed between working and non-working builds ?

I will check that.

DEFAULTTUNE="corei7-64" in all cases.

Quoted 47 lines
Quoted 29 lines
Quoted 29 lines
Quoted 29 lines
Quoted 29 lines
+---
+ strings/ctype.c | 16 ----------------

+ 1 file changed, 16 deletions(-)

meta-oe/recipes-dbs/mysql/mariadb/0001-Remove-x86-specific-loop-in-my_convert.patch new file +26 -0
+
+diff --git a/strings/ctype.c b/strings/ctype.c
+index 629514e5e9c..d7e788c693b 100644
+--- a/strings/ctype.c
++++ b/strings/ctype.c
+@@ -1243,22 +1243,6 @@ my_convert(char *to, uint32 to_length, CHARSET_INFO *to_cs,
+
+   length= length2= MY_MIN(to_length, from_length);
+
+-#if defined(__i386__) || defined(__x86_64__)
+-  /*
+-    Special loop for i386, it allows to refer to a
+-    non-aligned memory block as UINT32, which makes
+-    it possible to copy four bytes at once. This
+-    gives about 10% performance improvement comparing
+-    to byte-by-byte loop.
+-  */
+-  for ( ; length >= 4; length-= 4, from+= 4, to+= 4)
+-  {
+-    if ((*(uint32*)from) & 0x80808080)
+-      break;
+-    *((uint32*) to)= *((const uint32*) from);
+-  }
+-#endif /* __i386__ */
+-
+   for (; ; *to++= *from++, length--)
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

+   {
+     if (!length)
+--
+2.51.0
+

Signature · 1 line
2.51.0

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#120157): https://lists.openembedded.org/g/openembedded-devel/message/120157
Mute This Topic: https://lists.openembedded.org/mt/115529034/3617728
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

A message that is not in the archive (sent off-list or not yet received): [email protected]

#9 lore raw

2025. 10. 02. 7:37 keltezéssel, Zoltan Boszormenyi via lists.openembedded.org írta:

Quoted 153 lines

2025. 10. 02. 6:59 keltezéssel, Zoltan Boszormenyi via lists.openembedded.org írta:

Quoted 152 lines

2025. 10. 02. 6:28 keltezéssel, Khem Raj írta:

Quoted 150 lines · Böszörményi Zoltán
Quoted 140 lines

2025. 10. 01. 18:53 keltezéssel, Khem Raj írta:

Quoted 116 lines · Zoltán Böszörményi
Quoted 115 lines

In some cases (most notably when running mysqldump), the server crashes in the my_convert() function, in a code protected by

    #if defined(__i386__) || defined(__x86_64__)
    ...
    #endif

The crash does not happen with the generic code.
Remove the x86[-64] specific optimization.

---
   meta-oe/recipes-dbs/mysql/mariadb.inc         |  1 + ...move-x86-specific-loop-in-my_convert.patch | 89 +++++++++++++++++++

   2 files changed, 90 insertions(+)

   create mode 100644 meta-oe/recipes-dbs/mysql/mariadb/0001-Remove-x86-specific-loop-in-my_convert.patch

meta-oe/recipes-dbs/mysql/mariadb.inc +1 -0
index 13e55ebacd..67dd687c02 100644
@@ -24,6 +24,7 @@ SRC_URI = "https://archive.mariadb.org/${BP}/source/${BP}.tar.gz \
 file://0001-Add-missing-includes-cstdint-and-cstdio.patch \
 file://0001-Ensure-compatibility-with-ARMv9-by-updating-.arch-di.patch \
               file://riscv32.patch \
+ file://0001-Remove-x86-specific-loop-in-my_convert.patch \

             "
   SRC_URI[sha256sum] = "1b26c0bb2d025dbfac3b9852d2b7eafda56a171b67ac2e27831ec0414fb7df07"

(quoted diff) +0 -0
new file mode 100644
index 0000000000..26ba08865a

b/meta-oe/recipes-dbs/mysql/mariadb/0001-Remove-x86-specific-loop-in-my_convert.patch

meta-oe/recipes-dbs/mysql/mariadb/0001-Remove-x86-specific-loop-in-my_convert.patch new file +13 -0
@@ -0,0 +1,89 @@
+From 79d2a95391abc133e86688696ae21628b7035b2d Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Zolt=C3=A1n=20B=C3=B6sz=C3=B6rm=C3=A9nyi?=
+ <[email protected]>
+Date: Wed, 1 Oct 2025 09:29:04 +0200
+Subject: [PATCH] Remove x86 specific loop in my_convert()
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+mysqldump/mariadb-dump crashes with this backtrace:
+
+| (gdb) bt
+| #0  my_convert (to=<optimized out>, to_length=160, to_cs=0x55b5740fbda0 

<my_charset_utf8mb4_general_ci>, from=<optimized out>, from_length=40,
+|     from_cs=0x55b57408bda0 <my_charset_utf8mb3_unicode_ci>, errors=0x7f950c35cd6c) at /usr/src/debug/mariadb/11.8.3/strings/ctype.c:1256 +| #1  0x000055b572d9f4a0 in copy_and_convert (to=0x7f94fc00c9db "Configuratiogicate_log\020automagicate_log\017is_done_message\017is_done_message", +|     to_length=<optimized out>, to_cs=<optimized out>, from=0x7f94fc059f37 "Configuration downloading from portal...", from_length=40, from_cs=<optimized out>, +|     errors=0x7f950c35cd6c) at /usr/src/debug/mariadb/11.8.3/sql/sql_string.h:53 +| #2  Protocol::net_store_data_cs (this=0x7f94fc001260, from=0x7f94fc059f37 "Configuration downloading from portal...", length=40, from_cs=<optimized out>, +|     to_cs=<optimized out>) at /usr/src/debug/mariadb/11.8.3/sql/protocol.cc:114 +| #3  0x000055b572da103f in Protocol::send_result_set_row (this=this@entry=0x7f94fc001260, row_items=row_items@entry=0x7f94fc013418) +|     at /usr/src/debug/mariadb/11.8.3/sql/protocol.cc:1359
+| #4  0x000055b572e19442 in select_send::send_data (this=0x7f94fc014f78, items=...) at /usr/src/debug/mariadb/11.8.3/sql/sql_class.cc:3294
+| #5  0x000055b572ef7c69 in select_result_sink::send_data_with_check (u=<optimized out>, sent=<optimized out>, this=<optimized out>, items=...)
+|     at /usr/src/debug/mariadb/11.8.3/sql/sql_class.h:6264
+| #6  select_result_sink::send_data_with_check (this=<optimized out>, items=..., u=<optimized out>, sent=<optimized out>)
+|     at /usr/src/debug/mariadb/11.8.3/sql/sql_class.h:6254
+| #7  end_send (join=<optimized out>, join_tab=<optimized out>, end_of_records=<optimized out>) at /usr/src/debug/mariadb/11.8.3/sql/sql_select.cc:25629 +| #8  0x000055b572ec38b6 in evaluate_join_record (join=join@entry=0x7f94fc014fa0, join_tab=join_tab@entry=0x7f94fc016940, error=error@entry=0)
+|     at /usr/src/debug/mariadb/11.8.3/sql/sql_select.cc:24523
+| #9  0x000055b572edcbf2 in sub_select (join=0x7f94fc014fa0, join_tab=0x7f94fc016940, end_of_records=<optimized out>)
+|     at /usr/src/debug/mariadb/11.8.3/sql/sql_select.cc:24290
+| #10 0x000055b572f119c6 in do_select (join=0x7f94fc014fa0, procedure=<optimized out>) at /usr/src/debug/mariadb/11.8.3/sql/sql_select.cc:23801
+| #11 JOIN::exec_inner (this=this@entry=0x7f94fc014fa0) at /usr/src/debug/mariadb/11.8.3/sql/sql_select.cc:5071
+| #12 0x000055b572f11d43 in JOIN::exec (this=this@entry=0x7f94fc014fa0) at /usr/src/debug/mariadb/11.8.3/sql/sql_select.cc:4859
+| #13 0x000055b572f0ffe6 in mysql_select (thd=thd@entry=0x7f94fc000cd8, tables=0x7f94fc013f38, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, +|     proc_param=0x0, select_options=551922436864, result=0x7f94fc014f78, unit=0x7f94fc005038, select_lex=0x7f94fc013160)
+|     at /usr/src/debug/mariadb/11.8.3/sql/sql_select.cc:5387
+| #14 0x000055b572f107dd in handle_select (thd=thd@entry=0x7f94fc000cd8, lex=lex@entry=0x7f94fc004f58, result=result@entry=0x7f94fc014f78,
+| setup_tables_done_option=setup_tables_done_option@entry=0) at /usr/src/debug/mariadb/11.8.3/sql/sql_select.cc:633
+| #15 0x000055b572e77d9e in execute_sqlcom_select (thd=thd@entry=0x7f94fc000cd8, all_tables=0x7f94fc013f38) at /usr/src/debug/mariadb/11.8.3/sql/sql_parse.cc:6190 +| #16 0x000055b572e877be in mysql_execute_command (thd=thd@entry=0x7f94fc000cd8, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false)
+|     at /usr/src/debug/mariadb/11.8.3/sql/sql_parse.cc:3975
+| #17 0x000055b572e88e03 in mysql_parse (thd=0x7f94fc000cd8, rawbuf=<optimized out>, length=<optimized out>, parser_state=<optimized out>)
+|     at /usr/src/debug/mariadb/11.8.3/sql/sql_parse.cc:7905
+| #18 0x000055b572e8b2a1 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x7f94fc000cd8, packet=packet@entry=0x7f94fc0088a9 "",
+|     packet_length=packet_length@entry=152, blocking=blocking@entry=true) at /usr/src/debug/mariadb/11.8.3/sql/sql_parse.cc:1903
+| #19 0x000055b572e8cf7c in do_command (thd=thd@entry=0x7f94fc000cd8, blocking=blocking@entry=true) at /usr/src/debug/mariadb/11.8.3/sql/sql_parse.cc:1416 +| #20 0x000055b572fcfc0d in do_handle_one_connection (connect=<optimized out>, put_in_cache=true) at /usr/src/debug/mariadb/11.8.3/sql/sql_connect.cc:1415 +| #21 0x000055b572fcffc5 in handle_one_connection (arg=arg@entry=0x55b57943cbd8) at /usr/src/debug/mariadb/11.8.3/sql/sql_connect.cc:1327
+| #22 0x000055b573382440 in pfs_spawn_thread (arg=0x55b5795eb598) at /usr/src/debug/mariadb/11.8.3/storage/perfschema/pfs.cc:2198

Quoted 8 lines

meta-oe/recipes-dbs/mysql/mariadb/0001-Remove-x86-specific-loop-in-my_convert.patch line 55

Quoted 7 lines

+| #23 0x00007f952e8571dd in start_thread (arg=<optimized out>) at pthread_create.c:448
+| #24 0x00007f952e8d318c in __GI___clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78

meta-oe/recipes-dbs/mysql/mariadb/0001-Remove-x86-specific-loop-in-my_convert.patch new file +3 -0
+
+Signed-off-by: Zoltán Böszörményi <[email protected]>
+Upstream-Status: Inappropriate [oe specific]

This seems to be not OE specific, how does it manifest just in OE ?

No idea.

According to the backtrace, it's a crash in the conversion from utf8mb3 to utf8mb4. As such, it may be an unaligned access, likely brought forth by GCC 15. A better fix may be to check the pointer value alignment and only run the optimized code if data pointed by both pointers have 4 byte alignment.

FWIW, we have a special upgrade procedure on several oe builds to carry over crucial data, including the database which may have been created with an old database version using the "utf8" charset, which defaulted to "utf8mb3" in MariaDB a few releases ago. IIRC, that default has changed, or just the recommendation was that "utf8mb4" should be used explicitly.

Quoted 6 lines

I am using meta-intel and MACHINE="intel-corei7-64" for a long time.

The crash can be _randomly_ reproduced with oe master and MariaDB 11.4.6, 11.4.8 and 11.8.3 LTS versions but the "special loop for i386" code is also in the 10.11.x and we haven't seen a crash with older Yocto versions. ¯\_(ツ)_/¯

Well, it will result in performance regression in character conversion routines for x86. while it is making things work this definitely should be informed upstream

Quoted 8 lines
Quoted 6 lines

https://jira.mariadb.org/browse/MDEV-37786

Quoted 2 lines

On OE side, can you check if DEFAULTTUNE has changed between working and non-working builds ?

I will check that.

DEFAULTTUNE="corei7-64" in all cases.

I also looked at the compiler flags.
Besides the -fcanon-prefix-map/-fmacro-prefix-map/-fdebug-prefix-map => -ffile-prefix-map change, there are no other changes in compiler flags from Yocto 5.2 to current master.

One thing that MariaDB > 11.4.6 brings in is adding -Wframe-larger-than=16384 when not built with any sanitizers. This is the commit in mariadb-server:

Author: Daniel Black <[email protected]>
Date:   Thu May 29 11:28:15 2025 +1000

    MDEV-34388: Stack overflow on Alpine Linux (postfix) - sanitizers

    Remove stack limits for sanitizers. Other tests cover them.

There's also the removal of -fuse-ld=bfd from Yocto 5.1 to 5.2.

None of these seem relevant.

The fact that the same MariaDB 11.4.6 version is in Yocto 5.2 (where it works) and current Yocto master (where it doesn't) says that the difference is only the compiler version.

Quoted 51 lines
Quoted 29 lines
Quoted 29 lines
Quoted 29 lines
Quoted 29 lines
Quoted 29 lines
+---
+ strings/ctype.c | 16 ----------------

+ 1 file changed, 16 deletions(-)

meta-oe/recipes-dbs/mysql/mariadb/0001-Remove-x86-specific-loop-in-my_convert.patch new file +26 -0
+
+diff --git a/strings/ctype.c b/strings/ctype.c
+index 629514e5e9c..d7e788c693b 100644
+--- a/strings/ctype.c
++++ b/strings/ctype.c
+@@ -1243,22 +1243,6 @@ my_convert(char *to, uint32 to_length, CHARSET_INFO *to_cs,
+
+   length= length2= MY_MIN(to_length, from_length);
+
+-#if defined(__i386__) || defined(__x86_64__)
+-  /*
+-    Special loop for i386, it allows to refer to a
+-    non-aligned memory block as UINT32, which makes
+-    it possible to copy four bytes at once. This
+-    gives about 10% performance improvement comparing
+-    to byte-by-byte loop.
+-  */
+-  for ( ; length >= 4; length-= 4, from+= 4, to+= 4)
+-  {
+-    if ((*(uint32*)from) & 0x80808080)
+-      break;
+-    *((uint32*) to)= *((const uint32*) from);
+-  }
+-#endif /* __i386__ */
+-
+   for (; ; *to++= *from++, length--)
Quoted 12 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

+   {
+     if (!length)
+--
+2.51.0
+

Signature · 1 line
2.51.0

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#120158): https://lists.openembedded.org/g/openembedded-devel/message/120158
Mute This Topic: https://lists.openembedded.org/mt/115529034/3617728
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#10 lore raw
Quoted 182 lines · Zoltan Boszormenyi via lists.openembedded.org

2025. 10. 02. 7:37 keltezéssel, Zoltan Boszormenyi via lists.openembedded.org írta:

Quoted 159 lines

2025. 10. 02. 6:59 keltezéssel, Zoltan Boszormenyi via lists.openembedded.org írta:

Quoted 158 lines

2025. 10. 02. 6:28 keltezéssel, Khem Raj írta:

Quoted 157 lines · Böszörményi Zoltán
Quoted 147 lines

2025. 10. 01. 18:53 keltezéssel, Khem Raj írta:

Quoted 123 lines · Zoltán Böszörményi
Quoted 122 lines

In some cases (most notably when running mysqldump), the server crashes in the my_convert() function, in a code protected by

    #if defined(__i386__) || defined(__x86_64__)
    ...
    #endif

The crash does not happen with the generic code. Remove the x86[-64] specific optimization.

---
   meta-oe/recipes-dbs/mysql/mariadb.inc         |  1 + ...move-x86-specific-loop-in-my_convert.patch | 89 +++++++++++++++++++

   2 files changed, 90 insertions(+)

   create mode 100644 meta-oe/recipes-dbs/mysql/mariadb/0001-Remove-x86-specific-loop-in-my_convert.patch

meta-oe/recipes-dbs/mysql/mariadb.inc +1 -0
index 13e55ebacd..67dd687c02 100644
@@ -24,6 +24,7 @@ SRC_URI = "https://archive.mariadb.org/${BP}/source/${BP}.tar.gz \
 file://0001-Add-missing-includes-cstdint-and-cstdio.patch \
 file://0001-Ensure-compatibility-with-ARMv9-by-updating-.arch-di.patch \
               file://riscv32.patch \
+ file://0001-Remove-x86-specific-loop-in-my_convert.patch \

             "
   SRC_URI[sha256sum] = "1b26c0bb2d025dbfac3b9852d2b7eafda56a171b67ac2e27831ec0414fb7df07"

(quoted diff) +0 -0

a/meta-oe/recipes-dbs/mysql/mariadb/0001-Remove-x86-specific-loop-in-my_convert.patch b/meta-oe/recipes-dbs/mysql/mariadb/0001-Remove-x86-specific-loop-in-my_convert.patch new file mode 100644
index 0000000000..26ba08865a
--- /dev/null
+++
b/meta-oe/recipes-dbs/mysql/mariadb/0001-Remove-x86-specific-loop-in-my_convert.patch

meta-oe/recipes-dbs/mysql/mariadb.inc +13 -0
@@ -0,0 +1,89 @@
+From 79d2a95391abc133e86688696ae21628b7035b2d Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Zolt=C3=A1n=20B=C3=B6sz=C3=B6rm=C3=A9nyi?=
+ <[email protected]>
+Date: Wed, 1 Oct 2025 09:29:04 +0200
+Subject: [PATCH] Remove x86 specific loop in my_convert()
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+mysqldump/mariadb-dump crashes with this backtrace:
+
+| (gdb) bt
+| #0  my_convert (to=<optimized out>, to_length=160, to_cs=0x55b5740fbda0 

<my_charset_utf8mb4_general_ci>, from=<optimized out>, from_length=40, +|     from_cs=0x55b57408bda0 <my_charset_utf8mb3_unicode_ci>, errors=0x7f950c35cd6c) at /usr/src/debug/mariadb/11.8.3/strings/ctype.c:1256 +| #1  0x000055b572d9f4a0 in copy_and_convert (to=0x7f94fc00c9db "Configuratiogicate_log\020automagicate_log\017is_done_message\017is_done_message", +|     to_length=<optimized out>, to_cs=<optimized out>, from=0x7f94fc059f37 "Configuration downloading from portal...", from_length=40, from_cs=<optimized out>, +|     errors=0x7f950c35cd6c) at /usr/src/debug/mariadb/11.8.3/sql/sql_string.h:53 +| #2  Protocol::net_store_data_cs (this=0x7f94fc001260, from=0x7f94fc059f37 "Configuration downloading from portal...", length=40, from_cs=<optimized out>, +|     to_cs=<optimized out>) at /usr/src/debug/mariadb/11.8.3/sql/protocol.cc:114 +| #3  0x000055b572da103f in Protocol::send_result_set_row (this=this@entry=0x7f94fc001260, row_items=row_items@entry=0x7f94fc013418) +|     at /usr/src/debug/mariadb/11.8.3/sql/protocol.cc:1359
+| #4  0x000055b572e19442 in select_send::send_data (this=0x7f94fc014f78, items=...) at /usr/src/debug/mariadb/11.8.3/sql/sql_class.cc:3294
+| #5  0x000055b572ef7c69 in select_result_sink::send_data_with_check (u=<optimized out>, sent=<optimized out>, this=<optimized out>, items=...)
+|     at /usr/src/debug/mariadb/11.8.3/sql/sql_class.h:6264
+| #6  select_result_sink::send_data_with_check (this=<optimized out>, items=..., u=<optimized out>, sent=<optimized out>)
+|     at /usr/src/debug/mariadb/11.8.3/sql/sql_class.h:6254
+| #7  end_send (join=<optimized out>, join_tab=<optimized out>, end_of_records=<optimized out>) at /usr/src/debug/mariadb/11.8.3/sql/sql_select.cc:25629
+| #8  0x000055b572ec38b6 in evaluate_join_record (join=join@entry=0x7f94fc014fa0, join_tab=join_tab@entry=0x7f94fc016940, error=error@entry=0)
+|     at /usr/src/debug/mariadb/11.8.3/sql/sql_select.cc:24523
+| #9  0x000055b572edcbf2 in sub_select (join=0x7f94fc014fa0, join_tab=0x7f94fc016940, end_of_records=<optimized out>)
+|     at /usr/src/debug/mariadb/11.8.3/sql/sql_select.cc:24290
+| #10 0x000055b572f119c6 in do_select (join=0x7f94fc014fa0, procedure=<optimized out>) at /usr/src/debug/mariadb/11.8.3/sql/sql_select.cc:23801
+| #11 JOIN::exec_inner (this=this@entry=0x7f94fc014fa0) at /usr/src/debug/mariadb/11.8.3/sql/sql_select.cc:5071
+| #12 0x000055b572f11d43 in JOIN::exec (this=this@entry=0x7f94fc014fa0) at /usr/src/debug/mariadb/11.8.3/sql/sql_select.cc:4859
+| #13 0x000055b572f0ffe6 in mysql_select (thd=thd@entry=0x7f94fc000cd8, tables=0x7f94fc013f38, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0,
+|     proc_param=0x0, select_options=551922436864, result=0x7f94fc014f78, unit=0x7f94fc005038, select_lex=0x7f94fc013160)
+|     at /usr/src/debug/mariadb/11.8.3/sql/sql_select.cc:5387
+| #14 0x000055b572f107dd in handle_select (thd=thd@entry=0x7f94fc000cd8, lex=lex@entry=0x7f94fc004f58, result=result@entry=0x7f94fc014f78,
+| setup_tables_done_option=setup_tables_done_option@entry=0) at /usr/src/debug/mariadb/11.8.3/sql/sql_select.cc:633
+| #15 0x000055b572e77d9e in execute_sqlcom_select (thd=thd@entry=0x7f94fc000cd8, all_tables=0x7f94fc013f38) at /usr/src/debug/mariadb/11.8.3/sql/sql_parse.cc:6190 +| #16 0x000055b572e877be in mysql_execute_command (thd=thd@entry=0x7f94fc000cd8, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false) +|     at /usr/src/debug/mariadb/11.8.3/sql/sql_parse.cc:3975
+| #17 0x000055b572e88e03 in mysql_parse (thd=0x7f94fc000cd8, rawbuf=<optimized out>, length=<optimized out>, parser_state=<optimized out>)
+|     at /usr/src/debug/mariadb/11.8.3/sql/sql_parse.cc:7905
+| #18 0x000055b572e8b2a1 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x7f94fc000cd8, packet=packet@entry=0x7f94fc0088a9 "", +|     packet_length=packet_length@entry=152, blocking=blocking@entry=true) at /usr/src/debug/mariadb/11.8.3/sql/sql_parse.cc:1903
+| #19 0x000055b572e8cf7c in do_command (thd=thd@entry=0x7f94fc000cd8, blocking=blocking@entry=true) at /usr/src/debug/mariadb/11.8.3/sql/sql_parse.cc:1416 +| #20 0x000055b572fcfc0d in do_handle_one_connection (connect=<optimized out>, put_in_cache=true) at /usr/src/debug/mariadb/11.8.3/sql/sql_connect.cc:1415 +| #21 0x000055b572fcffc5 in handle_one_connection (arg=arg@entry=0x55b57943cbd8) at /usr/src/debug/mariadb/11.8.3/sql/sql_connect.cc:1327
+| #22 0x000055b573382440 in pfs_spawn_thread (arg=0x55b5795eb598) at /usr/src/debug/mariadb/11.8.3/storage/perfschema/pfs.cc:2198

Quoted 8 lines

meta-oe/recipes-dbs/mysql/mariadb.inc

Quoted 7 lines

+| #23 0x00007f952e8571dd in start_thread (arg=<optimized out>) at pthread_create.c:448
+| #24 0x00007f952e8d318c in __GI___clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78

meta-oe/recipes-dbs/mysql/mariadb.inc +3 -0
+
+Signed-off-by: Zoltán Böszörményi <[email protected]>
+Upstream-Status: Inappropriate [oe specific]

This seems to be not OE specific, how does it manifest just in OE ?

No idea.

According to the backtrace, it's a crash in the conversion from utf8mb3 to utf8mb4. As such, it may be an unaligned access, likely brought forth by GCC 15. A better fix may be to check the pointer value alignment and only run the optimized code if data pointed by both pointers have 4 byte alignment.

FWIW, we have a special upgrade procedure on several oe builds to carry over crucial data, including the database which may have been created with an old database version using the "utf8" charset, which defaulted to "utf8mb3" in MariaDB a few releases ago. IIRC, that default has changed, or just the recommendation was that "utf8mb4" should be used explicitly.

Quoted 6 lines

I am using meta-intel and MACHINE="intel-corei7-64" for a long time.

The crash can be _randomly_ reproduced with oe master and MariaDB 11.4.6, 11.4.8 and 11.8.3 LTS versions but the "special loop for i386" code is also in the 10.11.x and we haven't seen a crash with older Yocto versions. ¯\_(ツ)_/¯

Well, it will result in performance regression in character conversion routines for x86. while it is making things work this definitely should be informed upstream

Quoted 6 lines
Quoted 5 lines

https://jira.mariadb.org/browse/MDEV-37786

Quoted 2 lines

On OE side, can you check if DEFAULTTUNE has changed between working and non-working builds ?

I will check that.

DEFAULTTUNE="corei7-64" in all cases.

I also looked at the compiler flags.
Besides the -fcanon-prefix-map/-fmacro-prefix-map/-fdebug-prefix-map => -ffile-prefix-map change, there are no other changes in compiler flags from Yocto 5.2 to current master.

One thing that MariaDB > 11.4.6 brings in is adding -Wframe-larger-than=16384 when not built with any sanitizers. This is the commit in mariadb-server:

Author: Daniel Black <[email protected]>
Date:   Thu May 29 11:28:15 2025 +1000

    MDEV-34388: Stack overflow on Alpine Linux (postfix) - sanitizers

    Remove stack limits for sanitizers. Other tests cover them.

Quoted 7 lines

There's also the removal of -fuse-ld=bfd from Yocto 5.1 to 5.2.

None of these seem relevant.

The fact that the same MariaDB 11.4.6 version is in Yocto 5.2 (where it works) and current Yocto master (where it doesn't) says that the difference is only the compiler version.

Looks like others have seen this too with gcc15 and 16, outside of OE. E.g. Gentoo[1] worked around it by passing "-fno-tree-vectorize" compiler flag.
(Of course if it's random to reproduce, than it's harder to verify if it works for OE too)

[1]: https://bugs.gentoo.org/959423

Quoted 52 lines
Quoted 32 lines
Quoted 32 lines
Quoted 32 lines
Quoted 32 lines
Quoted 32 lines
Quoted 32 lines
+---
+ strings/ctype.c | 16 ----------------

+ 1 file changed, 16 deletions(-)

meta-oe/recipes-dbs/mysql/mariadb.inc +29 -0
+
+diff --git a/strings/ctype.c b/strings/ctype.c
+index 629514e5e9c..d7e788c693b 100644
+--- a/strings/ctype.c
++++ b/strings/ctype.c
+@@ -1243,22 +1243,6 @@ my_convert(char *to, uint32 to_length, CHARSET_INFO *to_cs,
+
+   length= length2= MY_MIN(to_length, from_length);
+
+-#if defined(__i386__) || defined(__x86_64__)
+-  /*
+-    Special loop for i386, it allows to refer to a
+-    non-aligned memory block as UINT32, which makes
+-    it possible to copy four bytes at once. This
+-    gives about 10% performance improvement comparing
+-    to byte-by-byte loop.
+-  */
+-  for ( ; length >= 4; length-= 4, from+= 4, to+= 4)
+-  {
+-    if ((*(uint32*)from) & 0x80808080)
+-      break;
+-    *((uint32*) to)= *((const uint32*) from);
+-  }
+-#endif /* __i386__ */
+-
+   for (; ; *to++= *from++, length--)
+   {
+     if (!length)
+--
Quoted 11 lines
Quoted 8 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

+2.51.0
+

Signature · 1 line
2.51.0

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#120159): https://lists.openembedded.org/g/openembedded-devel/message/120159
Mute This Topic: https://lists.openembedded.org/mt/115529034/6084445
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#11 lore raw

2025. 10. 02. 9:39 keltezéssel, Gyorgy Sarvari írta:

Quoted 196 lines · Zoltan Boszormenyi via lists.openembedded.org
Quoted 182 lines

2025. 10. 02. 7:37 keltezéssel, Zoltan Boszormenyi via lists.openembedded.org írta:

Quoted 159 lines

2025. 10. 02. 6:59 keltezéssel, Zoltan Boszormenyi via lists.openembedded.org írta:

Quoted 158 lines

2025. 10. 02. 6:28 keltezéssel, Khem Raj írta:

Quoted 157 lines · Böszörményi Zoltán
Quoted 147 lines

2025. 10. 01. 18:53 keltezéssel, Khem Raj írta:

Quoted 123 lines · Zoltán Böszörményi
Quoted 122 lines

In some cases (most notably when running mysqldump), the server crashes in the my_convert() function, in a code protected by

    #if defined(__i386__) || defined(__x86_64__)
    ...
    #endif

The crash does not happen with the generic code. Remove the x86[-64] specific optimization.

---
    meta-oe/recipes-dbs/mysql/mariadb.inc         |  1 +
    ...move-x86-specific-loop-in-my_convert.patch | 89 +++++++++++++++++++
    2 files changed, 90 insertions(+)

   create mode 100644
meta-oe/recipes-dbs/mysql/mariadb/0001-Remove-x86-specific-loop-in-my_convert.patch

meta-oe/recipes-dbs/mysql/mariadb.inc +1 -0
index 13e55ebacd..67dd687c02 100644
@@ -24,6 +24,7 @@ SRC_URI = "https://archive.mariadb.org/${BP}/source/${BP}.tar.gz \
 file://0001-Add-missing-includes-cstdint-and-cstdio.patch \
 file://0001-Ensure-compatibility-with-ARMv9-by-updating-.arch-di.patch \
               file://riscv32.patch \
+ file://0001-Remove-x86-specific-loop-in-my_convert.patch \
              "
    SRC_URI[sha256sum] =

"1b26c0bb2d025dbfac3b9852d2b7eafda56a171b67ac2e27831ec0414fb7df07"

diff --git a/meta-oe/recipes-dbs/mysql/mariadb/0001-Remove-x86-specific-loop-in-my_convert.patch b/meta-oe/recipes-dbs/mysql/mariadb/0001-Remove-x86-specific-loop-in-my_convert.patch new file mode 100644
index 0000000000..26ba08865a
--- /dev/null
+++
b/meta-oe/recipes-dbs/mysql/mariadb/0001-Remove-x86-specific-loop-in-my_convert.patch

meta-oe/recipes-dbs/mysql/mariadb.inc +13 -0
@@ -0,0 +1,89 @@
+From 79d2a95391abc133e86688696ae21628b7035b2d Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Zolt=C3=A1n=20B=C3=B6sz=C3=B6rm=C3=A9nyi?=
+ <[email protected]>
+Date: Wed, 1 Oct 2025 09:29:04 +0200
+Subject: [PATCH] Remove x86 specific loop in my_convert()
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+mysqldump/mariadb-dump crashes with this backtrace:
+
+| (gdb) bt
+| #0  my_convert (to=<optimized out>, to_length=160, to_cs=0x55b5740fbda0

<my_charset_utf8mb4_general_ci>, from=<optimized out>, from_length=40, +|     from_cs=0x55b57408bda0 <my_charset_utf8mb3_unicode_ci>, errors=0x7f950c35cd6c) at /usr/src/debug/mariadb/11.8.3/strings/ctype.c:1256 +| #1  0x000055b572d9f4a0 in copy_and_convert (to=0x7f94fc00c9db "Configuratiogicate_log\020automagicate_log\017is_done_message\017is_done_message", +|     to_length=<optimized out>, to_cs=<optimized out>, from=0x7f94fc059f37 "Configuration downloading from portal...", from_length=40, from_cs=<optimized out>, +|     errors=0x7f950c35cd6c) at /usr/src/debug/mariadb/11.8.3/sql/sql_string.h:53 +| #2  Protocol::net_store_data_cs (this=0x7f94fc001260, from=0x7f94fc059f37 "Configuration downloading from portal...", length=40, from_cs=<optimized out>, +|     to_cs=<optimized out>) at /usr/src/debug/mariadb/11.8.3/sql/protocol.cc:114 +| #3  0x000055b572da103f in Protocol::send_result_set_row (this=this@entry=0x7f94fc001260, row_items=row_items@entry=0x7f94fc013418) +|     at /usr/src/debug/mariadb/11.8.3/sql/protocol.cc:1359
+| #4  0x000055b572e19442 in select_send::send_data (this=0x7f94fc014f78, items=...) at /usr/src/debug/mariadb/11.8.3/sql/sql_class.cc:3294
+| #5  0x000055b572ef7c69 in select_result_sink::send_data_with_check (u=<optimized out>, sent=<optimized out>, this=<optimized out>, items=...)
+|     at /usr/src/debug/mariadb/11.8.3/sql/sql_class.h:6264
+| #6  select_result_sink::send_data_with_check (this=<optimized out>, items=..., u=<optimized out>, sent=<optimized out>)
+|     at /usr/src/debug/mariadb/11.8.3/sql/sql_class.h:6254
+| #7  end_send (join=<optimized out>, join_tab=<optimized out>, end_of_records=<optimized out>) at /usr/src/debug/mariadb/11.8.3/sql/sql_select.cc:25629
+| #8  0x000055b572ec38b6 in evaluate_join_record (join=join@entry=0x7f94fc014fa0, join_tab=join_tab@entry=0x7f94fc016940, error=error@entry=0)
+|     at /usr/src/debug/mariadb/11.8.3/sql/sql_select.cc:24523
+| #9  0x000055b572edcbf2 in sub_select (join=0x7f94fc014fa0, join_tab=0x7f94fc016940, end_of_records=<optimized out>)
+|     at /usr/src/debug/mariadb/11.8.3/sql/sql_select.cc:24290
+| #10 0x000055b572f119c6 in do_select (join=0x7f94fc014fa0, procedure=<optimized out>) at /usr/src/debug/mariadb/11.8.3/sql/sql_select.cc:23801
+| #11 JOIN::exec_inner (this=this@entry=0x7f94fc014fa0) at /usr/src/debug/mariadb/11.8.3/sql/sql_select.cc:5071
+| #12 0x000055b572f11d43 in JOIN::exec (this=this@entry=0x7f94fc014fa0) at /usr/src/debug/mariadb/11.8.3/sql/sql_select.cc:4859
+| #13 0x000055b572f0ffe6 in mysql_select (thd=thd@entry=0x7f94fc000cd8, tables=0x7f94fc013f38, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0,
+|     proc_param=0x0, select_options=551922436864, result=0x7f94fc014f78, unit=0x7f94fc005038, select_lex=0x7f94fc013160)
+|     at /usr/src/debug/mariadb/11.8.3/sql/sql_select.cc:5387
+| #14 0x000055b572f107dd in handle_select (thd=thd@entry=0x7f94fc000cd8, lex=lex@entry=0x7f94fc004f58, result=result@entry=0x7f94fc014f78,
+| setup_tables_done_option=setup_tables_done_option@entry=0) at /usr/src/debug/mariadb/11.8.3/sql/sql_select.cc:633
+| #15 0x000055b572e77d9e in execute_sqlcom_select (thd=thd@entry=0x7f94fc000cd8, all_tables=0x7f94fc013f38) at /usr/src/debug/mariadb/11.8.3/sql/sql_parse.cc:6190 +| #16 0x000055b572e877be in mysql_execute_command (thd=thd@entry=0x7f94fc000cd8, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false) +|     at /usr/src/debug/mariadb/11.8.3/sql/sql_parse.cc:3975
+| #17 0x000055b572e88e03 in mysql_parse (thd=0x7f94fc000cd8, rawbuf=<optimized out>, length=<optimized out>, parser_state=<optimized out>)
+|     at /usr/src/debug/mariadb/11.8.3/sql/sql_parse.cc:7905
+| #18 0x000055b572e8b2a1 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x7f94fc000cd8, packet=packet@entry=0x7f94fc0088a9 "", +|     packet_length=packet_length@entry=152, blocking=blocking@entry=true) at /usr/src/debug/mariadb/11.8.3/sql/sql_parse.cc:1903
+| #19 0x000055b572e8cf7c in do_command (thd=thd@entry=0x7f94fc000cd8, blocking=blocking@entry=true) at /usr/src/debug/mariadb/11.8.3/sql/sql_parse.cc:1416 +| #20 0x000055b572fcfc0d in do_handle_one_connection (connect=<optimized out>, put_in_cache=true) at /usr/src/debug/mariadb/11.8.3/sql/sql_connect.cc:1415 +| #21 0x000055b572fcffc5 in handle_one_connection (arg=arg@entry=0x55b57943cbd8) at /usr/src/debug/mariadb/11.8.3/sql/sql_connect.cc:1327
+| #22 0x000055b573382440 in pfs_spawn_thread (arg=0x55b5795eb598) at /usr/src/debug/mariadb/11.8.3/storage/perfschema/pfs.cc:2198

Quoted 8 lines

meta-oe/recipes-dbs/mysql/mariadb.inc

Quoted 7 lines

+| #23 0x00007f952e8571dd in start_thread (arg=<optimized out>) at pthread_create.c:448
+| #24 0x00007f952e8d318c in __GI___clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78

meta-oe/recipes-dbs/mysql/mariadb.inc +3 -0
+
+Signed-off-by: Zoltán Böszörményi <[email protected]>
+Upstream-Status: Inappropriate [oe specific]

This seems to be not OE specific, how does it manifest just in OE ?

No idea.

According to the backtrace, it's a crash in the conversion from utf8mb3 to utf8mb4. As such, it may be an unaligned access, likely brought forth by GCC 15. A better fix may be to check the pointer value alignment and only run the optimized code if data pointed by both pointers have 4 byte alignment.

FWIW, we have a special upgrade procedure on several oe builds to carry over crucial data, including the database which may have been created with an old database version using the "utf8" charset, which defaulted to "utf8mb3" in MariaDB a few releases ago. IIRC, that default has changed, or just the recommendation was that "utf8mb4" should be used explicitly.

Quoted 6 lines

I am using meta-intel and MACHINE="intel-corei7-64" for a long time.

The crash can be _randomly_ reproduced with oe master and MariaDB 11.4.6, 11.4.8 and 11.8.3 LTS versions but the "special loop for i386" code is also in the 10.11.x and we haven't seen a crash with older Yocto versions. ¯\_(ツ)_/¯

Well, it will result in performance regression in character conversion routines for x86. while it is making things work this definitely should be informed upstream

Quoted 6 lines
Quoted 5 lines

https://jira.mariadb.org/browse/MDEV-37786

Quoted 2 lines

On OE side, can you check if DEFAULTTUNE has changed between working and non-working builds ?

I will check that.

DEFAULTTUNE="corei7-64" in all cases.

I also looked at the compiler flags.
Besides the -fcanon-prefix-map/-fmacro-prefix-map/-fdebug-prefix-map => -ffile-prefix-map change, there are no other changes in compiler flags from Yocto 5.2 to current master.

One thing that MariaDB > 11.4.6 brings in is adding -Wframe-larger-than=16384 when not built with any sanitizers. This is the commit in mariadb-server:

Author: Daniel Black <[email protected]>
Date:   Thu May 29 11:28:15 2025 +1000

    MDEV-34388: Stack overflow on Alpine Linux (postfix) - sanitizers

    Remove stack limits for sanitizers. Other tests cover them.

Quoted 7 lines

There's also the removal of -fuse-ld=bfd from Yocto 5.1 to 5.2.

None of these seem relevant.

The fact that the same MariaDB 11.4.6 version is in Yocto 5.2 (where it works) and current Yocto master (where it doesn't) says that the difference is only the compiler version.

Looks like others have seen this too with gcc15 and 16, outside of OE. E.g. Gentoo[1] worked around it by passing "-fno-tree-vectorize" compiler flag.
(Of course if it's random to reproduce, than it's harder to verify if it works for OE too)

Quoted 1 line

[1]: https://bugs.gentoo.org/959423

Nice.

My bug report was commented on in the meantime,
removing the manual optimization was endorsed.

It also has a "duplicates" link to
https://jira.mariadb.org/browse/MDEV-37148
where the problem is elaborated more in depth.

So, what to do with this patch?
Should I re-send with "Upstream-Status: Pending"?

Quoted 49 lines
Quoted 49 lines
Quoted 31 lines
Quoted 31 lines
Quoted 31 lines
Quoted 31 lines
Quoted 31 lines
Quoted 31 lines
+---
+ strings/ctype.c | 16 ----------------

+ 1 file changed, 16 deletions(-)

meta-oe/recipes-dbs/mysql/mariadb.inc +28 -0
+
+diff --git a/strings/ctype.c b/strings/ctype.c
+index 629514e5e9c..d7e788c693b 100644
+--- a/strings/ctype.c
++++ b/strings/ctype.c
+@@ -1243,22 +1243,6 @@ my_convert(char *to, uint32 to_length, CHARSET_INFO *to_cs,
+
+   length= length2= MY_MIN(to_length, from_length);
+
+-#if defined(__i386__) || defined(__x86_64__)
+-  /*
+-    Special loop for i386, it allows to refer to a
+-    non-aligned memory block as UINT32, which makes
+-    it possible to copy four bytes at once. This
+-    gives about 10% performance improvement comparing
+-    to byte-by-byte loop.
+-  */
+-  for ( ; length >= 4; length-= 4, from+= 4, to+= 4)
+-  {
+-    if ((*(uint32*)from) & 0x80808080)
+-      break;
+-    *((uint32*) to)= *((const uint32*) from);
+-  }
+-#endif /* __i386__ */
+-
+   for (; ; *to++= *from++, length--)
+   {
+     if (!length)
Quoted 10 lines
Quoted 8 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

+--
+2.51.0
+

Signature · 1 line
2.51.0

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#120159): https://lists.openembedded.org/g/openembedded-devel/message/120159
Mute This Topic: https://lists.openembedded.org/mt/115529034/6084445
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#12 lore raw
Quoted 203 lines · Böszörményi Zoltán

2025. 10. 02. 9:39 keltezéssel, Gyorgy Sarvari írta:

Quoted 196 lines · Zoltan Boszormenyi via lists.openembedded.org
Quoted 182 lines

2025. 10. 02. 7:37 keltezéssel, Zoltan Boszormenyi via lists.openembedded.org írta:

Quoted 159 lines

2025. 10. 02. 6:59 keltezéssel, Zoltan Boszormenyi via lists.openembedded.org írta:

Quoted 158 lines

2025. 10. 02. 6:28 keltezéssel, Khem Raj írta:

Quoted 157 lines · Böszörményi Zoltán
Quoted 147 lines

2025. 10. 01. 18:53 keltezéssel, Khem Raj írta:

Quoted 123 lines · Zoltán Böszörményi
Quoted 122 lines

In some cases (most notably when running mysqldump), the server crashes in the my_convert() function, in a code protected by

    #if defined(__i386__) || defined(__x86_64__)
    ...
    #endif

The crash does not happen with the generic code. Remove the x86[-64] specific optimization.

---
    meta-oe/recipes-dbs/mysql/mariadb.inc         |  1 +
    ...move-x86-specific-loop-in-my_convert.patch | 89 +++++++++++++++++++
    2 files changed, 90 insertions(+)

   create mode 100644
meta-oe/recipes-dbs/mysql/mariadb/0001-Remove-x86-specific-loop-in-my_convert.patch

meta-oe/recipes-dbs/mysql/mariadb.inc +1 -0
index 13e55ebacd..67dd687c02 100644
@@ -24,6 +24,7 @@ SRC_URI = "https://archive.mariadb.org/${BP}/source/${BP}.tar.gz \
 file://0001-Add-missing-includes-cstdint-and-cstdio.patch \
 file://0001-Ensure-compatibility-with-ARMv9-by-updating-.arch-di.patch \
               file://riscv32.patch \
+ file://0001-Remove-x86-specific-loop-in-my_convert.patch \
              "
    SRC_URI[sha256sum] =

"1b26c0bb2d025dbfac3b9852d2b7eafda56a171b67ac2e27831ec0414fb7df07"

diff --git a/meta-oe/recipes-dbs/mysql/mariadb/0001-Remove-x86-specific-loop-in-my_convert.patch b/meta-oe/recipes-dbs/mysql/mariadb/0001-Remove-x86-specific-loop-in-my_convert.patch new file mode 100644
index 0000000000..26ba08865a
--- /dev/null
+++
b/meta-oe/recipes-dbs/mysql/mariadb/0001-Remove-x86-specific-loop-in-my_convert.patch

meta-oe/recipes-dbs/mysql/mariadb.inc +13 -0
@@ -0,0 +1,89 @@
+From 79d2a95391abc133e86688696ae21628b7035b2d Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Zolt=C3=A1n=20B=C3=B6sz=C3=B6rm=C3=A9nyi?=
+ <[email protected]>
+Date: Wed, 1 Oct 2025 09:29:04 +0200
+Subject: [PATCH] Remove x86 specific loop in my_convert()
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+mysqldump/mariadb-dump crashes with this backtrace:
+
+| (gdb) bt
+| #0  my_convert (to=<optimized out>, to_length=160, to_cs=0x55b5740fbda0

<my_charset_utf8mb4_general_ci>, from=<optimized out>, from_length=40, +|     from_cs=0x55b57408bda0 <my_charset_utf8mb3_unicode_ci>, errors=0x7f950c35cd6c) at /usr/src/debug/mariadb/11.8.3/strings/ctype.c:1256 +| #1  0x000055b572d9f4a0 in copy_and_convert (to=0x7f94fc00c9db "Configuratiogicate_log\020automagicate_log\017is_done_message\017is_done_message", +|     to_length=<optimized out>, to_cs=<optimized out>, from=0x7f94fc059f37 "Configuration downloading from portal...", from_length=40, from_cs=<optimized out>, +|     errors=0x7f950c35cd6c) at /usr/src/debug/mariadb/11.8.3/sql/sql_string.h:53 +| #2  Protocol::net_store_data_cs (this=0x7f94fc001260, from=0x7f94fc059f37 "Configuration downloading from portal...", length=40, from_cs=<optimized out>, +|     to_cs=<optimized out>) at /usr/src/debug/mariadb/11.8.3/sql/protocol.cc:114 +| #3  0x000055b572da103f in Protocol::send_result_set_row (this=this@entry=0x7f94fc001260, row_items=row_items@entry=0x7f94fc013418) +|     at /usr/src/debug/mariadb/11.8.3/sql/protocol.cc:1359
+| #4  0x000055b572e19442 in select_send::send_data (this=0x7f94fc014f78, items=...) at /usr/src/debug/mariadb/11.8.3/sql/sql_class.cc:3294
+| #5  0x000055b572ef7c69 in select_result_sink::send_data_with_check (u=<optimized out>, sent=<optimized out>, this=<optimized out>, items=...)
+|     at /usr/src/debug/mariadb/11.8.3/sql/sql_class.h:6264
+| #6  select_result_sink::send_data_with_check (this=<optimized out>, items=..., u=<optimized out>, sent=<optimized out>)
+|     at /usr/src/debug/mariadb/11.8.3/sql/sql_class.h:6254
+| #7  end_send (join=<optimized out>, join_tab=<optimized out>, end_of_records=<optimized out>) at /usr/src/debug/mariadb/11.8.3/sql/sql_select.cc:25629
+| #8  0x000055b572ec38b6 in evaluate_join_record (join=join@entry=0x7f94fc014fa0, join_tab=join_tab@entry=0x7f94fc016940, error=error@entry=0)
+|     at /usr/src/debug/mariadb/11.8.3/sql/sql_select.cc:24523
+| #9  0x000055b572edcbf2 in sub_select (join=0x7f94fc014fa0, join_tab=0x7f94fc016940, end_of_records=<optimized out>)
+|     at /usr/src/debug/mariadb/11.8.3/sql/sql_select.cc:24290
+| #10 0x000055b572f119c6 in do_select (join=0x7f94fc014fa0, procedure=<optimized out>) at /usr/src/debug/mariadb/11.8.3/sql/sql_select.cc:23801
+| #11 JOIN::exec_inner (this=this@entry=0x7f94fc014fa0) at /usr/src/debug/mariadb/11.8.3/sql/sql_select.cc:5071
+| #12 0x000055b572f11d43 in JOIN::exec (this=this@entry=0x7f94fc014fa0) at /usr/src/debug/mariadb/11.8.3/sql/sql_select.cc:4859
+| #13 0x000055b572f0ffe6 in mysql_select (thd=thd@entry=0x7f94fc000cd8, tables=0x7f94fc013f38, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0,
+|     proc_param=0x0, select_options=551922436864, result=0x7f94fc014f78, unit=0x7f94fc005038, select_lex=0x7f94fc013160)
+|     at /usr/src/debug/mariadb/11.8.3/sql/sql_select.cc:5387
+| #14 0x000055b572f107dd in handle_select (thd=thd@entry=0x7f94fc000cd8, lex=lex@entry=0x7f94fc004f58, result=result@entry=0x7f94fc014f78,
+| setup_tables_done_option=setup_tables_done_option@entry=0) at /usr/src/debug/mariadb/11.8.3/sql/sql_select.cc:633
+| #15 0x000055b572e77d9e in execute_sqlcom_select (thd=thd@entry=0x7f94fc000cd8, all_tables=0x7f94fc013f38) at /usr/src/debug/mariadb/11.8.3/sql/sql_parse.cc:6190 +| #16 0x000055b572e877be in mysql_execute_command (thd=thd@entry=0x7f94fc000cd8, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false) +|     at /usr/src/debug/mariadb/11.8.3/sql/sql_parse.cc:3975
+| #17 0x000055b572e88e03 in mysql_parse (thd=0x7f94fc000cd8, rawbuf=<optimized out>, length=<optimized out>, parser_state=<optimized out>)
+|     at /usr/src/debug/mariadb/11.8.3/sql/sql_parse.cc:7905
+| #18 0x000055b572e8b2a1 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x7f94fc000cd8, packet=packet@entry=0x7f94fc0088a9 "", +|     packet_length=packet_length@entry=152, blocking=blocking@entry=true) at /usr/src/debug/mariadb/11.8.3/sql/sql_parse.cc:1903
+| #19 0x000055b572e8cf7c in do_command (thd=thd@entry=0x7f94fc000cd8, blocking=blocking@entry=true) at /usr/src/debug/mariadb/11.8.3/sql/sql_parse.cc:1416 +| #20 0x000055b572fcfc0d in do_handle_one_connection (connect=<optimized out>, put_in_cache=true) at /usr/src/debug/mariadb/11.8.3/sql/sql_connect.cc:1415 +| #21 0x000055b572fcffc5 in handle_one_connection (arg=arg@entry=0x55b57943cbd8) at /usr/src/debug/mariadb/11.8.3/sql/sql_connect.cc:1327
+| #22 0x000055b573382440 in pfs_spawn_thread (arg=0x55b5795eb598) at /usr/src/debug/mariadb/11.8.3/storage/perfschema/pfs.cc:2198

Quoted 8 lines

meta-oe/recipes-dbs/mysql/mariadb.inc

Quoted 7 lines

+| #23 0x00007f952e8571dd in start_thread (arg=<optimized out>) at pthread_create.c:448
+| #24 0x00007f952e8d318c in __GI___clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78

meta-oe/recipes-dbs/mysql/mariadb.inc +3 -0
+
+Signed-off-by: Zoltán Böszörményi <[email protected]>
+Upstream-Status: Inappropriate [oe specific]

This seems to be not OE specific, how does it manifest just in OE ?

No idea.

According to the backtrace, it's a crash in the conversion from utf8mb3 to utf8mb4. As such, it may be an unaligned access, likely brought forth by GCC 15. A better fix may be to check the pointer value alignment and only run the optimized code if data pointed by both pointers have 4 byte alignment.

FWIW, we have a special upgrade procedure on several oe builds to carry over crucial data, including the database which may have been created with an old database version using the "utf8" charset, which defaulted to "utf8mb3" in MariaDB a few releases ago. IIRC, that default has changed, or just the recommendation was that "utf8mb4" should be used explicitly.

Quoted 6 lines

I am using meta-intel and MACHINE="intel-corei7-64" for a long time.

The crash can be _randomly_ reproduced with oe master and MariaDB 11.4.6, 11.4.8 and 11.8.3 LTS versions but the "special loop for i386" code is also in the 10.11.x and we haven't seen a crash with older Yocto versions. ¯\_(ツ)_/¯

Well, it will result in performance regression in character conversion routines for x86. while it is making things work this definitely should be informed upstream

Quoted 6 lines
Quoted 5 lines

https://jira.mariadb.org/browse/MDEV-37786

Quoted 2 lines

On OE side, can you check if DEFAULTTUNE has changed between working and non-working builds ?

I will check that.

DEFAULTTUNE="corei7-64" in all cases.

I also looked at the compiler flags.
Besides the -fcanon-prefix-map/-fmacro-prefix-map/-fdebug-prefix-map => -ffile-prefix-map change, there are no other changes in compiler flags from Yocto 5.2 to current master.

One thing that MariaDB > 11.4.6 brings in is adding -Wframe-larger-than=16384 when not built with any sanitizers. This is the commit in mariadb-server:

Author: Daniel Black <[email protected]>
Date:   Thu May 29 11:28:15 2025 +1000

    MDEV-34388: Stack overflow on Alpine Linux (postfix) - sanitizers

    Remove stack limits for sanitizers. Other tests cover them.

Quoted 7 lines

There's also the removal of -fuse-ld=bfd from Yocto 5.1 to 5.2.

None of these seem relevant.

The fact that the same MariaDB 11.4.6 version is in Yocto 5.2 (where it works) and current Yocto master (where it doesn't) says that the difference is only the compiler version.

Looks like others have seen this too with gcc15 and 16, outside of OE. E.g. Gentoo[1] worked around it by passing "-fno-tree-vectorize" compiler flag.
(Of course if it's random to reproduce, than it's harder to verify if it works for OE too)

Quoted 1 line

[1]: https://bugs.gentoo.org/959423

Nice.

My bug report was commented on in the meantime,
removing the manual optimization was endorsed.

Quoted 6 lines

It also has a "duplicates" link to
https://jira.mariadb.org/browse/MDEV-37148
where the problem is elaborated more in depth.

So, what to do with this patch?
Should I re-send with "Upstream-Status: Pending"?

I think "Inappropriate" status would be okay (it has a secondary meaning beside oe-specific, for cases like this, when it is handled with a bug report), but it would be good to mention both your bug, where your patch is endorsed by upstream and the linked duplicate also that we can check to see when your patch can be dropped.

Quoted 47 lines
Quoted 47 lines
Quoted 47 lines
Quoted 30 lines
Quoted 30 lines
Quoted 30 lines
Quoted 30 lines
Quoted 30 lines
Quoted 30 lines
+---
+ strings/ctype.c | 16 ----------------

+ 1 file changed, 16 deletions(-)

meta-oe/recipes-dbs/mysql/mariadb.inc +27 -0
+
+diff --git a/strings/ctype.c b/strings/ctype.c
+index 629514e5e9c..d7e788c693b 100644
+--- a/strings/ctype.c
++++ b/strings/ctype.c
+@@ -1243,22 +1243,6 @@ my_convert(char *to, uint32 to_length, CHARSET_INFO *to_cs,
+
+   length= length2= MY_MIN(to_length, from_length);
+
+-#if defined(__i386__) || defined(__x86_64__)
+-  /*
+-    Special loop for i386, it allows to refer to a
+-    non-aligned memory block as UINT32, which makes
+-    it possible to copy four bytes at once. This
+-    gives about 10% performance improvement comparing
+-    to byte-by-byte loop.
+-  */
+-  for ( ; length >= 4; length-= 4, from+= 4, to+= 4)
+-  {
+-    if ((*(uint32*)from) & 0x80808080)
+-      break;
+-    *((uint32*) to)= *((const uint32*) from);
+-  }
+-#endif /* __i386__ */
+-
+   for (; ; *to++= *from++, length--)
+   {
Quoted 9 lines
Quoted 8 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

+     if (!length)
+--
+2.51.0
+

Signature · 1 line
2.51.0

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#120159): https://lists.openembedded.org/g/openembedded-devel/message/120159
Mute This Topic: https://lists.openembedded.org/mt/115529034/6084445
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#13 lore raw

2025. 10. 02. 10:00 keltezéssel, Gyorgy Sarvari írta:

Quoted 208 lines · Böszörményi Zoltán
Quoted 207 lines

2025. 10. 02. 9:39 keltezéssel, Gyorgy Sarvari írta:

Quoted 196 lines · Zoltan Boszormenyi via lists.openembedded.org
Quoted 182 lines

2025. 10. 02. 7:37 keltezéssel, Zoltan Boszormenyi via lists.openembedded.org írta:

Quoted 159 lines

2025. 10. 02. 6:59 keltezéssel, Zoltan Boszormenyi via lists.openembedded.org írta:

Quoted 158 lines

2025. 10. 02. 6:28 keltezéssel, Khem Raj írta:

Quoted 157 lines · Böszörményi Zoltán
Quoted 147 lines

2025. 10. 01. 18:53 keltezéssel, Khem Raj írta:

Quoted 123 lines · Zoltán Böszörményi
Quoted 122 lines

In some cases (most notably when running mysqldump), the server crashes in the my_convert() function, in a code protected by

      #if defined(__i386__) || defined(__x86_64__)
      ...
      #endif

The crash does not happen with the generic code. Remove the x86[-64] specific optimization.

---
     meta-oe/recipes-dbs/mysql/mariadb.inc         |  1 +
     ...move-x86-specific-loop-in-my_convert.patch | 89 +++++++++++++++++++
     2 files changed, 90 insertions(+)

   create mode 100644
meta-oe/recipes-dbs/mysql/mariadb/0001-Remove-x86-specific-loop-in-my_convert.patch

meta-oe/recipes-dbs/mysql/mariadb.inc +1 -0
index 13e55ebacd..67dd687c02 100644
@@ -24,6 +24,7 @@ SRC_URI = "https://archive.mariadb.org/${BP}/source/${BP}.tar.gz \
 file://0001-Add-missing-includes-cstdint-and-cstdio.patch \
 file://0001-Ensure-compatibility-with-ARMv9-by-updating-.arch-di.patch \
                file://riscv32.patch \
+ file://0001-Remove-x86-specific-loop-in-my_convert.patch \
               "
     SRC_URI[sha256sum] =

"1b26c0bb2d025dbfac3b9852d2b7eafda56a171b67ac2e27831ec0414fb7df07"

diff --git a/meta-oe/recipes-dbs/mysql/mariadb/0001-Remove-x86-specific-loop-in-my_convert.patch b/meta-oe/recipes-dbs/mysql/mariadb/0001-Remove-x86-specific-loop-in-my_convert.patch new file mode 100644
index 0000000000..26ba08865a
--- /dev/null
+++
b/meta-oe/recipes-dbs/mysql/mariadb/0001-Remove-x86-specific-loop-in-my_convert.patch

meta-oe/recipes-dbs/mysql/mariadb.inc +13 -0
@@ -0,0 +1,89 @@
+From 79d2a95391abc133e86688696ae21628b7035b2d Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Zolt=C3=A1n=20B=C3=B6sz=C3=B6rm=C3=A9nyi?=
+ <[email protected]>
+Date: Wed, 1 Oct 2025 09:29:04 +0200
+Subject: [PATCH] Remove x86 specific loop in my_convert()
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+mysqldump/mariadb-dump crashes with this backtrace:
+
+| (gdb) bt
+| #0  my_convert (to=<optimized out>, to_length=160, to_cs=0x55b5740fbda0

<my_charset_utf8mb4_general_ci>, from=<optimized out>, from_length=40, +|     from_cs=0x55b57408bda0 <my_charset_utf8mb3_unicode_ci>, errors=0x7f950c35cd6c) at /usr/src/debug/mariadb/11.8.3/strings/ctype.c:1256 +| #1  0x000055b572d9f4a0 in copy_and_convert (to=0x7f94fc00c9db "Configuratiogicate_log\020automagicate_log\017is_done_message\017is_done_message", +|     to_length=<optimized out>, to_cs=<optimized out>, from=0x7f94fc059f37 "Configuration downloading from portal...", from_length=40, from_cs=<optimized out>, +|     errors=0x7f950c35cd6c) at /usr/src/debug/mariadb/11.8.3/sql/sql_string.h:53 +| #2  Protocol::net_store_data_cs (this=0x7f94fc001260, from=0x7f94fc059f37 "Configuration downloading from portal...", length=40, from_cs=<optimized out>, +|     to_cs=<optimized out>) at /usr/src/debug/mariadb/11.8.3/sql/protocol.cc:114 +| #3  0x000055b572da103f in Protocol::send_result_set_row (this=this@entry=0x7f94fc001260, row_items=row_items@entry=0x7f94fc013418) +|     at /usr/src/debug/mariadb/11.8.3/sql/protocol.cc:1359
+| #4  0x000055b572e19442 in select_send::send_data (this=0x7f94fc014f78, items=...) at /usr/src/debug/mariadb/11.8.3/sql/sql_class.cc:3294
+| #5  0x000055b572ef7c69 in select_result_sink::send_data_with_check (u=<optimized out>, sent=<optimized out>, this=<optimized out>, items=...)
+|     at /usr/src/debug/mariadb/11.8.3/sql/sql_class.h:6264
+| #6  select_result_sink::send_data_with_check (this=<optimized out>, items=..., u=<optimized out>, sent=<optimized out>)
+|     at /usr/src/debug/mariadb/11.8.3/sql/sql_class.h:6254
+| #7  end_send (join=<optimized out>, join_tab=<optimized out>, end_of_records=<optimized out>) at /usr/src/debug/mariadb/11.8.3/sql/sql_select.cc:25629
+| #8  0x000055b572ec38b6 in evaluate_join_record (join=join@entry=0x7f94fc014fa0, join_tab=join_tab@entry=0x7f94fc016940, error=error@entry=0)
+|     at /usr/src/debug/mariadb/11.8.3/sql/sql_select.cc:24523
+| #9  0x000055b572edcbf2 in sub_select (join=0x7f94fc014fa0, join_tab=0x7f94fc016940, end_of_records=<optimized out>)
+|     at /usr/src/debug/mariadb/11.8.3/sql/sql_select.cc:24290
+| #10 0x000055b572f119c6 in do_select (join=0x7f94fc014fa0, procedure=<optimized out>) at /usr/src/debug/mariadb/11.8.3/sql/sql_select.cc:23801
+| #11 JOIN::exec_inner (this=this@entry=0x7f94fc014fa0) at /usr/src/debug/mariadb/11.8.3/sql/sql_select.cc:5071
+| #12 0x000055b572f11d43 in JOIN::exec (this=this@entry=0x7f94fc014fa0) at /usr/src/debug/mariadb/11.8.3/sql/sql_select.cc:4859
+| #13 0x000055b572f0ffe6 in mysql_select (thd=thd@entry=0x7f94fc000cd8, tables=0x7f94fc013f38, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0,
+|     proc_param=0x0, select_options=551922436864, result=0x7f94fc014f78, unit=0x7f94fc005038, select_lex=0x7f94fc013160)
+|     at /usr/src/debug/mariadb/11.8.3/sql/sql_select.cc:5387
+| #14 0x000055b572f107dd in handle_select (thd=thd@entry=0x7f94fc000cd8, lex=lex@entry=0x7f94fc004f58, result=result@entry=0x7f94fc014f78,
+| setup_tables_done_option=setup_tables_done_option@entry=0) at /usr/src/debug/mariadb/11.8.3/sql/sql_select.cc:633
+| #15 0x000055b572e77d9e in execute_sqlcom_select (thd=thd@entry=0x7f94fc000cd8, all_tables=0x7f94fc013f38) at /usr/src/debug/mariadb/11.8.3/sql/sql_parse.cc:6190 +| #16 0x000055b572e877be in mysql_execute_command (thd=thd@entry=0x7f94fc000cd8, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false) +|     at /usr/src/debug/mariadb/11.8.3/sql/sql_parse.cc:3975
+| #17 0x000055b572e88e03 in mysql_parse (thd=0x7f94fc000cd8, rawbuf=<optimized out>, length=<optimized out>, parser_state=<optimized out>)
+|     at /usr/src/debug/mariadb/11.8.3/sql/sql_parse.cc:7905
+| #18 0x000055b572e8b2a1 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x7f94fc000cd8, packet=packet@entry=0x7f94fc0088a9 "", +|     packet_length=packet_length@entry=152, blocking=blocking@entry=true) at /usr/src/debug/mariadb/11.8.3/sql/sql_parse.cc:1903
+| #19 0x000055b572e8cf7c in do_command (thd=thd@entry=0x7f94fc000cd8, blocking=blocking@entry=true) at /usr/src/debug/mariadb/11.8.3/sql/sql_parse.cc:1416 +| #20 0x000055b572fcfc0d in do_handle_one_connection (connect=<optimized out>, put_in_cache=true) at /usr/src/debug/mariadb/11.8.3/sql/sql_connect.cc:1415 +| #21 0x000055b572fcffc5 in handle_one_connection (arg=arg@entry=0x55b57943cbd8) at /usr/src/debug/mariadb/11.8.3/sql/sql_connect.cc:1327
+| #22 0x000055b573382440 in pfs_spawn_thread (arg=0x55b5795eb598) at /usr/src/debug/mariadb/11.8.3/storage/perfschema/pfs.cc:2198

Quoted 8 lines

meta-oe/recipes-dbs/mysql/mariadb.inc

Quoted 7 lines

+| #23 0x00007f952e8571dd in start_thread (arg=<optimized out>) at pthread_create.c:448
+| #24 0x00007f952e8d318c in __GI___clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78

meta-oe/recipes-dbs/mysql/mariadb.inc +3 -0
+
+Signed-off-by: Zoltán Böszörményi <[email protected]>
+Upstream-Status: Inappropriate [oe specific]

This seems to be not OE specific, how does it manifest just in OE ?

No idea.

According to the backtrace, it's a crash in the conversion from utf8mb3 to utf8mb4. As such, it may be an unaligned access, likely brought forth by GCC 15. A better fix may be to check the pointer value alignment and only run the optimized code if data pointed by both pointers have 4 byte alignment.

FWIW, we have a special upgrade procedure on several oe builds to carry over crucial data, including the database which may have been created with an old database version using the "utf8" charset, which defaulted to "utf8mb3" in MariaDB a few releases ago. IIRC, that default has changed, or just the recommendation was that "utf8mb4" should be used explicitly.

Quoted 6 lines

I am using meta-intel and MACHINE="intel-corei7-64" for a long time.

The crash can be _randomly_ reproduced with oe master and MariaDB 11.4.6, 11.4.8 and 11.8.3 LTS versions but the "special loop for i386" code is also in the 10.11.x and we haven't seen a crash with older Yocto versions. ¯\_(ツ)_/¯

Well, it will result in performance regression in character conversion routines for x86. while it is making things work this definitely should be informed upstream

Quoted 6 lines
Quoted 5 lines

https://jira.mariadb.org/browse/MDEV-37786

Quoted 2 lines

On OE side, can you check if DEFAULTTUNE has changed between working and non-working builds ?

I will check that.

DEFAULTTUNE="corei7-64" in all cases.

I also looked at the compiler flags.
Besides the -fcanon-prefix-map/-fmacro-prefix-map/-fdebug-prefix-map => -ffile-prefix-map change, there are no other changes in compiler flags from Yocto 5.2 to current master.

One thing that MariaDB > 11.4.6 brings in is adding -Wframe-larger-than=16384 when not built with any sanitizers. This is the commit in mariadb-server:

Author: Daniel Black <[email protected]>
Date:   Thu May 29 11:28:15 2025 +1000

    MDEV-34388: Stack overflow on Alpine Linux (postfix) - sanitizers

    Remove stack limits for sanitizers. Other tests cover them.

Quoted 7 lines

There's also the removal of -fuse-ld=bfd from Yocto 5.1 to 5.2.

None of these seem relevant.

The fact that the same MariaDB 11.4.6 version is in Yocto 5.2 (where it works) and current Yocto master (where it doesn't) says that the difference is only the compiler version.

Looks like others have seen this too with gcc15 and 16, outside of OE. E.g. Gentoo[1] worked around it by passing "-fno-tree-vectorize" compiler flag.
(Of course if it's random to reproduce, than it's harder to verify if it works for OE too)

Quoted 1 line

[1]: https://bugs.gentoo.org/959423

Nice.

My bug report was commented on in the meantime,
removing the manual optimization was endorsed.

It also has a "duplicates" link to
https://jira.mariadb.org/browse/MDEV-37148
where the problem is elaborated more in depth.

Quoted 7 lines
Quoted 2 lines

So, what to do with this patch?
Should I re-send with "Upstream-Status: Pending"?

I think "Inappropriate" status would be okay (it has a secondary meaning beside oe-specific, for cases like this, when it is handled with a bug report), but it would be good to mention both your bug, where your patch is endorsed by upstream and the linked duplicate also that we can check to see when your patch can be dropped.

Do you mean to mention these in the commit message,
or in the patch, or both? Just so I would have to resend it once.

FWIW, Fedora 42 has a GCC 15.2.1 snapshot with a date 20250808 (a lot of commits were merged after tagging the 15.2 release that day) but the commit ID in the specfile does not exist upstream. MariaDB 10.11.11-6.fc42.x86_64 work where the same manual optimization is present.

Quoted 45 lines
Quoted 45 lines
Quoted 45 lines
Quoted 45 lines
Quoted 29 lines
Quoted 29 lines
Quoted 29 lines
Quoted 29 lines
Quoted 29 lines
Quoted 29 lines
+---
+ strings/ctype.c | 16 ----------------

+ 1 file changed, 16 deletions(-)

meta-oe/recipes-dbs/mysql/mariadb.inc +26 -0
+
+diff --git a/strings/ctype.c b/strings/ctype.c
+index 629514e5e9c..d7e788c693b 100644
+--- a/strings/ctype.c
++++ b/strings/ctype.c
+@@ -1243,22 +1243,6 @@ my_convert(char *to, uint32 to_length, CHARSET_INFO *to_cs,
+
+   length= length2= MY_MIN(to_length, from_length);
+
+-#if defined(__i386__) || defined(__x86_64__)
+-  /*
+-    Special loop for i386, it allows to refer to a
+-    non-aligned memory block as UINT32, which makes
+-    it possible to copy four bytes at once. This
+-    gives about 10% performance improvement comparing
+-    to byte-by-byte loop.
+-  */
+-  for ( ; length >= 4; length-= 4, from+= 4, to+= 4)
+-  {
+-    if ((*(uint32*)from) & 0x80808080)
+-      break;
+-    *((uint32*) to)= *((const uint32*) from);
+-  }
+-#endif /* __i386__ */
+-
+   for (; ; *to++= *from++, length--)
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

+   {
+     if (!length)
+--
+2.51.0
+

Signature · 1 line
2.51.0

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#120159): https://lists.openembedded.org/g/openembedded-devel/message/120159
Mute This Topic: https://lists.openembedded.org/mt/115529034/6084445
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#14 lore raw
Quoted 2 lines

Do you mean to mention these in the commit message,
or in the patch, or both? Just so I would have to resend it once.

I would mention at least in the commit message part
of 0001-Remove-x86-specific-loop-in-my_convert.patch (but I think it's impossible to mention it at too many places).

Quoted 6 lines

FWIW, Fedora 42 has a GCC 15.2.1 snapshot with a date 20250808 (a lot of commits were merged after tagging the 15.2 release that day) but the commit ID in the specfile does not exist upstream. MariaDB 10.11.11-6.fc42.x86_64 work where the same manual optimization is present.

#15 lore raw
In reply to Böszörményi Zoltán
Quoted 218 lines · Böszörményi Zoltán

2025. 10. 02. 10:00 keltezéssel, Gyorgy Sarvari írta:

Quoted 208 lines · Böszörményi Zoltán
Quoted 207 lines

2025. 10. 02. 9:39 keltezéssel, Gyorgy Sarvari írta:

Quoted 196 lines · Zoltan Boszormenyi via lists.openembedded.org
Quoted 182 lines

2025. 10. 02. 7:37 keltezéssel, Zoltan Boszormenyi via lists.openembedded.org írta:

Quoted 159 lines

2025. 10. 02. 6:59 keltezéssel, Zoltan Boszormenyi via lists.openembedded.org írta:

Quoted 158 lines

2025. 10. 02. 6:28 keltezéssel, Khem Raj írta:

Quoted 157 lines · Böszörményi Zoltán
Quoted 147 lines

2025. 10. 01. 18:53 keltezéssel, Khem Raj írta:

Quoted 123 lines · Zoltán Böszörményi
Quoted 122 lines

In some cases (most notably when running mysqldump), the server crashes in the my_convert() function, in a code protected by

      #if defined(__i386__) || defined(__x86_64__)
      ...
      #endif

The crash does not happen with the generic code. Remove the x86[-64] specific optimization.

---
     meta-oe/recipes-dbs/mysql/mariadb.inc         |  1 +
     ...move-x86-specific-loop-in-my_convert.patch | 89 +++++++++++++++++++
     2 files changed, 90 insertions(+)
     create mode 100644

meta-oe/recipes-dbs/mysql/mariadb/0001-Remove-x86-specific-loop-in-my_convert.patch

meta-oe/recipes-dbs/mysql/mariadb.inc +1 -0
index 13e55ebacd..67dd687c02 100644
@@ -24,6 +24,7 @@ SRC_URI = "https://archive.mariadb.org/${BP}/source/${BP}.tar.gz \
 file://0001-Add-missing-includes-cstdint-and-cstdio.patch \
 file://0001-Ensure-compatibility-with-ARMv9-by-updating-.arch-di.patch \
                file://riscv32.patch \
+ file://0001-Remove-x86-specific-loop-in-my_convert.patch \
               "
     SRC_URI[sha256sum] =

"1b26c0bb2d025dbfac3b9852d2b7eafda56a171b67ac2e27831ec0414fb7df07"

diff --git a/meta-oe/recipes-dbs/mysql/mariadb/0001-Remove-x86-specific-loop-in-my_convert.patch b/meta-oe/recipes-dbs/mysql/mariadb/0001-Remove-x86-specific-loop-in-my_convert.patch new file mode 100644
index 0000000000..26ba08865a
--- /dev/null
+++
b/meta-oe/recipes-dbs/mysql/mariadb/0001-Remove-x86-specific-loop-in-my_convert.patch

meta-oe/recipes-dbs/mysql/mariadb.inc +13 -0
@@ -0,0 +1,89 @@
+From 79d2a95391abc133e86688696ae21628b7035b2d Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Zolt=C3=A1n=20B=C3=B6sz=C3=B6rm=C3=A9nyi?=
+ <[email protected]>
+Date: Wed, 1 Oct 2025 09:29:04 +0200
+Subject: [PATCH] Remove x86 specific loop in my_convert()
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+mysqldump/mariadb-dump crashes with this backtrace:
+
+| (gdb) bt
+| #0  my_convert (to=<optimized out>, to_length=160, to_cs=0x55b5740fbda0

<my_charset_utf8mb4_general_ci>, from=<optimized out>, from_length=40,
+| from_cs=0x55b57408bda0 <my_charset_utf8mb3_unicode_ci>,
errors=0x7f950c35cd6c) at /usr/src/debug/mariadb/11.8.3/strings/ctype.c:1256 +| #1 0x000055b572d9f4a0 in copy_and_convert (to=0x7f94fc00c9db "Configuratiogicate_log\020automagicate_log\017is_done_message\017is_done_message",
+| to_length=<optimized out>, to_cs=<optimized out>, from=0x7f94fc059f37
"Configuration downloading from portal...", from_length=40, from_cs=<optimized out>,

+|     errors=0x7f950c35cd6c) at /usr/src/debug/mariadb/11.8.3/sql/sql_string.h:53
+| #2  Protocol::net_store_data_cs (this=0x7f94fc001260, from=0x7f94fc059f37
"Configuration downloading from portal...", length=40, from_cs=<optimized out>,
+|     to_cs=<optimized out>) at /usr/src/debug/mariadb/11.8.3/sql/protocol.cc:114
+| #3  0x000055b572da103f in Protocol::send_result_set_row
(this=this@entry=0x7f94fc001260, row_items=row_items@entry=0x7f94fc013418)
+|     at /usr/src/debug/mariadb/11.8.3/sql/protocol.cc:1359
+| #4  0x000055b572e19442 in select_send::send_data (this=0x7f94fc014f78,
items=...) at /usr/src/debug/mariadb/11.8.3/sql/sql_class.cc:3294
+| #5  0x000055b572ef7c69 in select_result_sink::send_data_with_check (u=<optimized
out>, sent=<optimized out>, this=<optimized out>, items=...)
+|     at /usr/src/debug/mariadb/11.8.3/sql/sql_class.h:6264
+| #6  select_result_sink::send_data_with_check (this=<optimized out>, items=...,
u=<optimized out>, sent=<optimized out>)
+|     at /usr/src/debug/mariadb/11.8.3/sql/sql_class.h:6254
+| #7  end_send (join=<optimized out>, join_tab=<optimized out>,

end_of_records=<optimized out>) at /usr/src/debug/mariadb/11.8.3/sql/sql_select.cc:25629
+| #8 0x000055b572ec38b6 in evaluate_join_record (join=join@entry=0x7f94fc014fa0, join_tab=join_tab@entry=0x7f94fc016940, error=error@entry=0)

+|     at /usr/src/debug/mariadb/11.8.3/sql/sql_select.cc:24523
+| #9  0x000055b572edcbf2 in sub_select (join=0x7f94fc014fa0,

join_tab=0x7f94fc016940, end_of_records=<optimized out>)
+| at /usr/src/debug/mariadb/11.8.3/sql/sql_select.cc:24290
+| #10 0x000055b572f119c6 in do_select (join=0x7f94fc014fa0, procedure=<optimized out>) at /usr/src/debug/mariadb/11.8.3/sql/sql_select.cc:23801
+| #11 JOIN::exec_inner (this=this@entry=0x7f94fc014fa0) at /usr/src/debug/mariadb/11.8.3/sql/sql_select.cc:5071
+| #12 0x000055b572f11d43 in JOIN::exec (this=this@entry=0x7f94fc014fa0) at /usr/src/debug/mariadb/11.8.3/sql/sql_select.cc:4859
+| #13 0x000055b572f0ffe6 in mysql_select (thd=thd@entry=0x7f94fc000cd8, tables=0x7f94fc013f38, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0,
+| proc_param=0x0, select_options=551922436864, result=0x7f94fc014f78,
unit=0x7f94fc005038, select_lex=0x7f94fc013160)
+| at /usr/src/debug/mariadb/11.8.3/sql/sql_select.cc:5387
+| #14 0x000055b572f107dd in handle_select (thd=thd@entry=0x7f94fc000cd8, lex=lex@entry=0x7f94fc004f58, result=result@entry=0x7f94fc014f78,
+| setup_tables_done_option=setup_tables_done_option@entry=0) at /usr/src/debug/mariadb/11.8.3/sql/sql_select.cc:633
+| #15 0x000055b572e77d9e in execute_sqlcom_select (thd=thd@entry=0x7f94fc000cd8, all_tables=0x7f94fc013f38) at /usr/src/debug/mariadb/11.8.3/sql/sql_parse.cc:6190 +| #16 0x000055b572e877be in mysql_execute_command (thd=thd@entry=0x7f94fc000cd8, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false)
+| at /usr/src/debug/mariadb/11.8.3/sql/sql_parse.cc:3975
+| #17 0x000055b572e88e03 in mysql_parse (thd=0x7f94fc000cd8, rawbuf=<optimized out>, length=<optimized out>, parser_state=<optimized out>)
+| at /usr/src/debug/mariadb/11.8.3/sql/sql_parse.cc:7905
+| #18 0x000055b572e8b2a1 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x7f94fc000cd8, packet=packet@entry=0x7f94fc0088a9 "",
+| packet_length=packet_length@entry=152, blocking=blocking@entry=true) at
/usr/src/debug/mariadb/11.8.3/sql/sql_parse.cc:1903
+| #19 0x000055b572e8cf7c in do_command (thd=thd@entry=0x7f94fc000cd8, blocking=blocking@entry=true) at /usr/src/debug/mariadb/11.8.3/sql/sql_parse.cc:1416 +| #20 0x000055b572fcfc0d in do_handle_one_connection (connect=<optimized out>, put_in_cache=true) at /usr/src/debug/mariadb/11.8.3/sql/sql_connect.cc:1415 +| #21 0x000055b572fcffc5 in handle_one_connection (arg=arg@entry=0x55b57943cbd8) at /usr/src/debug/mariadb/11.8.3/sql/sql_connect.cc:1327
+| #22 0x000055b573382440 in pfs_spawn_thread (arg=0x55b5795eb598) at /usr/src/debug/mariadb/11.8.3/storage/perfschema/pfs.cc:2198

Quoted 8 lines

meta-oe/recipes-dbs/mysql/mariadb.inc

Quoted 7 lines

+| #23 0x00007f952e8571dd in start_thread (arg=<optimized out>) at pthread_create.c:448
+| #24 0x00007f952e8d318c in __GI___clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78

meta-oe/recipes-dbs/mysql/mariadb.inc +3 -0
+
+Signed-off-by: Zoltán Böszörményi <[email protected]>
+Upstream-Status: Inappropriate [oe specific]

This seems to be not OE specific, how does it manifest just in OE ?

No idea.

According to the backtrace, it's a crash in the conversion from utf8mb3 to utf8mb4. As such, it may be an unaligned access, likely brought forth by GCC 15. A better fix may be to check the pointer value alignment and only run the optimized code if data pointed by both pointers have 4 byte alignment.

FWIW, we have a special upgrade procedure on several oe builds to carry over crucial data, including the database which may have been created with an old database version using the "utf8" charset, which defaulted to "utf8mb3" in MariaDB a few releases ago. IIRC, that default has changed, or just the recommendation was that "utf8mb4" should be used explicitly.

Quoted 6 lines

I am using meta-intel and MACHINE="intel-corei7-64" for a long time.

The crash can be _randomly_ reproduced with oe master and MariaDB 11.4.6, 11.4.8 and 11.8.3 LTS versions but the "special loop for i386" code is also in the 10.11.x and we haven't seen a crash with older Yocto versions. ¯\_(ツ)_/¯

Well, it will result in performance regression in character conversion routines for x86. while it is making things work this definitely should be informed upstream

Quoted 6 lines
Quoted 5 lines

https://jira.mariadb.org/browse/MDEV-37786

Quoted 2 lines

On OE side, can you check if DEFAULTTUNE has changed between working and non-working builds ?

I will check that.

DEFAULTTUNE="corei7-64" in all cases.

I also looked at the compiler flags.
Besides the -fcanon-prefix-map/-fmacro-prefix-map/-fdebug-prefix-map => -ffile-prefix-map change, there are no other changes in compiler flags from Yocto 5.2 to current master.

One thing that MariaDB > 11.4.6 brings in is adding -Wframe-larger-than=16384 when not built with any sanitizers. This is the commit in mariadb-server:

Author: Daniel Black <[email protected]>
Date:   Thu May 29 11:28:15 2025 +1000

MDEV-34388: Stack overflow on Alpine Linux (postfix) - sanitizers

Remove stack limits for sanitizers. Other tests cover them.

Quoted 7 lines

There's also the removal of -fuse-ld=bfd from Yocto 5.1 to 5.2.

None of these seem relevant.

The fact that the same MariaDB 11.4.6 version is in Yocto 5.2 (where it works) and current Yocto master (where it doesn't) says that the difference is only the compiler version.

Looks like others have seen this too with gcc15 and 16, outside of OE. E.g. Gentoo[1] worked around it by passing "-fno-tree-vectorize" compiler flag.
(Of course if it's random to reproduce, than it's harder to verify if it works for OE too)

Quoted 1 line

[1]: https://bugs.gentoo.org/959423

Nice.

My bug report was commented on in the meantime,
removing the manual optimization was endorsed.

It also has a "duplicates" link to
https://jira.mariadb.org/browse/MDEV-37148
where the problem is elaborated more in depth.

Quoted 7 lines
Quoted 2 lines

So, what to do with this patch?
Should I re-send with "Upstream-Status: Pending"?

I think "Inappropriate" status would be okay (it has a secondary meaning beside oe-specific, for cases like this, when it is handled with a bug report), but it would be good to mention both your bug, where your patch is endorsed by upstream and the linked duplicate also that we can check to see when your patch can be dropped.

Quoted 8 lines

Do you mean to mention these in the commit message,
or in the patch, or both? Just so I would have to resend it once.

FWIW, Fedora 42 has a GCC 15.2.1 snapshot with a date 20250808 (a lot of commits were merged after tagging the 15.2 release that day) but the commit ID in the specfile does not exist upstream. MariaDB 10.11.11-6.fc42.x86_64 work where the same manual optimization is present.

Its likely that commandline options that Fedora uses are different than OE e.g. LTO can change behavior
and there is a possibility of backport that fedora might have which OE is yet to get.
either for mariadb or for gcc.

Quoted 47 lines
Quoted 46 lines
Quoted 46 lines
Quoted 46 lines
Quoted 46 lines
Quoted 30 lines
Quoted 30 lines
Quoted 30 lines
Quoted 30 lines
Quoted 30 lines
Quoted 30 lines
+---
+ strings/ctype.c | 16 ----------------

+ 1 file changed, 16 deletions(-)

meta-oe/recipes-dbs/mysql/mariadb.inc +26 -0
+
+diff --git a/strings/ctype.c b/strings/ctype.c
+index 629514e5e9c..d7e788c693b 100644
+--- a/strings/ctype.c
++++ b/strings/ctype.c
+@@ -1243,22 +1243,6 @@ my_convert(char *to, uint32 to_length, CHARSET_INFO *to_cs,
+
+   length= length2= MY_MIN(to_length, from_length);
+
+-#if defined(__i386__) || defined(__x86_64__)
+-  /*
+-    Special loop for i386, it allows to refer to a
+-    non-aligned memory block as UINT32, which makes
+-    it possible to copy four bytes at once. This
+-    gives about 10% performance improvement comparing
+-    to byte-by-byte loop.
+-  */
+-  for ( ; length >= 4; length-= 4, from+= 4, to+= 4)
+-  {
+-    if ((*(uint32*)from) & 0x80808080)
+-      break;
+-    *((uint32*) to)= *((const uint32*) from);
+-  }
+-#endif /* __i386__ */
+-
+   for (; ; *to++= *from++, length--)
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
meta-oe/recipes-dbs/mysql/mariadb.inc +5 -1
+   {
+     if (!length)
+--
+2.51.0
+
--

2.51.0

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#120159): https://lists.openembedded.org/g/openembedded-devel/message/120159
Mute This Topic: https://lists.openembedded.org/mt/115529034/6084445
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-