Bug 1081 - DPDK libraries (rib, lpm, ...) can't safely be used by shared libraries in application that are unloaded
Summary: DPDK libraries (rib, lpm, ...) can't safely be used by shared libraries in ap...
Status: UNCONFIRMED
Alias: None
Product: DPDK
Classification: Unclassified
Component: core (show other bugs)
Version: 22.03
Hardware: All All
: Normal major
Target Milestone: ---
Assignee: dev
URL:
Depends on:
Blocks:
 
Reported: 2022-09-14 01:42 CEST by Stephen Hemminger
Modified: 2022-09-14 01:42 CEST (History)
0 users



Attachments

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.

Note You need to log in before you can comment on or make changes to this bug.