Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Safer Atomic assignment on ARM #302

Merged
merged 2 commits into from
Aug 20, 2024
Merged

Safer Atomic assignment on ARM #302

merged 2 commits into from
Aug 20, 2024

Conversation

kriszyp
Copy link
Owner

@kriszyp kriszyp commented Aug 20, 2024

On ARM processors, use a safer Atomic assignment to avoid memory reordering race condition with setting the flag/status of an instruction, #294

…dering race condition with setting the flag/status of an instruction, #294
@kriszyp kriszyp changed the title On ARM processors, use a safer Atomic assignment to avoid memory reor… Safer Atomic assignment on ARM Aug 20, 2024
Copy link
Collaborator

@Ethan-Arrowood Ethan-Arrowood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ran the issue script locally with this branch and it never crashed (ran for ~20mins). Previously it'd crash instantly, so I consider this solved!

// That is, if we are on x64 architecture...
if (arch === 'x64') {
writeStatus = uint32[flagPosition];
uint32[flagPosition] = flags;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be consistent with Atomics.or this should be a |=, but if uint32 is made up of only 0 s then it makes no difference.

@kriszyp kriszyp merged commit f74c02d into master Aug 20, 2024
6 checks passed
@kriszyp kriszyp deleted the arm-memory-safety branch August 20, 2024 20:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants