Skip to content

staticdata: close check-then-act race on newly_inferred - #62373

Merged
IanButterworth merged 1 commit into
JuliaLang:masterfrom
IanButterworth:ib/stale-lock-recheck-fixes
Jul 14, 2026
Merged

staticdata: close check-then-act race on newly_inferred#62373
IanButterworth merged 1 commit into
JuliaLang:masterfrom
IanButterworth:ib/stale-lock-recheck-fixes

Conversation

@IanButterworth

@IanButterworth IanButterworth commented Jul 13, 2026

Copy link
Copy Markdown
Member

I asked Claude to find any similar bugs to #62372 and this was the only one it found in Base/src.


jl_push_newly_inferred checked newly_inferred for NULL before taking newly_inferred_mutex without re-checking under the lock, while jl_set_newly_inferred swapped the global with no lock at all. A clear or replacement racing a push could dereference NULL or append to a replaced (orphaned) array. Take the mutex in jl_set_newly_inferred and re-check the array under the lock in jl_push_newly_inferred.

`jl_push_newly_inferred` checked `newly_inferred` for NULL before taking
`newly_inferred_mutex` without re-checking under the lock, while
`jl_set_newly_inferred` swapped the global with no lock at all. A clear
or replacement racing a push could dereference NULL or append to a
replaced (orphaned) array. Take the mutex in `jl_set_newly_inferred` and
re-check the array under the lock in `jl_push_newly_inferred`.

Same defect shape as the `Partr.multiq_size` race (JuliaLang#62144).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@IanButterworth
IanButterworth requested a review from vtjnash July 13, 2026 23:11
@IanButterworth
IanButterworth marked this pull request as ready for review July 14, 2026 07:51
@IanButterworth IanButterworth added backport 1.12 Change should be backported to release-1.12 backport 1.13 Change should be backported to release-1.13 merge me PR is reviewed. Merge when all tests are passing labels Jul 14, 2026
@IanButterworth
IanButterworth merged commit 3ed74ae into JuliaLang:master Jul 14, 2026
11 of 12 checks passed
@IanButterworth
IanButterworth deleted the ib/stale-lock-recheck-fixes branch July 14, 2026 09:04
@topolarity

topolarity commented Jul 14, 2026

Copy link
Copy Markdown
Member

Thanks @IanButterworth ! Nice to have this fixed (and more importantly #62372)

@DilumAluthge DilumAluthge removed the merge me PR is reviewed. Merge when all tests are passing label Jul 15, 2026
KristofferC pushed a commit that referenced this pull request Jul 18, 2026
KristofferC pushed a commit that referenced this pull request Jul 18, 2026
@KristofferC KristofferC removed the backport 1.13 Change should be backported to release-1.13 label Jul 20, 2026
KristofferC pushed a commit that referenced this pull request Jul 21, 2026
KristofferC pushed a commit that referenced this pull request Jul 21, 2026
KristofferC pushed a commit that referenced this pull request Jul 24, 2026
DilumAluthge pushed a commit that referenced this pull request Jul 25, 2026
KristofferC pushed a commit that referenced this pull request Aug 7, 2026
KristofferC pushed a commit that referenced this pull request Aug 8, 2026
KristofferC pushed a commit that referenced this pull request Aug 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport 1.12 Change should be backported to release-1.12

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants