Page MenuHomeFreeBSD

Make crypt(3) thread-safe by utilizing thread-local storage.
Needs ReviewPublic

Authored by delphij on Feb 5 2025, 6:14 AM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Jan 8, 10:37 PM
Unknown Object (File)
Sun, Dec 21, 6:52 AM
Unknown Object (File)
Dec 6 2025, 5:09 AM
Unknown Object (File)
Dec 3 2025, 10:43 PM
Unknown Object (File)
Nov 3 2025, 5:26 AM
Unknown Object (File)
Oct 16 2025, 9:48 PM
Unknown Object (File)
Oct 7 2025, 5:51 AM
Unknown Object (File)
Sep 15 2025, 2:15 PM
Subscribers
None

Details

Reviewers
emaste
imp
jrtc27
Summary

The crypt(3) interface is a wrapper around crypt_r(3) where a global
static storage is passed as data. Modernize the interface by
passing a thread-local storage instead so it is thread-safe.

Test Plan

kyua test lib/libcrypt

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 62267
Build 59151: arc lint + arc unit

Event Timeline

delphij created this revision.

It's still not thread-safe if you pass the return value to another thread, but perhaps that's outside the scope