Page MenuHomeFreeBSD

timerfd: Use saturating sbintime conversions
ClosedPublic

Authored by jfree on Tue, Mar 10, 12:51 AM.
Tags
None
Referenced Files
F151028759: D55792.diff
Sun, Apr 5, 1:17 PM
Unknown Object (File)
Fri, Apr 3, 11:35 PM
Unknown Object (File)
Fri, Apr 3, 12:11 PM
Unknown Object (File)
Wed, Apr 1, 9:22 PM
Unknown Object (File)
Wed, Apr 1, 4:26 AM
Unknown Object (File)
Wed, Mar 25, 9:13 AM
Unknown Object (File)
Fri, Mar 20, 10:29 PM
Unknown Object (File)
Fri, Mar 20, 2:32 PM
Subscribers

Details

Summary

Some timerfd consumers set expirations with timespec tv_sec components
larger than 2^31 - 1. In such cases, converting that timespec to
sbintime results in data loss or sign flip, yielding a shorter
expiration than desired.

To avoid this problem, use saturating timespec-to-sbintime conversion
functions. These will clamp the converted sbintime to SBT_MAX under
circumstances where the normal conversion functions would overflow.

Saturating conversions still result in data loss, but the consequences
are less severe, causing problems only after SBT_MAX (~68 years) of
system uptime elapses.

Diff Detail

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

Event Timeline

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

Is this covered by the timerfd tests you posted already?

sys/kern/sys_timerfd.c
404

Do you need to catch overflow here too?

Saturate next expiration sbintime

This revision now requires review to proceed.Fri, Mar 20, 6:36 AM
This revision is now accepted and ready to land.Fri, Mar 20, 6:41 AM
This revision was automatically updated to reflect the committed changes.