Page MenuHomeFreeBSD

Use time_t for intermediate values to avoid overflow in clock_ts_to_ct
ClosedPublic

Authored by cem on Jan 21 2017, 6:37 PM.
Tags
None
Referenced Files
F82948354: D9279.diff
Sat, May 4, 8:57 AM
Unknown Object (File)
Fri, May 3, 12:31 PM
Unknown Object (File)
Sun, Apr 28, 8:24 PM
Unknown Object (File)
Sun, Apr 14, 5:50 PM
Unknown Object (File)
Mon, Apr 8, 10:45 PM
Unknown Object (File)
Mar 4 2024, 1:45 AM
Unknown Object (File)
Feb 24 2024, 8:40 AM
Unknown Object (File)
Feb 19 2024, 5:02 PM
Subscribers
None

Details

Summary

Add additionally safety and overflow checks to clock_ts_to_ct and the
BCD routines while we're here.

PR: 211960
Submitted by: Justin McOmie <justin.mcomie at gmail.com>

Diff Detail

Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 6989
Build 7170: arc lint + arc unit

Event Timeline

cem retitled this revision from to Use time_t for intermediate values to avoid overflow in clock_ts_to_ct.
cem updated this object.
cem edited the test plan for this revision. (Show Details)
cem added reviewers: jhb, kib.
sys/kern/subr_clock.c
218

Theoretically, this is a right assert to have (modulo the upper cap on the acceptable years value). Practically, this means that the assert can be immediately triggered from userspace by root. See PR 214300 for the my thought about complete fix and the reciprocal workaround.

Be assured that bde also has opinion on this stuff.

sys/sys/libkern.h
52–81

Do not use protected namespace for normal code.

Add additional safety belt in clock_settime() per patch in pr 214300.

kib edited edge metadata.

Please do change __LEN_XXX to something that does not belong to implementation namespace.

This revision is now accepted and ready to land.Jan 24 2017, 5:24 PM
In D9279#192569, @kib wrote:

Please do change __LEN_XXX to something that does not belong to implementation namespace.

Ah, forgot about that. Sorry, just a minute.

cem edited edge metadata.

Replace __ prefix with LIBKERN_, to avoid name clashes without using reserved
namespace.

This revision now requires review to proceed.Jan 24 2017, 5:39 PM
kib edited edge metadata.
This revision is now accepted and ready to land.Jan 24 2017, 5:48 PM
This revision was automatically updated to reflect the committed changes.