From 0f6537c437481f4dcbbd8b2f673dcab67ec68e02 Mon Sep 17 00:00:00 2001 From: Yi Kong Date: Sun, 18 Aug 2019 17:57:35 -0700 Subject: [PATCH] Fix ODR violation host_init_verifier statically links libprocessgroup, which has shared dependency on libjsoncpp. Right now it also has shared dependency on libjsoncpp, resulting in ODR violation: ERROR: AddressSanitizer: odr-violation (0x7fce895f3220): [1] size=8 'Json::kNullRef' external/jsoncpp/src/lib_json/json_value.cpp:37:22 [2] size=8 'Json::kNullRef' external/jsoncpp/src/lib_json/json_value.cpp:37:22 These globals were registered at these points: [1]: #0 0x56276926ef0d (/usr/local/google/buildbot/src/android/master/out/host/linux-x86/bin/host_init_verifier+0xd1f0d) #1 0x7fce894ac1d9 (/lib64/ld-linux-x86-64.so.2+0x101d9) [2]: #0 0x56276926ef0d (/usr/local/google/buildbot/src/android/master/out/host/linux-x86/bin/host_init_verifier+0xd1f0d) #1 0x7fce894ac1d9 (/lib64/ld-linux-x86-64.so.2+0x101d9) Move host_init_verifier to libjsoncpp_headers to fix the ODR violation. Bug: 139546461 Bug: 131328001 Test: Run ASAN host_init_verifier Change-Id: I54a51138d61fff37f092ffaa0758817600a0af9d --- init/Android.bp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/init/Android.bp b/init/Android.bp index 3233cc310..38d495f4b 100644 --- a/init/Android.bp +++ b/init/Android.bp @@ -269,11 +269,13 @@ cc_binary { shared_libs: [ "libcutils", "libhidl-gen-utils", - "libjsoncpp", "liblog", "libprocessgroup", "libprotobuf-cpp-lite", ], + header_libs: [ + "libjsoncpp_headers", + ], srcs: [ "action.cpp", "action_manager.cpp",