troglobit / sysklogd

BSD syslog daemon with syslog()/syslogp() API replacement for Linux, RFC3164 + RFC5424
https://troglobit.com/sysklogd.html
Other
89 stars 20 forks source link

syslogd keeps asserting around epochalypse (2038) #43

Closed troglobit closed 2 years ago

troglobit commented 2 years ago

Anonymous user reports strange behavior when starting up a 32-bit ARM based device around the time of the epochalypse (UNIX 2038 problem):

  1. Set clock to 2038, e,g, "date 2038-01-14"
  2. Reboot
  3. See what happens -- the behaviour will be strange, e.g, syslog continously restarting, ....
  4. Set clock back to current date, e.g., "date 2021-09-02 11:27"
  5. Reboot unit
  6. Everything seems to be normal

When receiving a syslog message, remote or local, in RFC3164 format, syslogd enters the parsemsg() function and delegates to parsemsg_rfc3164() for processing. In the above scenario the following occurs:

root@right:~# date
Tue Jan 19 03:13:13 UTC 2038
root@right:~# syslogd: syslogd.c:1042: parsemsg_rfc3164: Assertion `year >= tm_now.tm_year - 1' failed.

What we want is for syslogd to handle this more gracefully, possibly fall back to time(NULL), i.e. time now.