Skip to content

runtime: incorrect synchronization around arena_used/h_spans during concurrent GC #9984

Closed
@dvyukov

Description

@dvyukov

Arena_used/h_spans updates during memory allocation are not synchronized with concurrent GC.
Consider that a thread grows heap and allocates a new object p and then writes p into an existing object or a global. Concurrent GC reaches the global and extracts pointer p, then it checks it against arena_start/arena_used, but it may not see the updated value of arena_used and thus ignore the object p unmarked and unscanned.
A similar senario can happen with h_spans: GC sees new value of arena_used but does not see the new value in h_spans[spanIdx].

This will probably work today on x86 due to conservative compiler that does not reorder memory accesses aggressively. But this should break on arm and power.

@RLH @aclements @rsc

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions