Change in osmo-iuh[master]: Fix OneDefinitionRule Asan violation in tests and osmo-hnbgw

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

pespin gerrit-no-reply at lists.osmocom.org
Mon May 18 08:36:16 UTC 2020


pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-iuh/+/18342 )


Change subject: Fix OneDefinitionRule Asan violation in tests and osmo-hnbgw
......................................................................

Fix OneDefinitionRule Asan violation in tests and osmo-hnbgw

With new gcc 10.1.0, tests failed at runtime when built with ASAN
enabled, since some global variables where defined multiple times.
See OS#4556 for a sample Asan error.

Fixes: OS#4556
Change-Id: I12a667ea8a9f16404c13c9218b246d2e3acfe3e8
---
M src/hnbap_common.c
M src/tests/dummy_cn_sua.c
M src/tests/test-helpers.c
M src/tests/test-ranap.c
M src/tests/test_common.c
5 files changed, 6 insertions(+), 10 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-iuh refs/changes/42/18342/1

diff --git a/src/hnbap_common.c b/src/hnbap_common.c
index f8cfb13..4e79467 100644
--- a/src/hnbap_common.c
+++ b/src/hnbap_common.c
@@ -106,10 +106,6 @@
 	return buf;
 }
 
-
-int asn_debug = 0;
-int asn1_xer_print = 0;
-
 static struct msgb *hnbap_msgb_alloc(void)
 {
 	return msgb_alloc(1024, "HNBAP Tx");
diff --git a/src/tests/dummy_cn_sua.c b/src/tests/dummy_cn_sua.c
index aba6c8a..6e14562 100644
--- a/src/tests/dummy_cn_sua.c
+++ b/src/tests/dummy_cn_sua.c
@@ -26,7 +26,6 @@
 #include <osmocom/ranap/ranap_msg_factory.h>
 #include <osmocom/iuh/hnbgw.h>
 
-int asn1_xer_print = 1;
 const char *cmdline_bind_addr = "127.0.0.1";
 
 struct ue_conn_ctx {
@@ -364,6 +363,8 @@
 	int rc;
 	int port = 14001;
 
+	asn1_xer_print = 1;
+
 	osmo_sua_set_log_area(DSUA);
 	ranap_set_log_area(DRANAP);
 
diff --git a/src/tests/test-helpers.c b/src/tests/test-helpers.c
index aafe815..cfe2140 100644
--- a/src/tests/test-helpers.c
+++ b/src/tests/test-helpers.c
@@ -32,7 +32,6 @@
 
 #include <osmocom/ranap/RANAP_LAI.h>
 
-int asn1_xer_print = 0;
 extern void *talloc_asn1_ctx;
 
 /* use odd number of digits */
@@ -207,6 +206,8 @@
 
 int main(int argc, char **argv)
 {
+	asn1_xer_print = 0;
+
 	test_common_init();
 
 	test_iu_helpers();
diff --git a/src/tests/test-ranap.c b/src/tests/test-ranap.c
index efa2241..a6df186 100644
--- a/src/tests/test-ranap.c
+++ b/src/tests/test-ranap.c
@@ -34,8 +34,6 @@
 
 #include <osmocom/iuh/hnbgw.h>
 
-int asn1_xer_print = 1;
-
 extern void *tall_msgb_ctx;
 
 static void test_aper_int(uint32_t inp)
@@ -95,6 +93,8 @@
 	uint8_t ck[16] = { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 };
 	int i;
 
+	asn1_xer_print = 1;
+
 	//asn_debug = 1;
 
 	test_common_init();
diff --git a/src/tests/test_common.c b/src/tests/test_common.c
index 701d581..7c6f62a 100644
--- a/src/tests/test_common.c
+++ b/src/tests/test_common.c
@@ -41,8 +41,6 @@
 
 #include <osmocom/iuh/hnbgw.h>
 
-void *talloc_asn1_ctx;
-
 static const struct log_info_cat log_cat[] = {
 	[DMAIN] = {
 		.name = "DMAIN", .loglevel = LOGL_INFO, .enabled = 1,

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-iuh/+/18342
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-iuh
Gerrit-Branch: master
Gerrit-Change-Id: I12a667ea8a9f16404c13c9218b246d2e3acfe3e8
Gerrit-Change-Number: 18342
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200518/42c82ea1/attachment.htm>


More information about the gerrit-log mailing list