Page MenuHomeFreeBSD

clockcalib: Fix an overflow bug
ClosedPublic

Authored by markj on Jan 19 2022, 10:49 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, May 15, 8:43 PM
Unknown Object (File)
Apr 14 2025, 2:38 AM
Unknown Object (File)
Apr 10 2025, 1:14 PM
Unknown Object (File)
Mar 21 2025, 6:22 PM
Unknown Object (File)
Mar 7 2025, 7:26 PM
Unknown Object (File)
Feb 26 2025, 12:18 AM
Unknown Object (File)
Feb 22 2025, 2:26 PM
Unknown Object (File)
Feb 22 2025, 1:53 PM

Details

Summary

tc_counter_mask is an unsigned int and in the TSC timecounter is equal
to UINT_MAX, so the addition tc->tc_counter_mask + 1 can overflow to 0,
resulting in a hang during boot.

Fixes: c2705ceaeb09 ("x86: Speed up clock calibration")

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Oops! Thanks for catching this.

This revision is now accepted and ready to land.Jan 20 2022, 5:49 AM
This revision was automatically updated to reflect the committed changes.

@markj could it be possible to backport this fix to the FreeBSD 13.1 while there is still time?
My FreeBSD 13.1 VM (virtualbox) freezes randomly during boot and this commit fixes it.

@markj could it be possible to backport this fix to the FreeBSD 13.1 while there is still time?
My FreeBSD 13.1 VM (virtualbox) freezes randomly during boot and this commit fixes it.

Oh. Ugh. I didn't realize that this was never backported. :(

And of course RC6 is already building. Ok, I'll see what I can do. Thanks for the report.