draios / sysdig

Linux system exploration and troubleshooting tool with first class support for containers
http://www.sysdig.com/
Other
7.72k stars 726 forks source link

fix: avoid using global filtercheck list with plugins #2008

Closed jasondellaluce closed 1 year ago

jasondellaluce commented 1 year ago

The global filtercheck list g_filterlist is used in sysdig to also accumulate filterchecks implemented by plugins. However, since that variable is static, it also means that plugins will be kept alive in their shared pointer even after the inspector they've been registered into gets destroyed, and will be instead destroyed at program termination. Even though we don't have sophisticated destroy logic for sinsp-implemented filterchecks, this could be generally wrong for plugins in their teardown phase.