• Marko Mäkelä's avatar
    MDEV-17092 use-after-poison around lock_trx_handle_wait_low · 5530a93f
    Marko Mäkelä authored
    There was a race condition where the connection of the
    victim of a KILL statement is disconnected while the
    KILL statement is executing.
    
    As a side effect of this fix, we will make XA PREPARE
    transactions immune to KILL statements.
    
    Starting with MariaDB 10.2, we have a pool of trx_t objects.
    trx_free() would only free memory to the pool. We poison the
    contents of freed objects in the pool in order to catch misuse.
    
    trx_free(): Unpoison also trx->mysql_thd and trx->state.
    This is to counter the poisoning of *trx in trx_pools->mem_free().
    Unpoison only on AddressSanitizer or Valgrind, but not on MemorySanitizer.
    
    Pool: Unpoison allocated objects only on AddressSanitizer or
    Valgrind, but not on MemorySanitizer.
    
    innobase_kill_query(): Properly protect trx, acquiring also
    trx_sys_t::mutex and checking trx_t::mysql_thd and trx_t::state.
    5530a93f
ut0pool.h 8.25 KB