You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
lsof 4.99.7 aborts with a double free during a TCP port lookup on Linux #413
On Arch Linux x86_64, lsof -ti tcp:4193,4194 exited with SIGABRT. The installed packages were lsof 4.99.7-1 and glibc 2.44+r50+g1848099f063e-1.
The core recorded free(): double free detected in tcache 2. The first lsof frame was lsof+0x11b7a, immediately after a call to free(). The executable’s build ID was 84ad5d98579940acdcbf405b24c7841953eb805e.
I observed the crash once. Querying the two ports individually afterward returned no matches and exited normally. I haven’t confirmed whether the combined port filter triggers it consistently.
As information, in 4.99.7, the two port selections share the same "tcp" protocol string, but cleanup frees that string once for each selection. PR #371 gives each selection its own copy, so cleanup no longer frees the same allocation twice.
This way, seems this double free was fixed by PR #371, which is included in master but not in 4.99.7.
I have verified it with a regression test hja-oss@0839f3e for lsof -ti tcp:4193,4194: 4.99.7 aborts with an AddressSanitizer double free in lsof_destroy(), while current master passes.
Please try building from master, or backport #371.
Activity
hja-oss commentedon Nov 22, 2026
As information, in 4.99.7, the two port selections share the same "tcp" protocol string, but cleanup frees that string once for each selection. PR #371 gives each selection its own copy, so cleanup no longer frees the same allocation twice.
This way, seems this double free was fixed by PR #371, which is included in master but not in 4.99.7.
I have verified it with a regression test hja-oss@0839f3e for
lsof -ti tcp:4193,4194: 4.99.7 aborts with an AddressSanitizer double free inlsof_destroy(), while current master passes.Please try building from master, or backport #371.