From 4d297013fd680009f28806557b8ae16aa5eae205 Mon Sep 17 00:00:00 2001 From: Denis Khalikov Date: Wed, 7 Mar 2018 16:53:39 +0300 Subject: [PATCH] [ASan] Disable sanitization for _connection_libnet_set_type_changed_cb Workaround for error: #0 0xb6fb9ac7 in __GI___tls_get_addr /usr/src/debug/glibc-2.24/elf/dl-tls.c:834 #1 0xb6a7c185 in __tls_get_addr (/usr/lib/libasan.so+0x2b185) #2 0xb456d5c3 in _connection_libnet_set_type_changed_cb /usr/src/debug/capi-network-connection-1.0.108/src/libnetwork.c:710 #3 0xb4562289 in __connection_set_type_changed_callback /usr/src/debug/capi-network-connection-1.0.108/src/connection.c:152 #4 0xb5121dfd in _suspend_init /usr/src/debug/amd-1.2.3/src/lib/amd_suspend.c:242 #5 0xb50fd68d in __init /usr/src/debug/amd-1.2.3/src/lib/amd_main.c:342 #6 0xb50fd68d in main /usr/src/debug/amd-1.2.3/src/lib/amd_main.c:402 #7 0xb68df63b (/lib/libc.so.6+0x1663b) Change-Id: Iae412b9e938f20067a71251e3c27b215fbd1ae39 --- include/net_connection_private.h | 9 ++++++++- packaging/capi-network-connection.spec | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/include/net_connection_private.h b/include/net_connection_private.h index 2c60aaa..d05f0ad 100755 --- a/include/net_connection_private.h +++ b/include/net_connection_private.h @@ -43,6 +43,13 @@ extern "C" { #define TETHERING_BLUETOOTH_FEATURE "http://tizen.org/feature/network.tethering.bluetooth" #define ETHERNET_FEATURE "http://tizen.org/feature/network.ethernet" +#ifdef ADDRESS_SANITIZER +#define NO_SANITIZE \ + __attribute__((optimize(2))) __attribute__((no_sanitize_address)) +#else +#define NO_SANITIZE +#endif + typedef enum { CONNECTION_CELLULAR_SUBSCRIBER_1 = 0x00, CONNECTION_CELLULAR_SUBSCRIBER_2 = 0x01, @@ -181,7 +188,7 @@ int _connection_libnet_start_tcpdump(void); int _connection_libnet_stop_tcpdump(void); int _connection_libnet_get_tcpdump_state(gboolean *tcpdump_state); -void _connection_libnet_set_type_changed_cb(libnet_type_changed_cb callback); +void _connection_libnet_set_type_changed_cb(libnet_type_changed_cb callback) NO_SANITIZE; void _connection_libnet_set_ip_changed_cb(libnet_ip_changed_cb callback); void _connection_libnet_set_proxy_changed_cb(libnet_proxy_changed_cb callback); diff --git a/packaging/capi-network-connection.spec b/packaging/capi-network-connection.spec index 4bb9ac4..2110464 100755 --- a/packaging/capi-network-connection.spec +++ b/packaging/capi-network-connection.spec @@ -31,6 +31,7 @@ Network Connection library in Tizen C API (Development) %build +%{?asan: export CFLAGS+=' -DADDRESS_SANITIZER '} export CFLAGS+=' -Wno-unused-local-typedefs' MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'` cmake -DCMAKE_INSTALL_PREFIX=/usr -DFULLVER=%{version} -DMAJORVER=${MAJORVER} \ -- 2.7.4