Skip to content

solver: synchronize CDI auto-allow access - #7294

Draft
crazy-max wants to merge 1 commit into
moby:masterfrom
crazy-max:fix-cdi-autoallow-race
Draft

crazy-max wants to merge 1 commit into
moby:masterfrom
crazy-max:fix-cdi-autoallow-race

Conversation

@crazy-max

Copy link
Copy Markdown
Member

Completing an on-demand CDI installation updates the manager shared autoAllowed map while concurrent builds or worker queries can read it through GetDevice and ListDevices. The existing installation locks are scoped to individual device kinds, so they neither synchronize these readers nor prevent installers for different kinds from writing concurrently. This creates a data race and can crash the daemon with a concurrent map access error. Protect the map with a shared read/write mutex, keeping installation work outside that lock and preserving the existing per-kind installation locks and permission behavior.

I found that while reviewing the on-demand setup path in #7293

On-demand installers update the auto-allow map while concurrent device
queries read it. The per-kind installation locks do not protect these
reads or writes from installers for other kinds, allowing data races and
concurrent map access panics.

Protect shared map access with a read/write mutex while retaining the
per-kind installation locks.

Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
@crazy-max
crazy-max force-pushed the fix-cdi-autoallow-race branch from 63f1a2d to a34ac4e Compare October 17, 2026 15:23
@crazy-max crazy-max added this to the v0.35.0 milestone Oct 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant