API and CLI are executed under the worker barrier by default in VPP, only the 
VPP main thread runs, and workers are stopped.
For an API/CLI to be executed concurrently with workers, it must be explicitly 
marked as such (mp_safe attribute).
It does not seem to be the case for ACL, so it should be fine.

Best
ben

> -----Original Message-----
> From: vpp-dev@lists.fd.io <vpp-dev@lists.fd.io> On Behalf Of Chul-Woong
> Yang
> Sent: Monday, December 12, 2022 3:50
> To: vpp-dev@lists.fd.io
> Subject: [vpp-dev] Q) Is it a possible acl-plugin race condtion?
> 
> Hi, team.
> 
> I'm reading acl-plugin code and have a question on race condition.
> When vpp needs to update acl rules, it does not keep a refcnt or
> something and just `vec_free`s the rules. Is it safe?:
> ```
>   /* ACL updater: from acl_add_list() */
> {
>       a = am->acls + *acl_list_index;
>       /* Get rid of the old rules */
>       if (a->rules)
>         vec_free (a->rules);   /* (A) */
>     }
>     ...
> 
> 
>   /* ACL user: from single_acl_match_5tuple() */
>   for (i = 0; i < vec_len(acl_rules); i++)
>     {
>       r = &acl_rules[i];
>       ... /* (B) */
> ```
> 
> I worry that vpp can SEGV by refering freed memory when it referes an
> acl rules `r` in (B) while another thread frees the rule in (A).
> 
> Best regards,
> Chul-Woong
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#22315): https://lists.fd.io/g/vpp-dev/message/22315
Mute This Topic: https://lists.fd.io/mt/95613760/21656
Group Owner: vpp-dev+ow...@lists.fd.io
Unsubscribe: https://lists.fd.io/g/vpp-dev/leave/1480452/21656/631435203/xyzzy 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to