Bug #87201 XCode 8.3.3+ -DWITH_UBSAN=ON bundled protobuf build error

Submitted: 26 Jul 2017 8:38 Modified: 12 Apr 2018 5:34
Reporter: Laurynas Biveinis (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Compiling Severity:S3 (Non-critical)
Version:8.0.2, 8.0.3, 8.0.4 OS:MacOS (10.12.6)
Assigned to: CPU Architecture:Any

[26 Jul 2017 8:38] Laurynas Biveinis
Description:
On macOS 10.12.6, XCode 8.3.3, building with cmake option -DWITH_UBSAN=ON results in a build error:

[ 61%] Running C++ protocol buffer compiler on /Users/laurynas/percona/mysql-server/rapid/plugin/x/protocol/mysqlx_resultset.proto
[ 61%] Built target mysql_client_test
[ 61%] Built target libmysql_api_test
[ 64%] Built target mysqlpump_lib
[ 64%] Running C++ protocol buffer compiler on /Users/laurynas/percona/mysql-server/rapid/plugin/x/protocol/mysqlx.proto
[ 64%] Built target mysql_upgrade
[ 64%] Running C++ protocol buffer compiler on /Users/laurynas/percona/mysql-server/rapid/plugin/x/protocol/mysqlx_datatypes.proto
[ 64%] Running C++ protocol buffer compiler on /Users/laurynas/percona/mysql-server/rapid/plugin/x/protocol/mysqlx_connection.proto
[ 80%] Built target sql_main
[ 80%] Running C++ protocol buffer compiler on /Users/laurynas/percona/mysql-server/rapid/plugin/x/protocol/mysqlx_expect.proto
/bin/sh: line 1: 64222 Segmentation fault: 11  (core dumped) ../../../extra/protobuf/protoc --cpp_out /Users/laurynas/percona/obj-mysql-8.0.2-pp-ubsan-debug-openssl/rapid/plugin/x/generated/protobuf -I /Users/laurynas/percona/mysql-server/rapid/plugin/x/protocol /Users/laurynas/percona/mysql-server/rapid/plugin/x/protocol/mysqlx_resultset.proto
/bin/sh: line 1: 64253 Segmentation fault: 11  (core dumped) ../../../extra/protobuf/protoc --cpp_out /Users/laurynas/percona/obj-mysql-8.0.2-pp-ubsan-debug-openssl/rapid/plugin/x/generated/protobuf -I /Users/laurynas/percona/mysql-server/rapid/plugin/x/protocol /Users/laurynas/percona/mysql-server/rapid/plugin/x/protocol/mysqlx_expect.proto
/bin/sh: line 1: 64239 Segmentation fault: 11  (core dumped) ../../../extra/protobuf/protoc --cpp_out /Users/laurynas/percona/obj-mysql-8.0.2-pp-ubsan-debug-openssl/rapid/plugin/x/generated/protobuf -I /Users/laurynas/percona/mysql-server/rapid/plugin/x/protocol /Users/laurynas/percona/mysql-server/rapid/plugin/x/protocol/mysqlx_/bin/sh: line 1: 64241 Segmentation fault: 11  (core dumped) ../../../extra/protobuf/protoc --cpp_out /Users/laurynas/percona/obj-mysql-8.0.2-pp-ubsan-debug-openssl/rapid/plugin/x/generated/protobuf -I /Users/laurynas/percona/mysql-server/rapid/plugin/x/protocol /Users/laurynas/percona/mysql-server/rapid/plugin/x/protocol/mysqlx_connection.proto
/bin/sh: line 1: 64235 Segmentation fault: 11  (core dumped) ../../../extra/protobuf/protoc --cpp_out /Users/laurynas/percona/obj-mysql-8.0.2-pp-ubsan-debug-openssl/rapid/plugin/x/generated/protobuf -I /Users/laurynas/percona/mysql-server/rapid/plugin/x/protocol /Users/laurynas/percona/mysql-server/rapid/plugin/x/protocol/mysqlx.proto
datatypes.proto
make[2]: *** [rapid/plugin/x/generated/protobuf/mysqlx_expect.pb.cc] Error 139
make[2]: *** Waiting for unfinished jobs....
make[2]: *** [rapid/plugin/x/generated/protobuf/mysqlx_connection.pb.cc] Error 139
make[2]: *** [rapid/plugin/x/generated/protobuf/mysqlx_datatypes.pb.cc] Error 139
make[2]: *** [rapid/plugin/x/generated/protobuf/mysqlx.pb.cc] Error 139
make[2]: *** [rapid/plugin/x/generated/protobuf/mysqlx_resultset.pb.cc] Error 139
make[1]: *** [rapid/plugin/x/CMakeFiles/mysqlxtest.dir/all] Error 2

How to repeat:
See above
[26 Jul 2017 10:45] MySQL Verification Team
Thank you for the bug report.

In file included from /Users/miguel/mysql-8.0.2-dmr/rapid/plugin/group_replication/include/applier.h:19:
In file included from /Users/miguel/mysql-8.0.2-dmr/include/mysql/group_replication_priv.h:24:
In file included from /Users/miguel/mysql-8.0.2-dmr/sql/log_event.h:78:
In file included from /Users/miguel/mysql-8.0.2-dmr/sql/sql_class.h:88:
/Users/miguel/mysql-8.0.2-dmr/sql/sql_admin.h:80:8: warning: 'execute' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
  bool execute(THD *thd);
       ^
/Users/miguel/mysql-8.0.2-dmr/sql/sql_cmd.h:90:16: note: overridden virtual function is here
  virtual bool execute(THD *thd) = 0;
               ^
2 warnings generated.
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: libevent.a(strlcpy.c.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: libevent.a(strlcpy.c.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: libprotobuf-lite.a(atomicops_internals_x86_gcc.cc.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: libprotobuf-lite.a(atomicops_internals_x86_msvc.cc.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: libprotobuf-lite.a(atomicops_internals_x86_gcc.cc.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: libprotobuf-lite.a(atomicops_internals_x86_msvc.cc.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: libprotobuf.a(atomicops_internals_x86_gcc.cc.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: libprotobuf.a(atomicops_internals_x86_msvc.cc.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: libprotobuf.a(atomicops_internals_x86_gcc.cc.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: libprotobuf.a(atomicops_internals_x86_msvc.cc.o) has no symbols
/bin/sh: line 1: 10426 Segmentation fault: 11  ../../../extra/protobuf/protoc --cpp_out /Users/miguel/mysql-8.0.2-dmr/rapid/plugin/x/generated/protobuf_lite -I /Users/miguel/mysql-8.0.2-dmr/rapid/plugin/x/generated/protobuf_lite /Users/miguel/mysql-8.0.2-dmr/rapid/plugin/x/generated/protobuf_lite/mysqlx.proto
make[2]: *** [rapid/plugin/x/generated/protobuf_lite/mysqlx.pb.cc] Error 139
make[1]: *** [rapid/plugin/x/CMakeFiles/mysqlx.dir/all] Error 2
make: *** [all] Error 2
miguel:mysql-8.0.2-dmr miguel$
[5 Oct 2017 3:19] Laurynas Biveinis
Same with 8.0.3 and XCode 9.0.0
[5 Oct 2017 5:17] Laurynas Biveinis
If both -DWITH_UBSAN=ON -DWITH_ASAN=ON are given, then the build fails with an ASan error. It does not fail if only -DWITH_ASAN=ON is given.

[ 65%] Running C++ protocol buffer compiler (lite) on /Users/laurynas/percona/mysql-8.0.3/rapid/plugin/x/protocol/mysqlx.proto
ASAN:DEADLYSIGNAL
=================================================================
==68429==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000010 (pc 0x00010794cf07 bp 0x7fff5846fe10 sp 0x7fff5846fd00 T0)
==68429==The signal is caused by a READ memory access.
==68429==Hint: address points to the zero page.
    #0 0x10794cf06 in google::protobuf::FileOptions::Clear() string:1272
    #1 0x107cc8447 in google::protobuf::MessageLite::ParseFromString(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) message_lite.cc:131
    #2 0x107825e52 in void google::protobuf::DescriptorBuilder::AllocateOptionsImpl<google::protobuf::FileDescriptor>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, google::protobuf::FileDescriptor::OptionsType const&, google::protobuf::FileDescriptor*) descriptor.cc:3226
    #3 0x107825aba in google::protobuf::DescriptorBuilder::AllocateOptions(google::protobuf::FileOptions const&, google::protobuf::FileDescriptor*) descriptor.cc:3207
    #4 0x10780dad9 in google::protobuf::DescriptorBuilder::BuildFile(google::protobuf::FileDescriptorProto const&) descriptor.cc:3483
    #5 0x1077de1a6 in google::protobuf::DescriptorPool::BuildFileFromDatabase(google::protobuf::FileDescriptorProto const&) const descriptor.cc:2710
    #6 0x1077d3944 in google::protobuf::DescriptorPool::TryFindFileInFallbackDatabase(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) const descriptor.cc:1418
    #7 0x1077d33a4 in google::protobuf::DescriptorPool::FindFileByName(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) const descriptor.cc:1038
    #8 0x10793ba96 in google::protobuf::protobuf_AssignDesc_google_2fprotobuf_2fdescriptor_2eproto() descriptor.pb.cc:98
    #9 0x107c53696 in google::protobuf::internal::FunctionClosure0::Run() common.h:876
    #10 0x107c59062 in google::protobuf::GoogleOnceInitImpl(long*, google::protobuf::Closure*) once.cc:83
    #11 0x1078926d2 in google::protobuf::GoogleOnceInit(long*, void (*)()) once.h:127
    #12 0x1079d723d in google::protobuf::FileOptions::GetMetadata() const descriptor.pb.cc:5610
    #13 0x107c2fad5 in google::protobuf::compiler::Parser::ParseOption(google::protobuf::Message*, google::protobuf::compiler::Parser::LocationRecorder const&, google::protobuf::FileDescriptorProto const*, google::protobuf::compiler::Parser::OptionStyle) parser.cc:1019
    #14 0x107c2cef9 in google::protobuf::compiler::Parser::ParseTopLevelStatement(google::protobuf::FileDescriptorProto*, google::protobuf::compiler::Parser::LocationRecorder const&) parser.cc:524
    #15 0x107c2b03e in google::protobuf::compiler::Parser::Parse(google::protobuf::io::Tokenizer*, google::protobuf::FileDescriptorProto*) parser.cc:450
    #16 0x107c06950 in google::protobuf::compiler::SourceTreeDescriptorDatabase::FindFileByName(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, google::protobuf::FileDescriptorProto*) importer.cc:148
    #17 0x1077d3934 in google::protobuf::DescriptorPool::TryFindFileInFallbackDatabase(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) const descriptor.cc:1417
    #18 0x1077d33a4 in google::protobuf::DescriptorPool::FindFileByName(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) const descriptor.cc:1038
    #19 0x107d0fed7 in google::protobuf::compiler::CommandLineInterface::Run(int, char const* const*) command_line_interface.cc:654
    #20 0x10778fb49 in main main.cc:60
    #21 0x7fffb3222234 in start (libdyld.dylib:x86_64+0x5234)

==68429==Register values:
rax = 0x00001c1600000000  rbx = 0x00007fff5846fd80  rcx = 0x0d1fec9cb58cc19b  rdx = 0xf0a661bfd141ea44  
rdi = 0x00007fff5846fc40  rsi = 0x0000000109a3f470  rbp = 0x00007fff5846fe10  rsp = 0x00007fff5846fd00  
 r8 = 0x000060b0000005c0   r9 = 0x0000604000005010  r10 = 0x00001c0800000a07  r11 = 0x000060b000000468  
r12 = 0x000060b0000005c0  r13 = 0x0000100000000000  r14 = 0x000060b0000005e8  r15 = 0x9ddfea08eb382d69  
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV string:1272 in google::protobuf::FileOptions::Clear()
==68429==ABORTING
/bin/sh: line 1: 68429 Abort trap: 6           ../../../../runtime_output_directory/protoc --cpp_out /Users/laurynas/percona/obj-mysql-8.0.3-san/rapid/plugin/x/generated/protobuf_lite -I /Users/laurynas/percona/obj-mysql-8.0.3-san/rapid/plugin/x/generated/protobuf_lite /Users/laurynas/percona/obj-mysql-8.0.3-san/rapid/plugin/x/generated/protobuf_lite/mysqlx.proto
make[2]: *** [rapid/plugin/x/generated/protobuf_lite/mysqlx.pb.cc] Error 134
make[1]: *** [rapid/plugin/x/protocol/CMakeFiles/mysqlxmessages_lite.dir/all] Error 2
make: *** [all] Error 2
[25 Jan 2018 11:31] Laurynas Biveinis
8.0.4 is affected too
[13 Mar 2018 3:52] Laurynas Biveinis
See bug 89961
[12 Apr 2018 5:34] Erlend Dahl
Fixed in 8.0.12 along with

Bug#89961 add support for clang ubsan
[28 Feb 2019 0:17] Manuel Ung
The segfault is from this protobuf issue:
https://github.com/protocolbuffers/protobuf/issues/1450

The fix can be found here: https://github.com/protocolbuffers/protobuf/commit/cf14183bcd5485b4a71541599ddce0b35eb7135...

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

Page generated in 0.044 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.