Page MenuHomeFreeBSD

thr_rtld: accept read lock requests while owning the lock for write
ClosedPublic

Authored by kib on May 2 2025, 3:38 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Jun 29, 11:57 AM
Unknown Object (File)
Sat, Jun 28, 2:46 PM
Unknown Object (File)
Thu, Jun 26, 4:29 AM
Unknown Object (File)
Tue, Jun 24, 3:18 PM
Unknown Object (File)
Tue, Jun 24, 4:48 AM
Unknown Object (File)
Mon, Jun 23, 9:47 PM
Unknown Object (File)
Sun, Jun 22, 8:03 AM
Unknown Object (File)
Sun, Jun 22, 4:43 AM
Subscribers

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

kib requested review of this revision.May 2 2025, 3:38 PM

The logic appears fine. Out of curiosity, could you describe or provide some links to the context of this change? I think I saw several changes passing in rtld recently, but haven't followed.

lib/libthr/thread/thr_rtld.c
175–182

That trick extends the write lock as seen by other threads until all the references from the locking thread have been released (write but also read). Could that be a problem?

This revision is now accepted and ready to land.May 2 2025, 4:15 PM

The logic appears fine. Out of curiosity, could you describe or provide some links to the context of this change? I think I saw several changes passing in rtld recently, but haven't followed.

See the referenced PR for the test case.

lib/libthr/thread/thr_rtld.c
175–182

This is the expected behavior, how could it be different? The last reference releases the exclusive/write lock.

Thanks, I hadn't seen it above.

lib/libthr/thread/thr_rtld.c
175–182

I was just wondering if that could be a problem in the context of the change. I do indeed see no other way without splitting _thr_rtld_lock_release() into 2 functions, one for the write lock and another one for read locks.