Skip to content

MDEV-36482: Make liburing work WITH_MSAN=ON (fix)#4257

Merged
dr-m merged 1 commit into
MariaDB:10.6from
grooverdan:MDEV-36482_fix
Aug 25, 2025
Merged

MDEV-36482: Make liburing work WITH_MSAN=ON (fix)#4257
dr-m merged 1 commit into
MariaDB:10.6from
grooverdan:MDEV-36482_fix

Conversation

@grooverdan
Copy link
Copy Markdown
Member

  • The Jira issue number for this PR is: MDEV-36482

Description

The uring_ member of the aio_uring class needed to be defined to make MSAN happy.

To make aio_uring consistent with aio_libaio in the 10.11 branch, added the "using namespace tpool" and removed tpool scoped quantifiers.

10.6 aio_uring is defined in the tpool namespace however changing that would just cause merge conflicts.

Release Notes

nothing;

How can this PR be tested?

msan build + test in container with --privileged:

root@1c914b817918:/build# ldd sql/mariadbd
	linux-vdso.so.1 (0x00007f6632caa000)
	libpcre2-8.so.0 => /msan-libs/libpcre2-8.so.0 (0x00007f662a942000)
	libcrypt.so.1 => /lib/x86_64-linux-gnu/libcrypt.so.1 (0x00007f662a8fe000)
	liburing.so.2 => /lib/x86_64-linux-gnu/liburing.so.2 (0x00007f662a8f6000)
	libnuma.so.1 => /lib/x86_64-linux-gnu/libnuma.so.1 (0x00007f662a8e7000)
	libssl.so.3 => /msan-libs/libssl.so.3 (0x00007f662a723000)
	libcrypto.so.3 => /msan-libs/libcrypto.so.3 (0x00007f662a078000)
	libc++.so.1 => /msan-libs/libc++.so.1 (0x00007f6629de0000)
	libc++abi.so.1 => /msan-libs/libc++abi.so.1 (0x00007f6629d1e000)
	libunwind.so.1 => /lib/x86_64-linux-gnu/libunwind.so.1 (0x00007f6629d10000)
	libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f6629c20000)
	libresolv.so.2 => /lib/x86_64-linux-gnu/libresolv.so.2 (0x00007f6629c0e000)
	libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f6629bdf000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f66299e9000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f6632cac000)
root@1c914b817918:/build# mysql-test/mtr  --suite=innodb 
innodb.alter_algorithm 'INSTANT'         w7 [ pass ]     65
innodb.alter_not_null 'COPY,STRICT'      w1 [ pass ]     85
innodb.alter_algorithm 'NOCOPY'          w8 [ pass ]     77
innodb.alter_not_null 'INPLACE,STRICT'   w5 [ pass ]     77
innodb.alter_not_null 'INPLACE,NON-STRICT' w6 [ pass ]     96
innodb.alter_not_null 'COPY,NON-STRICT'  w4 [ pass ]     96
innodb.alter_algorithm 'INPLACE'         w3 [ pass ]    128
....
root@1c914b817918:/build# grep uring mysql-test/var/1/log/mysqld.1.err
2025-08-25  3:03:17 0 [Note] InnoDB: Using liburing
2025-08-25  3:03:18 0 [Note] InnoDB: Using liburing
2025-08-25  3:03:19 0 [Note] InnoDB: Using liburing
2025-08-25  3:03:22 0 [Note] InnoDB: Using liburing
2025-08-25  3:03:24 0 [Note] InnoDB: Using liburing
2025-08-25  3:03:27 0 [Note] InnoDB: Using liburing
2025-08-25  3:03:29 0 [Note] InnoDB: Using liburing
2025-08-25  3:03:31 0 [Note] InnoDB: Using liburing

revalidation of libaio while I'm here:

root@1c914b817918:/build# ldd sql/mariadbd
	linux-vdso.so.1 (0x00007f6eda63e000)
	libpcre2-8.so.0 => /msan-libs/libpcre2-8.so.0 (0x00007f6ed22d8000)
	libcrypt.so.1 => /lib/x86_64-linux-gnu/libcrypt.so.1 (0x00007f6ed2294000)
	libaio.so.1t64 => /lib/x86_64-linux-gnu/libaio.so.1t64 (0x00007f6ed228f000)
	libnuma.so.1 => /lib/x86_64-linux-gnu/libnuma.so.1 (0x00007f6ed2280000)
	libssl.so.3 => /msan-libs/libssl.so.3 (0x00007f6ed20bc000)
	libcrypto.so.3 => /msan-libs/libcrypto.so.3 (0x00007f6ed1a11000)
	libc++.so.1 => /msan-libs/libc++.so.1 (0x00007f6ed1779000)
	libc++abi.so.1 => /msan-libs/libc++abi.so.1 (0x00007f6ed16b7000)
	libunwind.so.1 => /lib/x86_64-linux-gnu/libunwind.so.1 (0x00007f6ed16a9000)
	libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f6ed15b9000)
	libresolv.so.2 => /lib/x86_64-linux-gnu/libresolv.so.2 (0x00007f6ed15a7000)
	libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f6ed1578000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f6ed1382000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f6eda640000)

