[MDEV-29550] Valgrind/MSAN uninitialised value errors upon SHOW PROCEDURE STATUS with condition on Db Created: 2022-09-15  Updated: 2022-10-13  Resolved: 2022-09-16

Status: Closed
Project: MariaDB Server
Component/s: Server
Affects Version/s: N/A
Fix Version/s: 10.11.0

Type: Bug Priority: Critical
Reporter: Elena Stepanova Assignee: Oleg Smirnov
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Problem/Incident
is caused by MDEV-20609 Full table scan in INFORMATION_SCHEMA... Closed

 Description   

CREATE PROCEDURE p() SELECT 1;
SHOW PROCEDURE STATUS WHERE DB = 'test';
DROP PROCEDURE p;

preview-10.11-mdev20609-is_parameters 7342ba99bc Valgrind

==1922390== Conditional jump or move depends on uninitialised value(s)
==1922390==    at 0x9991C2: Binary_string::c_ptr() (sql_string.h:644)
==1922390==    by 0xBCA2A0: fill_schema_proc(THD*, TABLE_LIST*, Item*) (sql_show.cc:6830)
==1922390==    by 0xBD464A: get_schema_tables_result(JOIN*, enum_schema_table_state) (sql_show.cc:9023)
==1922390==    by 0xB6026C: JOIN::exec_inner() (sql_select.cc:4770)
==1922390==    by 0xB5F5CE: JOIN::exec() (sql_select.cc:4591)
==1922390==    by 0xB60EFF: mysql_select(THD*, TABLE_LIST*, List<Item>&, Item*, unsigned int, st_order*, st_order*, Item*, st_order*, unsigned long long, select_result*, st_select_lex_unit*, st_select_lex*) (sql_select.cc:5071)
==1922390==    by 0xB4FF41: handle_select(THD*, LEX*, select_result*, unsigned long) (sql_select.cc:582)
==1922390==    by 0xAF72CB: execute_sqlcom_select(THD*, TABLE_LIST*) (sql_parse.cc:6261)
==1922390==    by 0xAEE4EB: mysql_execute_command(THD*, bool) (sql_parse.cc:3945)
==1922390==    by 0xAFC0E9: mysql_parse(THD*, char*, unsigned int, Parser_state*) (sql_parse.cc:8037)
==1922390==    by 0xAE85A4: dispatch_command(enum_server_command, THD*, char*, unsigned int, bool) (sql_parse.cc:1894)
==1922390==    by 0xAE6F7D: do_command(THD*, bool) (sql_parse.cc:1407)
==1922390==    by 0xCC872D: do_handle_one_connection(CONNECT*, bool) (sql_connect.cc:1418)
==1922390==    by 0xCC83CC: handle_one_connection (sql_connect.cc:1312)
==1922390==    by 0x11E19D1: pfs_spawn_thread (pfs.cc:2201)
==1922390==    by 0x4CE3EA6: start_thread (pthread_create.c:477)

preview-10.11-mdev20609-is_parameters 7342ba99bc MSAN

==46489==WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0x559da3069812 in Binary_string::c_ptr() /home/jenkins/workspace/Source-Build-Test/src/sql/sql_string.h:644:9
    #1 0x559da3069812 in fill_schema_proc(THD*, TABLE_LIST*, Item*) /home/jenkins/workspace/Source-Build-Test/src/sql/sql_show.cc:6830:29
    #2 0x559da307a2ea in get_schema_tables_result(JOIN*, enum_schema_table_state) /home/jenkins/workspace/Source-Build-Test/src/sql/sql_show.cc:9023:11
    #3 0x559da2f257c9 in JOIN::exec_inner() /home/jenkins/workspace/Source-Build-Test/src/sql/sql_select.cc:4770:7
    #4 0x559da2f22b4c in JOIN::exec() /home/jenkins/workspace/Source-Build-Test/src/sql/sql_select.cc:4591:3
    #5 0x559da2e89e72 in mysql_select(THD*, TABLE_LIST*, List<Item>&, Item*, unsigned int, st_order*, st_order*, Item*, st_order*, unsigned long long, select_result*, st_select_lex_unit*, st_select_lex*) /home/jenkins/workspace/Source-Build-Test/src/sql/sql_select.cc:5071:9
    #6 0x559da2e88bb8 in handle_select(THD*, LEX*, select_result*, unsigned long) /home/jenkins/workspace/Source-Build-Test/src/sql/sql_select.cc:582:10
    #7 0x559da2d5ccec in execute_sqlcom_select(THD*, TABLE_LIST*) /home/jenkins/workspace/Source-Build-Test/src/sql/sql_parse.cc:6261:12
    #8 0x559da2d369f5 in mysql_execute_command(THD*, bool) /home/jenkins/workspace/Source-Build-Test/src/sql/sql_parse.cc:3945:12
    #9 0x559da2d1d877 in mysql_parse(THD*, char*, unsigned int, Parser_state*) /home/jenkins/workspace/Source-Build-Test/src/sql/sql_parse.cc:8037:18
    #10 0x559da2d11c5d in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool) /home/jenkins/workspace/Source-Build-Test/src/sql/sql_parse.cc:1894:7
    #11 0x559da2d1fc6f in do_command(THD*, bool) /home/jenkins/workspace/Source-Build-Test/src/sql/sql_parse.cc:1407:17
    #12 0x559da33b9fc6 in do_handle_one_connection(CONNECT*, bool) /home/jenkins/workspace/Source-Build-Test/src/sql/sql_connect.cc:1418:11
    #13 0x559da33b9515 in handle_one_connection /home/jenkins/workspace/Source-Build-Test/src/sql/sql_connect.cc:1312:5
    #14 0x559da477000a in pfs_spawn_thread /home/jenkins/workspace/Source-Build-Test/src/storage/perfschema/pfs.cc:2201:3
    #15 0x7f9fc1008608 in start_thread /build/glibc-eX1tMB/glibc-2.31/nptl/pthread_create.c:477:8
    #16 0x7f9fc0d0d292 in clone /build/glibc-eX1tMB/glibc-2.31/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:95
 
  Uninitialized value was created by an allocation of 'keybuf' in the stack frame of function '_Z16fill_schema_procP3THDP10TABLE_LISTP4Item'
    #0 0x559da3068010 in fill_schema_proc(THD*, TABLE_LIST*, Item*) /home/jenkins/workspace/Source-Build-Test/src/sql/sql_show.cc:6763

It should have been visible in the new buildbot on MSAN builder.



 Comments   
Comment by Oleg Smirnov [ 2022-09-16 ]

Fixed, the result is pushed to preview-10.11-mdev20609-is_parameters.

Generated at Thu Feb 08 10:09:28 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.