Bug #90691 Overlapping source and destination for memcpy during 5.7 upgrade

Submitted: 30 Apr 2018 11:57 Modified: 11 May 2018 18:02
Reporter: Sivert Sørumgård Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Data Dictionary Severity:S3 (Non-critical)
Version:8.0.11 OS:Any
Assigned to: CPU Architecture:Any

[30 Apr 2018 11:57] Sivert Sørumgård
Description:
With valgrind, upgrade from 5.7 reports overlapping source and destination for a memcpy:

==21151== Source and destination overlap in memcpy(0x15f501f8, 0x15f501f8, 579)
==21151==    at 0x6E5E04C: memcpy@@GLIBC_2.14 (vg_replace_strmem.c:1022)
==21151==    by 0x28D256E: prepare_fields_and_keys(THD*, dd::Table const*, TABLE*, HA_CREATE_INFO*, Alter_info*, Alter_table_ctx*, unsigned int const&) (sql_table.cc:10921)
==21151==    by 0x3A90502: dd::upgrade_57::migrate_table_to_dd(THD*, std::basic_string<char, std::char_traits<char>, Stateless_allocator<char, dd::String_type_alloc, My_free_functor> > const&, std::basic_string<char, std::char_traits<char>, Stateless_allocator<char, dd::String_type_alloc, My_free_functor> > const&, bool) (table.cc:1491)
==21151==    by 0x3A915EC: dd::upgrade_57::migrate_plugin_table_to_dd(THD*) (table.cc:1667)
==21151==    by 0x3A675CA: dd::upgrade_57::do_pre_checks_and_initialize_dd(THD*) (upgrade.cc:1083)
==21151==    by 0x2ABE903: handle_bootstrap (bootstrap.cc:346)
==21151==    by 0x4186CE9: pfs_spawn_thread (pfs.cc:2836)
==21151==    by 0x706DE24: start_thread (in /usr/lib64/libpthread-2.17.so)
==21151==    by 0x8CBE34C: clone (in /usr/lib64/libc-2.17.so)
==21151== 

How to repeat:
Enable main.dd_upgrade_test for valgrind and run the test. Or run main.dd_schema_after_upgrade_debug with valgrind.

Suggested fix:
Call restore_record() (aka memcpy) only if table->record[0] != table->s->default_value in prepare_fields_and_keys().
[11 May 2018 18:02] Daniel Price
Posted by developer:
 
Fixed as of the upcoming 8.0.12 release, and here's the changelog entry:

A source and destination overlap in memcpy Valgrind error was returned
when upgrading from MySQL 5.7.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.037 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.