The year 2038 problem
All 32-bit kernels to date use a signed 32-bit time_t type, which can only represent time until January 2038. Since embedded systems running 32-bit Linux are going to survive beyond that date, we have to change all current uses, in a backwards compatible way.
User space interfaces
We will likely keep the 32-bit time_t in all user space interfaces that currently use it, but add new interfaces with a 64-bit timespec or another type that can represent later times. Most importantly that impacts system calls, but also specific ioctl commands and a few other interfaces. User space programs have to be recompiled to use the new interfaces, and the policy whether to use the old or the time time is left to the C library. While that policy is a complex topic itself, we don't cover it here.
interfaces that uses relative time_t/timespec/timeval
interfaces that don't make sense for times in the past
Here, we are relatively free to change the start of the epoch in the kernel but convert to something else on the user space boundary. One possibility is to scale them to boot time and use ktime_t in the kernel.
[Does checkpoint/restore have any implications here wrt to how freely we can change the start of the epoch? E.g., when freezing/restoring processed from different systems that have timer_settime() timers?]
interfaces that require absolute times
These absolutely have to use something better than time_t both in user space and in the kernel so we can deal with old files. A lot of file systems need to be fixed as well so we can actually store the times, regardless of whether we are running a 32 or 64 bit kernel.
memory mapped packet sockets
Socket timestamps are exported to user space using a memory mapped interface defined in include/uapi/linux/if_packet.h. There are currently three versions of this interface, all use a 32-bit time type. We will likely need a version 4 to solve this.
Audit of include/uapi for time_t impact
time_t struct msqid64_ds (has 2038 padding!) struct semid64_ds (has 2038 padding!) struct cyclades_idle_stats struct video_event VIDEO_GET_EVENT struct msqid_ds struct ppp_idle PPPIOCGIDLE struct semid_ds union semun struct timespec SIOCGSTAMPNS struct coda_vattr ... struct scm_timestamping struct som_hdr struct itimerspec struct v4l2_event VIDIOC_DQEVENT struct snd_pcm_status SNDRV_PCM_IOCTL_STATUS struct snd_pcm_mmap_status struct snd_pcm_sync_ptr SNDRV_PCM_IOCTL_SYNC_PTR struct snd_rawmidi_status SNDRV_RAWMIDI_IOCTL_STATUS struct snd_timer_status SNDRV_TIMER_IOCTL_STATUS struct snd_timer_tread struct snd_ctl_elem_value SNDRV_CTL_IOCTL_ELEM_READ SNDRV_CTL_IOCTL_ELEM_WRITE struct timeval SIOCGSTAMP struct zatm_t_hist struct bcm_msg_head struct elf_prstatus struct input_event struct omap3isp_stat_data VIDIOC_OMAP3ISP_STAT_REQ PPGETTIME PPSETTIME struct rusage struct itimerval struct timex struct v4l2_buffer VIDIOC_QUERYBUF VIDIOC_QBUF VIDIOC_DQBUF VIDIOC_PREPARE_BUF struct utimbuf
sys_time sys_stime sys_nanosleep sys_clock_settime sys_clock_gettime sys_clock_getres sys_clock_nanosleep sys_sched_rr_get_interval sys_futex sys_rt_sigtimedwait sys_io_getevents sys_recvmmsg sys_semtimedop sys_mq_timedsend sys_mq_timedreceive sys_utimensat sys_pselect6 sys_ppoll sys_gettimeofday sys_settimeofday sys_utimes sys_select sys_futimesat sys_utime sys_timer_gettime sys_timer_settime sys_timerfd_settime sys_timerfd_gettime sys_wait4 sys_waitid sys_getrusage sys_getitimer sys_setitimer sys_adjtimex sys_clock_adjtime
The task list is for people that want to get involved, there will be many more tasks over time, so this is just a starting point. In the end, we should remove all instances of 'time_t', 'timespec' and 'timeval' from the kernel.
drivers/staging/bcm/LeakyBucket.c (timeval, slightly tricky)