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

tough: Fix race condition in system_time #591

Merged
merged 1 commit into from
Mar 20, 2023

Conversation

ecpullen
Copy link
Contributor

@ecpullen ecpullen commented Mar 20, 2023

Issue #, if available:
#590

Description of changes:
Fixes a race condition when verifying the system time by swapping the order the times are retrieved. By getting Utc::now() before the last known time, a separate thread could change the value immediately before it is read causing the last known time to be later than the time determined by Utc::now() by changing the order the time variables are retrieved, this race condition is no longer possible.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@ecpullen ecpullen marked this pull request as ready for review March 20, 2023 23:32
@ecpullen ecpullen merged commit 1b1769e into awslabs:develop Mar 20, 2023
@ecpullen ecpullen deleted the system-time-race branch March 20, 2023 23:50
@ecpullen ecpullen restored the system-time-race branch March 21, 2023 00:19
@ecpullen ecpullen deleted the system-time-race branch March 21, 2023 15:31
@ecpullen ecpullen restored the system-time-race branch March 21, 2023 15:56
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.

3 participants