LibtraceTeam / libtrace

C Library for working with network packet traces
GNU Lesser General Public License v3.0
158 stars 50 forks source link

Several improper locking bugs(vulnerabilities) found in libtrace #195

Closed ycaibb closed 3 years ago

ycaibb commented 3 years ago

Hi, developers, thank you for your checking. I found several improper locking in the below codes due to the unreleased locks.

ycaibb commented 3 years ago

The lock q->lock is not released before the return. https://github.com/LibtraceTeam/libtrace/blob/d827850a048405324dcdb39feeee8b3dd01378a6/lib/data-struct/deque.c#L92-L107

ycaibb commented 3 years ago

The lock libtrace->libtrace_lock is not released before the return. https://github.com/LibtraceTeam/libtrace/blob/5350b4a95985969b2dff2f7c677968acb6d29744/lib/trace_parallel.c#L2259-L2265

ycaibb commented 3 years ago

The lock b->lock is not released before the return. https://github.com/LibtraceTeam/libtrace/blob/d827850a048405324dcdb39feeee8b3dd01378a6/lib/data-struct/buckets.c#L190-L211

ycaibb commented 3 years ago

The lock q->lock is not released before the return. https://github.com/LibtraceTeam/libtrace/blob/d827850a048405324dcdb39feeee8b3dd01378a6/lib/data-struct/deque.c#L63-L74

ycaibb commented 3 years ago

The lock v->lock is not released before the return. https://github.com/LibtraceTeam/libtrace/blob/d827850a048405324dcdb39feeee8b3dd01378a6/lib/data-struct/vector.c#L51-L63

ycaibb commented 3 years ago

The mutex is not released before the return. https://github.com/LibtraceTeam/libtrace/blob/5350b4a95985969b2dff2f7c677968acb6d29744/lib/trace.c#L1730-L1744

ycaibb commented 3 years ago

The lock trace->libtrace_lock is not released before the thread goes die. https://github.com/LibtraceTeam/libtrace/blob/5350b4a95985969b2dff2f7c677968acb6d29744/lib/trace_parallel.c#L954-L968

ycaibb commented 3 years ago

The lock q->lock is not released before the return.

https://github.com/LibtraceTeam/libtrace/blob/d827850a048405324dcdb39feeee8b3dd01378a6/lib/data-struct/deque.c#L92-L107

ycaibb commented 3 years ago

Hi, developers @salcock @rsanger

Any comments would be highly appreciated. Thank you.

Best Regards,

salcock commented 3 years ago

Fixed by #196 -- thanks again.