odr-violation warning for modemmanger

Aleksander Morgado aleksander at aleksander.es
Thu Aug 7 01:48:23 PDT 2014


On Thu, Aug 7, 2014 at 12:36 AM, Yunlian Jiang <yunlian at chromium.org> wrote:
>    When I compile modemmanger with truck clang with address sanitizer, I got
> the following warnings in the test case. Can any one take a look at it to
> see whether
> this warning is valid?
>    Thanks
>
>     * ==26533==ERROR: AddressSanitizer: odr-violation (0x7f8d113eb020):
>  *   [1] size=4 'mm_plugin_major_version' samsung/mm-plugin-samsung.c:34:5
>  *   [2] size=4 'mm_plugin_major_version' iridium/mm-plugin-iridium.c:36:5
>  * These globals were registered at these points:
>  *   [1]:
>  *     #0 0x45983b in __asan_register_globals
> (/build/amd64-generic/tmp/portage/net-misc/modemmanager-next-9999/work/modemmanager-next-9999/src/.libs/lt-ModemManager+0x45983b)
>  *     #1 0x7f8d0f5e69d6 in asan.module_ctor
> (/build/amd64-generic/tmp/portage/net-misc/modemmanager-next-9999/work/modemmanager-next-9999/plugins/.libs/libmm-plugin-samsung.so+0xb9d6)
>  *     #2 0x7f8d138bbed1 (/lib64/ld-linux-x86-64.so.2+0xeed1)
>  *     #3 0x7f8d138bbfab (/lib64/ld-linux-x86-64.so.2+0xefab)
>  *     #4 0x7f8d138c06fd (/lib64/ld-linux-x86-64.so.2+0x136fd)
>  *     #5 0x7f8d138bbd43 (/lib64/ld-linux-x86-64.so.2+0xed43)
>  *     #6 0x7f8d138bfb95 (/lib64/ld-linux-x86-64.so.2+0x12b95)
>  *     #7 0x7f8d12a3903a in dlopen_doit
> /var/tmp/portage/cross-x86_64-cros-linux-gnu/glibc-2.15-r13/work/glibc-2.15/dlfcn/dlopen.c:67
>  *     #8 0x7f8d138bbd43 (/lib64/ld-linux-x86-64.so.2+0xed43)
>  *     #9 0x7f8d12a395ec in _dlerror_run
> /var/tmp/portage/cross-x86_64-cros-linux-gnu/glibc-2.15-r13/work/glibc-2.15/dlfcn/dlerror.c:164
>  *     #10 0x7f8d12a390d0 in dlopen
> /var/tmp/portage/cross-x86_64-cros-linux-gnu/glibc-2.15-r13/work/glibc-2.15/dlfcn/dlopen.c:88
>  *     #11 0x490382 in __interceptor_dlopen
> (/build/amd64-generic/tmp/portage/net-misc/modemmanager-next-9999/work/modemmanager-next-9999/src/.libs/lt-ModemManager+0x490382)
>  *     #12 0x7f8d13aa8961 in _g_module_open
> /build/amd64-generic/tmp/portage/dev-libs/glib-2.34.3-r2/work/glib-2.34.3/gmodule/gmodule-dl.c:99
>  *     #13 0x7f8d13aa8961 in g_module_open
> /build/amd64-generic/tmp/portage/dev-libs/glib-2.34.3-r2/work/glib-2.34.3/gmodule/gmodule.c:584
>  *
>  *   [2]:
>  *     #0 0x45983b in __asan_register_globals
> (/build/amd64-generic/tmp/portage/net-misc/modemmanager-next-9999/work/modemmanager-next-9999/src/.libs/lt-ModemManager+0x45983b)
>  *     #1 0x7f8d111e5c96 in asan.module_ctor
> (/build/amd64-generic/tmp/portage/net-misc/modemmanager-next-9999/work/modemmanager-next-9999/plugins/.libs/libmm-plugin-iridium.so+0x4c96)
>  *     #2 0x7f8d138bbed1 (/lib64/ld-linux-x86-64.so.2+0xeed1)
>  *     #3 0x7f8d138bbfab (/lib64/ld-linux-x86-64.so.2+0xefab)
>  *     #4 0x7f8d138c06fd (/lib64/ld-linux-x86-64.so.2+0x136fd)
>  *     #5 0x7f8d138bbd43 (/lib64/ld-linux-x86-64.so.2+0xed43)
>  *     #6 0x7f8d138bfb95 (/lib64/ld-linux-x86-64.so.2+0x12b95)
>  *     #7 0x7f8d12a3903a in dlopen_doit
> /var/tmp/portage/cross-x86_64-cros-linux-gnu/glibc-2.15-r13/work/glibc-2.15/dlfcn/dlopen.c:67
>  *     #8 0x7f8d138bbd43 (/lib64/ld-linux-x86-64.so.2+0xed43)
>  *     #9 0x7f8d12a395ec in _dlerror_run
> /var/tmp/portage/cross-x86_64-cros-linux-gnu/glibc-2.15-r13/work/glibc-2.15/dlfcn/dlerror.c:164
>  *     #10 0x7f8d12a390d0 in dlopen
> /var/tmp/portage/cross-x86_64-cros-linux-gnu/glibc-2.15-r13/work/glibc-2.15/dlfcn/dlopen.c:88
>  *     #11 0x490382 in __interceptor_dlopen
> (/build/amd64-generic/tmp/portage/net-misc/modemmanager-next-9999/work/modemmanager-next-9999/src/.libs/lt-ModemManager+0x490382)
>  *     #12 0x7f8d13aa8961 in _g_module_open
> /build/amd64-generic/tmp/portage/dev-libs/glib-2.34.3-r2/work/glib-2.34.3/gmodule/gmodule-dl.c:99
>  *     #13 0x7f8d13aa8961 in g_module_open
> /build/amd64-generic/tmp/portage/dev-libs/glib-2.34.3-r2/work/glib-2.34.3/gmodule/gmodule.c:584
>  *
>  * ==26533==HINT: if you don't care about these warnings you may set
> ASAN_OPTIONS=detect_odr_violation=0
>  * SUMMARY: AddressSanitizer: odr-violation: global
> 'mm_plugin_major_version' at samsung/mm-plugin-samsung.c:34:5
>  * ==26533==ABORTING


I might be wrong, but to me it looks as if this is not a real problem.
We're dlopen-ing the plugins and reading symbols with
g_module_symbol(); that warning is just because the same public symbol
is exported by different plugins (version numbers in this case), but I
guess that is totally expected. The only doubt I have is whether we
should instead be providing methods to retrieve the version numbers,
instead of the version numbers themselves; e.g. something like
  int  mm_plugin_get_major_version (void);
  int  mm_plugin_get_minor_version (void);


-- 
Aleksander
https://aleksander.es


More information about the ModemManager-devel mailing list