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, Dec 11, 3:52 PM
Unknown Object (File)
Mon, Dec 1, 1:13 AM
Unknown Object (File)
Sun, Nov 30, 7:22 PM
Unknown Object (File)
Fri, Nov 28, 1:48 AM
Unknown Object (File)
Wed, Nov 26, 1:33 PM
Unknown Object (File)
Sun, Nov 23, 5:28 AM
Unknown Object (File)
Nov 15 2025, 8:30 PM
Unknown Object (File)
Nov 12 2025, 11:27 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.