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
F103281251: D9279.diff
Sat, Nov 23, 12:51 AM
Unknown Object (File)
Fri, Nov 1, 2:26 PM
Unknown Object (File)
Mon, Oct 28, 2:53 AM
Unknown Object (File)
Oct 20 2024, 4:22 PM
Unknown Object (File)
Oct 4 2024, 11:21 PM
Unknown Object (File)
Oct 3 2024, 10:04 PM
Unknown Object (File)
Oct 2 2024, 6:00 AM
Unknown Object (File)
Oct 1 2024, 1:43 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.