root@1c914b817918:/build# mysql-test/mtr  --suite=innodb 
Logging: /source/mysql-test/mariadb-test-run.pl  --suite=innodb

innodb.alter_algorithm 'INSTANT'         w7 [ pass ]     67
innodb.alter_algorithm 'NOCOPY'          w6 [ pass ]     80
innodb.alter_not_null 'INPLACE,STRICT'   w3 [ pass ]     85
innodb.alter_not_null 'COPY,STRICT'      w2 [ pass ]     86
innodb.alter_not_null 'INPLACE,NON-STRICT' w5 [ pass ]     94
innodb.alter_not_null 'COPY,NON-STRICT'  w1 [ pass ]     97
innodb.alter_algorithm 'INPLACE'         w8 [ pass ]    129

root@1c914b817918:/build# grep 'Linux native'  mysql-test/var/1/log/mysqld.1.err
2025-08-25  3:28:47 0 [Note] InnoDB: Using Linux native AIO
2025-08-25  3:28:49 0 [Note] InnoDB: Using Linux native AIO
2025-08-25  3:28:51 0 [Note] InnoDB: Using Linux native AIO
2025-08-25  3:28:54 0 [Note] InnoDB: Using Linux native AIO
2025-08-25  3:28:57 0 [Note] InnoDB: Using Linux native AIO
2025-08-25  3:28:58 0 [Note] InnoDB: Using Linux native AIO

Basing the PR against the correct MariaDB version

  • This is a new feature or a refactoring, and the PR is based against the main branch.
  • This is a bug fix, and the PR is based against the earliest maintained branch in which the bug can be reproduced.

PR quality check

  • I checked the CODING_STANDARDS.md file and my PR conforms to this where appropriate.
  • For any trivial modifications to the PR, I am ok with the reviewer making the changes themselves.

@grooverdan grooverdan requested a review from dr-m August 25, 2025 03:31
@grooverdan grooverdan added the MariaDB Foundation Pull requests created by MariaDB Foundation label Aug 25, 2025
grooverdan added a commit to grooverdan/mariadb-buildbot that referenced this pull request Aug 25, 2025
Until MariaDB/server#4257 is merged
up lets keep the motd slightly conservative.
Comment thread tpool/aio_liburing.cc
Comment on lines +75 to +77
#if __has_feature(memory_sanitizer)
MEM_MAKE_DEFINED(&uring_, sizeof(uring_));
#endif
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reproduced the problem on clang 19 and successfully tested the fix. The patch that I tested also included the following compensation for the addition of using namespace tpool:

@@ -102,7 +106,7 @@ class aio_uring final : public tpool::aio
     io_uring_queue_exit(&uring_);
   }
 
-  int submit_io(tpool::aiocb *cb) final
+  int submit_io(aiocb *cb) final
   {
     cb->iov_base= cb->m_buffer;
     cb->iov_len= cb->m_len;
@@ -112,7 +116,7 @@ class aio_uring final : public tpool::aio
     std::lock_guard<std::mutex> _(mutex_);
 
     io_uring_sqe *sqe= io_uring_get_sqe(&uring_);
-    if (cb->m_opcode == tpool::aio_opcode::AIO_PREAD)
+    if (cb->m_opcode == aio_opcode::AIO_PREAD)
       io_uring_prep_readv(sqe, cb->m_fh, static_cast<struct iovec *>(cb), 1,
                           cb->m_offset);
     else
@@ -159,7 +163,7 @@ class aio_uring final : public tpool::aio
         abort();
       }
 
-      auto *iocb= static_cast<tpool::aiocb*>(io_uring_cqe_get_data(cqe));
+      auto *iocb= static_cast<aiocb*>(io_uring_cqe_get_data(cqe));
       if (!iocb)
         break; // ~aio_uring() told us to terminate
 

The uring_ member of the aio_uring class needed to be
defined to make MSAN happy.

To make aio_uring consistent with aio_libaio in the 10.11 branch,
added the "using namespace tpool" and removed tpool scoped quantifiers.

10.6 aio_uring is defined in the tpool namespace however changing
that would just cause merge conflicts.
@dr-m dr-m merged commit a1bba0e into MariaDB:10.6 Aug 25, 2025
12 of 13 checks passed
@grooverdan grooverdan deleted the MDEV-36482_fix branch August 25, 2025 08:33
grooverdan added a commit to grooverdan/mariadb-buildbot that referenced this pull request Aug 26, 2025
Until MariaDB/server#4257 is merged
up lets keep the motd slightly conservative.
RazvanLiviuVarzaru pushed a commit to MariaDB/buildbot that referenced this pull request Sep 19, 2025
Until MariaDB/server#4257 is merged
up lets keep the motd slightly conservative.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

MariaDB Foundation Pull requests created by MariaDB Foundation

Development

Successfully merging this pull request may close these issues.

2 participants