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)
Mon, Aug 10, 9:36 PM
Unknown Object (File)
Sun, Aug 9, 7:59 PM
Unknown Object (File)
Sun, Aug 2, 1:45 AM
Unknown Object (File)
Sat, Aug 1, 7:28 AM
Unknown Object (File)
Fri, Jul 24, 1:46 PM
Unknown Object (File)
Thu, Jul 23, 6:19 AM
Unknown Object (File)
Sat, Jul 18, 2:51 AM
Unknown Object (File)
Jul 9 2026, 4:34 AM
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