HomeFreeBSD

libthr pshared: correct a bug in allocation

Description

libthr pshared: correct a bug in allocation

When __thr_pshared_offpage() is called for allocation, it must not use
the cached offpage for the key. Instead, the cached offpage must be
unmapped and removed from the cache, if any.

It is legitimate for the user code to unmap the shared lock object without
destroying it, and then mapping something over the freed VA to carry
another shared lock. In this case the cached offpage must be un-cached.

PR: 269277
Reported by: rau8344@gmail.com
Reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D38345

Details

Provenance
kibAuthored on Feb 1 2023, 8:12 PM
Reviewer
markj
Differential Revision
D38345: libthr pshared: correct a bug in allocation
Parents
rG3cf37d1251bf: libthr: add pshared_destroy() helper
Branches
Unknown
Tags
Unknown