Page MenuHomeFreeBSD

sys/time: Add saturating sbt conversions
AcceptedPublic

Authored by jfree on Tue, Mar 10, 12:51 AM.
Tags
None
Referenced Files
F148034039: D55791.diff
Sun, Mar 15, 7:39 AM
Unknown Object (File)
Fri, Mar 13, 10:54 AM
Unknown Object (File)
Wed, Mar 11, 1:32 PM
Unknown Object (File)
Wed, Mar 11, 1:22 PM
Unknown Object (File)
Wed, Mar 11, 3:10 AM
Subscribers
None

Details

Reviewers
markj
imp
arrowd
Summary

When converting from timespec to sbintime, the timespec's 64-bit tv_sec
component is shifted to the left 32 bits, causing any information in the
upper 32 bits to be lost.

This data loss during conversion can turn timespecs with very large
tv_sec counters into sbintimes that represent much smaller time
durations.

Add tstosbt_sat() and tvtosbt_sat(), which are saturating versions of
tstosbt and tvtosbt. With these routines, any overflow resulting from
the conversion is clamped to [-SBT_MAX - 1, SBT_MAX].

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 71305
Build 68188: arc lint + arc unit

Event Timeline

This won't affect any current kernel consumers.

This revision is now accepted and ready to land.Tue, Mar 10, 1:11 AM