MDEV-36482: Make libaio work WITH_MSAN=ON

As noted in commit c36834c832
the MemorySanitizer instrumented builds so far only work with
the synchronous I/O interface (innodb_use_native_aio=OFF).

It is not that hard to make WITH_MSAN=ON work with the
Linux libaio, without even instrumenting that library itself.

aio_linux::getevent_thread_routine(): Declare the buffer that
is returned by my_getevents() as initialized.  Declare
the data returned by a successful aio_opcode::AIO_PREAD as initialized.

Reviewed by: Daniel Black
This commit is contained in:
Marko Mäkelä
2025-06-26 10:05:36 +03:00
parent e706324205
commit 3c67d73aad

View File

@ -15,6 +15,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 - 1301 USA*/
#include "tpool_structs.h"
#include "tpool.h"
#include "my_valgrind.h"
# include <thread>
# include <atomic>
@ -117,6 +118,9 @@ class aio_linux final : public aio
abort();
goto end;
}
#if __has_feature(memory_sanitizer)
MEM_MAKE_DEFINED(events, ret * sizeof *events);
#endif
for (int i= 0; i < ret; i++)
{
const io_event &event= events[i];
@ -128,6 +132,10 @@ class aio_linux final : public aio
}
else
{
#if __has_feature(memory_sanitizer)
if (iocb->m_opcode == aio_opcode::AIO_PREAD)
MEM_MAKE_DEFINED(iocb->m_buffer, event.res);
#endif
iocb->m_ret_len= event.res;
iocb->m_err= 0;
finish_synchronous(iocb);