Bug 267157 - system reboots when date is set far in the future
Summary: system reboots when date is set far in the future
Status: In Progress
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 13.1-RELEASE
Hardware: amd64 Any
: --- Affects Many People
Assignee: Alan Somers
URL: https://reviews.freebsd.org/D37030
Keywords:
Depends on:
Blocks:
 
Reported: 2022-10-17 19:11 UTC by jschauma
Modified: 2022-10-23 17:26 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description jschauma 2022-10-17 19:11:03 UTC
As noted in this thread:
https://lists.freebsd.org/archives/freebsd-hackers/2022-October/001550.html

FreeBSD/amd64 13.1R on at least AWS instances ami-0cf377776fddcf8ba spontaneously reboot if the date is set to values larger than epoch 49282253052249598.

(On 13.0R / ami-00e91cb82b335d15f, this cut-off date appears to be epoch 44093078356492799.)

To reproduce:
Boot an instance of the given AMI above and log in as ec2-user.

$ su
# date -f "%s" 49282253052249598
Fri Dec 31 23:59:58 UTC 1561694399
# date -f "%s" 49282253052249599
Fri Dec 31 23:59:59 UTC 1561694399
[ reboots ~three seconds later ]

Rather than leading to a reboot, settimeofday(2) (I'm guessing) should return EINVAL.

asomers@ noted that assertions in https://github.com/freebsd/freebsd-src/commit/90a79ac5765a09d48b085183503324584ef0f956 could be added.