dpdk: plugin init should be protect by thread barrier 93/37793/2
authorXiaoming Jiang <jiangxiaoming@outlook.com>
Mon, 12 Dec 2022 02:56:43 +0000 (02:56 +0000)
committerDamjan Marion <dmarion@0xa5.net>
Mon, 6 Mar 2023 16:48:30 +0000 (16:48 +0000)
Witout thread barrier, when dpdk_process_node initiating
dpdk lib, workers thread may also be initiating. Main
and workers threads may both setting error_main info,
that will cause memory ASAN issue.

Type: fix
Signed-off-by: Xiaoming Jiang <jiangxiaoming@outlook.com>
Change-Id: I87b73b310730719035d4985a2cff2e3308120ec2

src/plugins/dpdk/device/init.c

index d611500..74181ea 100644 (file)
@@ -1450,6 +1450,7 @@ dpdk_process (vlib_main_t * vm, vlib_node_runtime_t * rt, vlib_frame_t * f)
   dpdk_device_t *xd;
   vlib_thread_main_t *tm = vlib_get_thread_main ();
 
+  vlib_worker_thread_barrier_sync (vm);
   error = dpdk_lib_init (dm);
 
   if (error)
@@ -1466,6 +1467,7 @@ dpdk_process (vlib_main_t * vm, vlib_node_runtime_t * rt, vlib_frame_t * f)
        }
     }
 
+  vlib_worker_thread_barrier_release (vm);
   tm->worker_thread_release = 1;
 
   f64 now = vlib_time_now (vm);