-
Notifications
You must be signed in to change notification settings - Fork 15.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
static initializers (StaticDescriptorInitializer_*_2eproto) are MemorySanitizer-unclean #1099
Comments
This was previously reported in #912. |
Simpler repro: curl --location https://github.com/google/protobuf/releases/download/v3.0.0-beta-2/protobuf-cpp-3.0.0-beta-2.tar.gz | tar zx
cd protobuf-3.0.0-beta-2
./configure CPPFLAGS='-fsanitize=memory -fsanitize-memory-track-origins' LDFLAGS='-fsanitize=memory'
make check -j4
...
==11781==WARNING: MemorySanitizer: use-of-uninitialized-value
#0 0x7f23fcce1ec2 in google::protobuf::SimpleDescriptorDatabase::DescriptorIndex<std::pair<void const*, int> >::ValidateSymbolName(std::string const&) (/protobuf/protobuf-3.0.0-beta-2/src/.libs/libprotobuf.so.10+0x9feec2)
#1 0x7f23fccd6ef6 in google::protobuf::SimpleDescriptorDatabase::DescriptorIndex<std::pair<void const*, int> >::AddSymbol(std::string const&, std::pair<void const*, int>) (/protobuf/protobuf-3.0.0-beta-2/src/.libs/libprotobuf.so.10+0x9f3ef6)
#2 0x7f23fcc8c0a3 in google::protobuf::SimpleDescriptorDatabase::DescriptorIndex<std::pair<void const*, int> >::AddFile(google::protobuf::FileDescriptorProto const&, std::pair<void const*, int>) (/protobuf/protobuf-3.0.0-beta-2/src/.libs/libprotobuf.so.10+0x9a90a3)
#3 0x7f23fcc76a9e in google::protobuf::EncodedDescriptorDatabase::Add(void const*, int) (/protobuf/protobuf-3.0.0-beta-2/src/.libs/libprotobuf.so.10+0x993a9e)
#4 0x7f23fc8ecdc5 in google::protobuf::DescriptorPool::InternalAddGeneratedFile(void const*, int) (/protobuf/protobuf-3.0.0-beta-2/src/.libs/libprotobuf.so.10+0x609dc5)
#5 0x7f23fc851e02 in google::protobuf::protobuf_AddDesc_google_2fprotobuf_2fany_2eproto() (/protobuf/protobuf-3.0.0-beta-2/src/.libs/libprotobuf.so.10+0x56ee02)
#6 0x7f23fc85f873 in google::protobuf::StaticDescriptorInitializer_google_2fprotobuf_2fany_2eproto::StaticDescriptorInitializer_google_2fprotobuf_2fany_2eproto() (/protobuf/protobuf-3.0.0-beta-2/src/.libs/libprotobuf.so.10+0x57c873)
#7 0x7f23fc54ba8e in __cxx_global_var_init (/protobuf/protobuf-3.0.0-beta-2/src/.libs/libprotobuf.so.10+0x268a8e)
#8 0x7f23fc54baa8 in _GLOBAL__sub_I_any.pb.cc (/protobuf/protobuf-3.0.0-beta-2/src/.libs/libprotobuf.so.10+0x268aa8)
#9 0x7f23fe51f9f9 (/lib64/ld-linux-x86-64.so.2+0xe9f9)
#10 0x7f23fe51fae2 (/lib64/ld-linux-x86-64.so.2+0xeae2)
#11 0x7f23fe5121c9 (/lib64/ld-linux-x86-64.so.2+0x11c9)
Uninitialized value was created by a heap allocation
#0 0x48b2c2 in operator new(unsigned long) (/protobuf/protobuf-3.0.0-beta-2/src/.libs/lt-protoc+0x48b2c2)
#1 0x7f23fac1ae98 in std::string::_Rep::_S_create(unsigned long, unsigned long, std::allocator<char> const&) (/usr/lib/x86_64-linux-gnu/libstdc++.so.6+0xbee98)
SUMMARY: MemorySanitizer: use-of-uninitialized-value (/protobuf/protobuf-3.0.0-beta-2/src/.libs/libprotobuf.so.10+0x9feec2) in google::protobuf::SimpleDescriptorDatabase::DescriptorIndex<std::pair<void const*, int> >::ValidateSymbolName(std::string const&)
Exiting
Makefile:6623: recipe for target 'unittest_proto_middleman' failed
make[1]: *** [unittest_proto_middleman] Error 77
make[1]: Leaving directory '/protobuf/protobuf-3.0.0-beta-2/src'
Makefile:1187: recipe for target 'check-recursive' failed
make: *** [check-recursive] Error 1 |
On master (7619505), this fails with something even more innocuous-looking:
|
Further investigation suggests that I'm not properly persuading my @dvyukov: @andreimatei suggested I ask you - what is the magic invocation of
which shipped with Any help here would be more than appreciated! |
For the record: to run any c++ program with With this done, programs using protobufs are msan-clean, so no action is necessary on the protobuf side and this issue can be closed. |
It seems that any executable which links libprotoc is msan-unclean:
This reproduces with libprotoc v3.0.0-beta-2 and the following linux and clang versions:
The text was updated successfully, but these errors were encountered: