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
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
Unknown Object (File)
Jan 13 2024, 12:29 PM
Unknown Object (File)
Jan 4 2024, 7:39 AM
Unknown Object (File)
Dec 20 2023, 2:29 AM
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

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

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 โ†—(On Diff #24284)

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 โ†—(On Diff #24284)

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.