Page MenuHomeFreeBSD

libdtrace: Fix an off-by-one in the priority queue implementation
ClosedPublic

Authored by markj on Mar 5 2025, 10:59 AM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Oct 14, 12:07 PM
Unknown Object (File)
Mon, Oct 13, 7:52 AM
Unknown Object (File)
Tue, Oct 7, 10:58 AM
Unknown Object (File)
Sun, Oct 5, 2:57 AM
Unknown Object (File)
Sat, Oct 4, 7:47 PM
Unknown Object (File)
Fri, Oct 3, 8:12 AM
Unknown Object (File)
Fri, Oct 3, 7:33 AM
Unknown Object (File)
Thu, Sep 25, 3:04 PM
Subscribers

Details

Summary

The zero'th index in the array is unused, so a priority queue of N elements
needs N+1 array slots. Fix the allocation.

Also fix the assertion in dt_pq_insert(): the assertion needs to be checked
after incrementing the count of items in the priority queue, otherwise it can
miss an overflow.

Reported by: CHERI
Sponsored by: Innovate UK

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 62768
Build 59652: arc lint + arc unit