HomeFreeBSD

random: Fix synchronization of hc_source_mask

Description

random: Fix synchronization of hc_source_mask

This variable provides a mask of all registered entropy sources and is
updated when drivers attach and detach (or by sysctl). However, nothing
was synchronizing accesses to it. Use the harvest lock to provide
mutual exclusion for updates, and use atomic_load_int() to mark unlocked
reads.

Reviewed by: cem
MFC after: 2 weeks
Sponsored by: Stormshield
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D52230

(cherry picked from commit c942d9e83ef1122a670bb39736d55fe8f90af83e)

Details

Provenance
markjAuthored on Sep 8 2025, 2:42 PM
Reviewer
cem
Differential Revision
D52230: random: Fix synchronization of hc_source_mask
Parents
rG97792a587051: random: Make the entropy source registration interface more uniform
Branches
Unknown
Tags
Unknown