[MDEV-15490] XA: ASAN heap-use-after-free or valgrind Invalid write in trx_update_mod_tables_timestamp Created: 2018-03-06 Updated: 2020-02-13 Resolved: 2020-02-13 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Storage Engine - InnoDB, XA |
| Affects Version/s: | 10.2 |
| Fix Version/s: | N/A |
| Type: | Bug | Priority: | Major |
| Reporter: | Elena Stepanova | Assignee: | Sergey Vojtovich |
| Resolution: | Duplicate | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||||||||||||||||||||||||||
| Sprint: | 10.2.14 | ||||||||||||||||||||||||||||
| Description |
|
Variation with binary log enabled:
Could not reproduce on 10.1 or 10.3. |
| Comments |
| Comment by Marko Mäkelä [ 2018-03-07 ] |
|
The problem is that CREATE OR REPLACE TABLE is allowed to proceed to DROP TABLE, even though the XA START 'xid' transaction should hold MDL on the table name. The access to freed memory occurs, because trx_t::mod_tables (which is how InnoDB implements non-persistent update_time in MySQL 5.7.2) would contain a reference to the dropped-and-replaced table t1, and at XA COMMIT we would adjust the update_time of that table. This problem probably affect earlier MariaDB versions as well. It is worth checking what would happen on XA ROLLBACK; it could cause some other trouble. Rollback should generally assume that all tables and records are available and locked. On the other hand, rollback is implemented by table ID, and the table ID would no longer exist. Rollback might be OK with that missing table; at least it is OK when rolling back recovered transactions on server restart. |
| Comment by Marko Mäkelä [ 2018-03-07 ] |
|
This bug shares a root cause with |
| Comment by Marko Mäkelä [ 2018-03-07 ] |
|
|
| Comment by Marko Mäkelä [ 2018-05-11 ] |
|
I decided to revisit the InnoDB part of this because of the reports that InnoDB sometimes accesses a freed trx object ( In 10.3 the access to a freed table seems to have been removed before 10.3.4 already. I was able to repeat with commit acdfacee75141886e15eaee31af0ffe8c49bdf75 (2017-12-20), but I was unable to identify the exact commit that fixed the bug in 10.3. It could be that because mod_tables is also being used for id-based system versioning, something changed in the merge commit 5c0a19c873382c9fec696f827e6766f61c6682af (2017-12-21). An obvious explanation would be |
| Comment by Alice Sherepa [ 2020-02-13 ] |
|
not reproducible anymore/ 10.2 a241d411951f72d6c |