Bug 1081

Summary: DPDK libraries (rib, lpm, ...) can't safely be used by shared libraries in application that are unloaded
Product: DPDK Reporter: Stephen Hemminger (stephen)
Component: coreAssignee: dev
Status: UNCONFIRMED ---    
Severity: major    
Priority: Normal    
Version: 22.03   
Target Milestone: ---   
Hardware: All   
OS: All   

Description Stephen Hemminger 2022-09-14 01:42:48 CEST
Our application has base program and plugins.
The plugins are loaded at run time with dlopen() and can be updated by doing dlclose() to replace the library with a new version.

Libraries that are only used by these plugins will crash when reloaded.
The sequences is:
  1. Program is started
  2. Plugin is loaded with dlopen()
  3.  dlopen will auto load the dependent shared library (for example rte_rib)
  4. Later plugin is unloaded by calling cleanup code and then dlclose()
  5.  dlcose() will unload the dependent no longer used shared library
  
  6. Reloading with dlopen causes crash because the tailq list has entry for already freed memory from the previous instance.

The problem is that some DPDK libraries use EAL_REGISTER_TAILQ as a constructor bu have no destructor. This problem applies to all libraries using EAL_REGISTER_TAILQ.

The best fix is to add destructor/unregister logic to the eal tailq.
Workaround is to load the dependent library during DPDK startup in main program.