Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Cannot Reproduce
-
10.5, 10.2(EOL), 10.3(EOL), 10.4(EOL)
-
None
Description
Note: the test case is very similar to MDEV-18414, the only difference is a constant instead of a column in WHERE clause. However, since the location of the ASAN failure is different, I'm filing it separately in case the root cause is not the same.
--source include/have_partition.inc
|
|
CREATE TABLE t1 ( |
pk INT PRIMARY KEY, |
b BLOB,
|
vb TEXT AS (b) VIRTUAL, |
d INT, |
vd INT AS (d), |
KEY(d) |
) PARTITION BY KEY() PARTITIONS 6; |
|
INSERT IGNORE INTO t1 (pk,b,d) VALUES |
(1,'1',0),(2,'2',1),(3,'3',2),(4,'4',3),(5,'5',4),(6,'6',5), |
(7,'7',6),(8,NULL,NULL),(9,'8',7),(10,NULL,8); |
|
SELECT * FROM t1 WHERE vb != 'foo' AND d > 0 ORDER BY vd; |
|
# Cleanup
|
DROP TABLE t1; |
10.2 ASAN b8aef872 |
==12275==ERROR: AddressSanitizer: heap-use-after-free on address 0x60c000027a70 at pc 0x55b956334db2 bp 0x7fba36490530 sp 0x7fba36490528
|
READ of size 1 at 0x60c000027a70 thread T5
|
#0 0x55b956334db1 in my_strnncollsp_simple /data/src/10.2/strings/ctype-simple.c:182
|
#1 0x55b954e3abce in sortcmp(String const*, String const*, charset_info_st const*) /data/src/10.2/sql/sql_string.cc:804
|
#2 0x55b9552f1c7d in Arg_comparator::compare_string() /data/src/10.2/sql/item_cmpfunc.cc:816
|
#3 0x55b95532cdba in Arg_comparator::compare() /data/src/10.2/sql/item_cmpfunc.h:87
|
#4 0x55b9552fd13f in Item_func_ne::val_int() /data/src/10.2/sql/item_cmpfunc.cc:1805
|
#5 0x55b955281932 in Item::val_bool() /data/src/10.2/sql/item.cc:112
|
#6 0x55b95531b8cc in Item_cond_and::val_int() /data/src/10.2/sql/item_cmpfunc.cc:5048
|
#7 0x55b954ec1f08 in SQL_SELECT::skip_record(THD*) /data/src/10.2/sql/opt_range.h:1632
|
#8 0x55b955242c31 in find_all_keys /data/src/10.2/sql/filesort.cc:835
|
#9 0x55b95523f045 in filesort(THD*, TABLE*, Filesort*, Filesort_tracker*, JOIN*, unsigned long long) /data/src/10.2/sql/filesort.cc:279
|
#10 0x55b954d84ba8 in create_sort_index(THD*, JOIN*, st_join_table*, Filesort*) /data/src/10.2/sql/sql_select.cc:21913
|
#11 0x55b954d75d78 in st_join_table::sort_table() /data/src/10.2/sql/sql_select.cc:19729
|
#12 0x55b954d75396 in join_init_read_record(st_join_table*) /data/src/10.2/sql/sql_select.cc:19670
|
#13 0x55b954d6eac7 in sub_select(JOIN*, st_join_table*, bool) /data/src/10.2/sql/sql_select.cc:18761
|
#14 0x55b954d6cfd2 in do_select /data/src/10.2/sql/sql_select.cc:18308
|
#15 0x55b954d0d208 in JOIN::exec_inner() /data/src/10.2/sql/sql_select.cc:3623
|
#16 0x55b954d0ae9d in JOIN::exec() /data/src/10.2/sql/sql_select.cc:3418
|
#17 0x55b954d0e285 in mysql_select(THD*, TABLE_LIST*, unsigned int, List<Item>&, Item*, unsigned int, st_order*, st_order*, Item*, st_order*, unsigned long long, select_result*, st_select_lex_unit*, st_select_lex*) /data/src/10.2/sql/sql_select.cc:3818
|
#18 0x55b954ced260 in handle_select(THD*, LEX*, select_result*, unsigned long) /data/src/10.2/sql/sql_select.cc:376
|
#19 0x55b954c6fed2 in execute_sqlcom_select /data/src/10.2/sql/sql_parse.cc:6481
|
#20 0x55b954c5cbbb in mysql_execute_command(THD*) /data/src/10.2/sql/sql_parse.cc:3487
|
#21 0x55b954c78bbd in mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool) /data/src/10.2/sql/sql_parse.cc:8015
|
#22 0x55b954c535aa in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool) /data/src/10.2/sql/sql_parse.cc:1826
|
#23 0x55b954c5063f in do_command(THD*) /data/src/10.2/sql/sql_parse.cc:1379
|
#24 0x55b954f97034 in do_handle_one_connection(CONNECT*) /data/src/10.2/sql/sql_connect.cc:1335
|
#25 0x55b954f96a49 in handle_one_connection /data/src/10.2/sql/sql_connect.cc:1241
|
#26 0x55b9559b40db in pfs_spawn_thread /data/src/10.2/storage/perfschema/pfs.cc:1862
|
#27 0x7fba42906493 in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x7493)
|
#28 0x7fba40cec93e in __clone (/lib/x86_64-linux-gnu/libc.so.6+0xe893e)
|
|
0x60c000027a70 is located 112 bytes inside of 124-byte region [0x60c000027a00,0x60c000027a7c)
|
freed by thread T5 here:
|
#0 0x7fba42b70527 in __interceptor_free (/usr/lib/x86_64-linux-gnu/libasan.so.1+0x54527)
|
#1 0x55b9562d5043 in free_memory /data/src/10.2/mysys/safemalloc.c:279
|
#2 0x55b9562d4649 in sf_free /data/src/10.2/mysys/safemalloc.c:197
|
#3 0x55b9562a38d8 in my_free /data/src/10.2/mysys/my_malloc.c:217
|
#4 0x55b954a6f7f7 in String::free() /data/src/10.2/sql/sql_string.h:351
|
#5 0x55b954aaeebe in String::set(char const*, unsigned int, charset_info_st const*) /data/src/10.2/sql/sql_string.h:274
|
#6 0x55b95520fcdb in Field_blob::val_str(String*, String*) /data/src/10.2/sql/field.cc:8128
|
#7 0x55b954a92c1f in Field::val_str(String*) /data/src/10.2/sql/field.h:866
|
#8 0x55b95522ea7c in Field_blob::store_field(Field*) (/data/bld/10.2-asan/bin/mysqld+0x1254a7c)
|
#9 0x55b95523cb2d in field_conv_incompatible /data/src/10.2/sql/field_conv.cc:831
|
#10 0x55b95523cbca in field_conv(Field*, Field*) /data/src/10.2/sql/field_conv.cc:844
|
#11 0x55b9552b00c8 in save_field_in_field /data/src/10.2/sql/item.cc:6257
|
#12 0x55b9552b05c4 in Item_field::save_in_field(Field*, bool) /data/src/10.2/sql/item.cc:6303
|
#13 0x55b954f0abac in TABLE::update_virtual_fields(handler*, enum_vcol_update_mode) /data/src/10.2/sql/table.cc:7640
|
#14 0x55b95525f73c in handler::ha_index_read_map(unsigned char*, unsigned char const*, unsigned long, ha_rkey_function) /data/src/10.2/sql/handler.cc:2684
|
#15 0x55b955270868 in handler::read_range_first(st_key_range const*, st_key_range const*, bool, bool) /data/src/10.2/sql/handler.cc:5378
|
#16 0x55b956223291 in ha_partition::handle_ordered_index_scan(unsigned char*, bool) /data/src/10.2/sql/ha_partition.cc:6181
|
#17 0x55b95621f24c in ha_partition::common_index_read(unsigned char*, bool) /data/src/10.2/sql/ha_partition.cc:5527
|
#18 0x55b956220a6d in ha_partition::read_range_first(st_key_range const*, st_key_range const*, bool, bool) /data/src/10.2/sql/ha_partition.cc:5810
|
#19 0x55b955033dd8 in handler::multi_range_read_next(void**) /data/src/10.2/sql/multi_range_read.cc:303
|
#20 0x55b9555ae616 in QUICK_RANGE_SELECT::get_next() /data/src/10.2/sql/opt_range.cc:11445
|
#21 0x55b9552426e6 in find_all_keys /data/src/10.2/sql/filesort.cc:781
|
#22 0x55b95523f045 in filesort(THD*, TABLE*, Filesort*, Filesort_tracker*, JOIN*, unsigned long long) /data/src/10.2/sql/filesort.cc:279
|
#23 0x55b954d84ba8 in create_sort_index(THD*, JOIN*, st_join_table*, Filesort*) /data/src/10.2/sql/sql_select.cc:21913
|
#24 0x55b954d75d78 in st_join_table::sort_table() /data/src/10.2/sql/sql_select.cc:19729
|
#25 0x55b954d75396 in join_init_read_record(st_join_table*) /data/src/10.2/sql/sql_select.cc:19670
|
#26 0x55b954d6eac7 in sub_select(JOIN*, st_join_table*, bool) /data/src/10.2/sql/sql_select.cc:18761
|
#27 0x55b954d6cfd2 in do_select /data/src/10.2/sql/sql_select.cc:18308
|
#28 0x55b954d0d208 in JOIN::exec_inner() /data/src/10.2/sql/sql_select.cc:3623
|
#29 0x55b954d0ae9d in JOIN::exec() /data/src/10.2/sql/sql_select.cc:3418
|
|
previously allocated by thread T5 here:
|
#0 0x7fba42b7073f in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.1+0x5473f)
|
#1 0x55b9562d3db9 in sf_malloc /data/src/10.2/mysys/safemalloc.c:118
|
#2 0x55b9562a3010 in my_malloc /data/src/10.2/mysys/my_malloc.c:101
|
#3 0x55b954e3568b in String::realloc_raw(unsigned long) /data/src/10.2/sql/sql_string.cc:102
|
#4 0x55b954a6f91e in String::realloc(unsigned long) /data/src/10.2/sql/sql_string.h:367
|
#5 0x55b954e35f6b in String::copy() /data/src/10.2/sql/sql_string.cc:158
|
#6 0x55b95522eb85 in Field_blob::store_field(Field*) (/data/bld/10.2-asan/bin/mysqld+0x1254b85)
|
#7 0x55b95523cb2d in field_conv_incompatible /data/src/10.2/sql/field_conv.cc:831
|
#8 0x55b95523cbca in field_conv(Field*, Field*) /data/src/10.2/sql/field_conv.cc:844
|
#9 0x55b9552b00c8 in save_field_in_field /data/src/10.2/sql/item.cc:6257
|
#10 0x55b9552b05c4 in Item_field::save_in_field(Field*, bool) /data/src/10.2/sql/item.cc:6303
|
#11 0x55b954f0abac in TABLE::update_virtual_fields(handler*, enum_vcol_update_mode) /data/src/10.2/sql/table.cc:7640
|
#12 0x55b95525f73c in handler::ha_index_read_map(unsigned char*, unsigned char const*, unsigned long, ha_rkey_function) /data/src/10.2/sql/handler.cc:2684
|
#13 0x55b955270868 in handler::read_range_first(st_key_range const*, st_key_range const*, bool, bool) /data/src/10.2/sql/handler.cc:5378
|
#14 0x55b956223291 in ha_partition::handle_ordered_index_scan(unsigned char*, bool) /data/src/10.2/sql/ha_partition.cc:6181
|
#15 0x55b95621f24c in ha_partition::common_index_read(unsigned char*, bool) /data/src/10.2/sql/ha_partition.cc:5527
|
#16 0x55b956220a6d in ha_partition::read_range_first(st_key_range const*, st_key_range const*, bool, bool) /data/src/10.2/sql/ha_partition.cc:5810
|
#17 0x55b955033dd8 in handler::multi_range_read_next(void**) /data/src/10.2/sql/multi_range_read.cc:303
|
#18 0x55b9555ae616 in QUICK_RANGE_SELECT::get_next() /data/src/10.2/sql/opt_range.cc:11445
|
#19 0x55b9552426e6 in find_all_keys /data/src/10.2/sql/filesort.cc:781
|
#20 0x55b95523f045 in filesort(THD*, TABLE*, Filesort*, Filesort_tracker*, JOIN*, unsigned long long) /data/src/10.2/sql/filesort.cc:279
|
#21 0x55b954d84ba8 in create_sort_index(THD*, JOIN*, st_join_table*, Filesort*) /data/src/10.2/sql/sql_select.cc:21913
|
#22 0x55b954d75d78 in st_join_table::sort_table() /data/src/10.2/sql/sql_select.cc:19729
|
#23 0x55b954d75396 in join_init_read_record(st_join_table*) /data/src/10.2/sql/sql_select.cc:19670
|
#24 0x55b954d6eac7 in sub_select(JOIN*, st_join_table*, bool) /data/src/10.2/sql/sql_select.cc:18761
|
#25 0x55b954d6cfd2 in do_select /data/src/10.2/sql/sql_select.cc:18308
|
#26 0x55b954d0d208 in JOIN::exec_inner() /data/src/10.2/sql/sql_select.cc:3623
|
#27 0x55b954d0ae9d in JOIN::exec() /data/src/10.2/sql/sql_select.cc:3418
|
#28 0x55b954d0e285 in mysql_select(THD*, TABLE_LIST*, unsigned int, List<Item>&, Item*, unsigned int, st_order*, st_order*, Item*, st_order*, unsigned long long, select_result*, st_select_lex_unit*, st_select_lex*) /data/src/10.2/sql/sql_select.cc:3818
|
#29 0x55b954ced260 in handle_select(THD*, LEX*, select_result*, unsigned long) /data/src/10.2/sql/sql_select.cc:376
|
|
Thread T5 created by T0 here:
|
#0 0x7fba42b3fbba in pthread_create (/usr/lib/x86_64-linux-gnu/libasan.so.1+0x23bba)
|
#1 0x55b9559b46a3 in spawn_thread_v1 /data/src/10.2/storage/perfschema/pfs.cc:1912
|
#2 0x55b954a4ce7e in inline_mysql_thread_create /data/src/10.2/include/mysql/psi/mysql_thread.h:1239
|
#3 0x55b954a61e1b in create_thread_to_handle_connection(CONNECT*) /data/src/10.2/sql/mysqld.cc:6466
|
#4 0x55b954a62520 in create_new_thread /data/src/10.2/sql/mysqld.cc:6536
|
#5 0x55b954a63537 in handle_connections_sockets() /data/src/10.2/sql/mysqld.cc:6811
|
#6 0x55b954a61370 in mysqld_main(int, char**) /data/src/10.2/sql/mysqld.cc:6085
|
#7 0x55b954a4b21f in main /data/src/10.2/sql/main.cc:25
|
#8 0x7fba40c242b0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202b0)
|
|
SUMMARY: AddressSanitizer: heap-use-after-free /data/src/10.2/strings/ctype-simple.c:182 my_strnncollsp_simple
|
Shadow bytes around the buggy address:
|
0x0c187fffcef0: fa fa fa fa fa fa fa fa 00 00 00 00 00 00 00 00
|
0x0c187fffcf00: 00 00 00 00 00 00 00 04 fa fa fa fa fa fa fa fa
|
0x0c187fffcf10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 04
|
0x0c187fffcf20: fa fa fa fa fa fa fa fa fd fd fd fd fd fd fd fd
|
0x0c187fffcf30: fd fd fd fd fd fd fd fd fa fa fa fa fa fa fa fa
|
=>0x0c187fffcf40: fd fd fd fd fd fd fd fd fd fd fd fd fd fd[fd]fd
|
0x0c187fffcf50: fa fa fa fa fa fa fa fa fd fd fd fd fd fd fd fd
|
0x0c187fffcf60: fd fd fd fd fd fd fd fd fa fa fa fa fa fa fa fa
|
0x0c187fffcf70: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
|
0x0c187fffcf80: fa fa fa fa fa fa fa fa 00 00 00 00 00 00 00 00
|
0x0c187fffcf90: 00 00 00 00 00 00 00 04 fa fa fa fa fa fa fa fa
|
Shadow byte legend (one shadow byte represents 8 application bytes):
|
Addressable: 00
|
Partially addressable: 01 02 03 04 05 06 07
|
Heap left redzone: fa
|
Heap right redzone: fb
|
Freed heap region: fd
|
Stack left redzone: f1
|
Stack mid redzone: f2
|
Stack right redzone: f3
|
Stack partial redzone: f4
|
Stack after return: f5
|
Stack use after scope: f8
|
Global redzone: f9
|
Global init order: f6
|
Poisoned by user: f7
|
Contiguous container OOB:fc
|
ASan internal: fe
|
==12275==ABORTING
|
Attachments
Issue Links
- relates to
-
MDEV-18414 Server crash or ASAN heap-use-after-free in my_strtod_int / Value_source::Converter_strntod::Converter_strntod
- Closed
-
MDEV-18486 Database crash on a table with indexed virtual column
- Closed
-
MDEV-18667 ASAN heap-use-after-free in make_date_time / Arg_comparator::compare_string / Item_func_nullif::compare
- Closed
-
MDEV-20619 AddressSanitizer: heap-use-after-free in my_strnncollsp_simple or my_strnncoll_binary upon SELECT with partitions and virtual columns
- Closed