aboutsummaryrefslogtreecommitdiffstats
path: root/src/vlibmemory/memory_client.c
diff options
context:
space:
mode:
authorBenoît Ganne <bganne@cisco.com>2019-04-15 15:28:21 +0200
committerDamjan Marion <dmarion@me.com>2019-11-27 10:50:28 +0000
commit9fb6d40eb3d4a2da8f45187de773498b784596e6 (patch)
treee785ebfbe73b847146debb2dae4a4304c51aa9cf /src/vlibmemory/memory_client.c
parent99fbf0574f099f09b7b46dcabe5bb50d78091dce (diff)
misc: add address sanitizer heap instrumentation
Introduce AddressSanitizer support: https://github.com/google/sanitizers/ This starts with heap instrumentation. vlib_buffer, bihash and stack instrumentation should follow. Type: feature Change-Id: I7f20e235b2f79db72efd0e756f22c75f717a9884 Signed-off-by: Benoît Ganne <bganne@cisco.com>
Diffstat (limited to 'src/vlibmemory/memory_client.c')
-rw-r--r--src/vlibmemory/memory_client.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/vlibmemory/memory_client.c b/src/vlibmemory/memory_client.c
index c61c3cbdd51..bb377f1b531 100644
--- a/src/vlibmemory/memory_client.c
+++ b/src/vlibmemory/memory_client.c
@@ -97,6 +97,13 @@ vl_api_name_and_crc_free (void)
hash_free (am->msg_index_by_name_and_crc);
}
+CLIB_NOSANITIZE_ADDR static void
+VL_API_VEC_UNPOISON (const void *v)
+{
+ const vec_header_t *vh = &((vec_header_t *) v)[-1];
+ CLIB_MEM_UNPOISON (vh, sizeof (*vh) + vec_len (v));
+}
+
static void
vl_api_memclnt_create_reply_t_handler (vl_api_memclnt_create_reply_t * mp)
{
@@ -121,6 +128,8 @@ vl_api_memclnt_create_reply_t_handler (vl_api_memclnt_create_reply_t * mp)
unserialize_open_data (sm, tblv, vec_len (tblv));
unserialize_integer (sm, &nmsgs, sizeof (u32));
+ VL_API_VEC_UNPOISON (tblv);
+
for (i = 0; i < nmsgs; i++)
{
msg_index = unserialize_likely_small_unsigned_integer (sm);
@@ -168,6 +177,9 @@ vl_client_connect (const char *name, int ctx_quota, int input_queue_size)
return -1;
}
+ CLIB_MEM_UNPOISON (shmem_hdr, sizeof (*shmem_hdr));
+ VL_MSG_API_SVM_QUEUE_UNPOISON (shmem_hdr->vl_input_queue);
+
pthread_mutex_lock (&svm->mutex);
oldheap = svm_push_data_heap (svm);
vl_input_queue = svm_queue_alloc_and_init (input_queue_size, sizeof (uword),
@@ -211,6 +223,7 @@ vl_client_connect (const char *name, int ctx_quota, int input_queue_size)
return -1;
read_one_msg:
+ VL_MSG_API_UNPOISON (rp);
if (ntohs (rp->_vl_msg_id) != VL_API_MEMCLNT_CREATE_REPLY)
{
clib_warning ("unexpected reply: id %d", ntohs (rp->_vl_msg_id));
@@ -295,6 +308,8 @@ vl_client_disconnect (void)
if (svm_queue_sub (vl_input_queue, (u8 *) & rp, SVM_Q_NOWAIT, 0) < 0)
continue;
+ VL_MSG_API_UNPOISON (rp);
+
/* drain the queue */
if (ntohs (rp->_vl_msg_id) != VL_API_MEMCLNT_DELETE_REPLY)
{