|
Size: 7558
Comment:
|
Size: 3326
Comment: converted to 1.6 markup
|
| Deletions are marked like this. | Additions are marked like this. |
| Line 1: | Line 1: |
| = The year 2038 problem = | ''unfortunately this page got deleted by accident, this version is restored from https://web.archive.org/web/20150318062024/http://kernelnewbies.org/y2038, but most of the formatting is still missing. '' == The year 2038 problem == |
| Line 4: | Line 6: |
| == User space interfaces == | === User space interfaces === |
| Line 7: | Line 9: |
| ==== System calls ==== System calls have been moved out [[[y2038/syscalls]]], that page is rather outdated, newer information is available at https://lwn.net/Articles/643234/ |
|
| Line 9: | Line 13: |
| === System calls === ==== interfaces that uses relative time_t/timespec/timeval ==== These can stay compatible, but we'd have to use a different type if we change time_t. |
==== File systems ==== |
| Line 13: | Line 15: |
| * nanosleep * select/pselect/poll/ppoll/epoll * getrusage (+ wait4?) |
Each file system stores its file modification times in its own format on disk, and a lot of them have the same problem. See also [[[y2038/vfs]]]. |
| Line 17: | Line 18: |
| * sched_rr_get_interval * sigtimedwait * alarm * Also: futex, recvmmsg, io_getevents? |
=== Tasks === 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. |
| Line 22: | Line 21: |
| ==== 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. |
==== Trivial tasks ==== Find a driver using time_t/timespec/timeval internally and convert it to ktime_t/timespec64, examples: |
| Line 25: | Line 24: |
| [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?] | * drivers/firewire/core-cdev.c * drivers/firewire/nosy.c * drivers/hv/hv_util.c * drivers/infiniband/hw/nes/ * drivers/misc/ibmasm/ibmasm.h * drivers/net/wireless/atmel.c * drivers/ide/pdc202xx_new.c * fs/fuse/dir.c * drivers/scsi/pmcraid.c |
| Line 27: | Line 34: |
| * getitimer/setitimer * timer_settime/timer_gettime(+timerfd_settime, timerfd_gettime?) |
==== Small tasks ==== Find a driver using time_t/timespec/timeval internally and convert it to ktime_t/timespec64, examples: |
| Line 30: | Line 37: |
| * gettimeofday/settimeofday * adjtimex * clock_gettime/clock_settime/clock_adjtime/clock_nanosleep(? what about clock_nanosleep TIMER_ABSTIME?) |
* drivers/block/sx8.c * drivers/char/ipmi/ipmi_ssif.c * drivers/char/mmtimer.c * drivers/cpufreq/speedstep-lib.c * drivers/hsi/clients/cmt_speech.c * drivers/media/platform/vivid/ * drivers/net/hamradio/baycom_ser_fdx.c |
| Line 34: | Line 45: |
| * time/stime * sysv ipc (msg, sem, shm) * sysinfo |
==== Medium tasks ==== * Modify an ioctl interface in a driver to support both 32- and 64-bit time interfaces, examples: * drivers/usb/misc/usbtest.c |
| Line 38: | Line 49: |
| ==== 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. |
* Convert the internal timekeeping in fs/nfsd |
| Line 41: | Line 51: |
| * stat/lstat/fstatat/ * utime/utimes/futimesa/utimensat |
* Convert all 'struct key' users (time_t) |
| Line 44: | Line 53: |
| === ioctl === There are numerous ioctl commands using a time argument. This list is incomplete |
* fix all uses of timeval in drivers/scsi/bfa |
| Line 47: | Line 55: |
| * audio time stamps * v4l time stamps * input event time stamps * socket time stamps * ... |
==== Advanced tasks ==== * Change the on-disk layout of a broken file system to optionally support longer time stamps |
| Line 53: | Line 58: |
| === 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. |
* Port a small C library (uClibc, newlib, ...) to optionally use 64-bit time_t and build an embedded distribution (openembedded, openwrt, buildroot, ...) with this. |
| Line 56: | Line 60: |
| * start migrating the times in 'struct inode' and 'struct 'kstat' to separate 64-bit second + 32-bit nanosecond fields. | |
| Line 57: | Line 62: |
| === Audit of include/uapi for time_t impact === | ==== Tasks later in the project ==== * Hook up all 32-bit architectures to use the new system calls |
| Line 59: | Line 65: |
| Structure and IOCTL dependency: {{{ 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 }}} Syscalls affected by the above types: {{{ 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 }}} == File systems == Each file system stores its file modification times in its own format on disk, and a lot of them have the same problem. || '''file system''' || '''time type''' || '''expiration year''' || || 9p (9P2000) || unsigned 32-bit seconds || 2106 || || 9p (9P2000.L) || signed 64-bit seconds, ns || never || || adfs || 40-bit cs since 1900 || 2248 || || affs || u32 days/mins/(secs/50) || 11760870 || || afs || unsigned 32-bit seconds || 2106 || || befs || unsigned 48-bit seconds || never || || bfs || unsigned 32-bit seconds || 2106 || || btrfs || signed 64-bit seconds, 32-bit ns || never || || ceph || unsigned 32-bit second/ns || 2106 || || cifs (smb) || 7-bit years since 1980 || 2107 || || cifs (modern) || 64-bit 100ns since 1601 || 30328 || || coda || timespec ioctl || 2038 || || cramfs || fixed || 1970 || || efs || unsigned 32-bit seconds || 2106 || || exofs || signed 32-bit seconds || 2038 || || ext2 || signed 32-bit seconds || 2038 || || ext3 || signed 32-bit seconds || 2038 || || ext4 (good old inodes) || signed 32-bit seconds || 2038 || || ext4 (new inodes || 34 bit seconds / 30-bit ns (but broken) || 2038 || || f2fs || 64-bit seconds / 32-bit ns || never || || fat || 7-bit years since 1980, 2s resolution || 2107 || || freevxfs || unsigned 32-bit seconds/u32 microseconds || 2106 || || fuse || 64-bit second/32-bit ns || never || || gfs2 || u64 seconds/u32 ns || never || || hfs || u32 seconds since 1904 || 2040 || || hfsplus || u32 seconds since 1904 || 2040 || || hostfs || timespec || 2038 || || hpfs || unsigned 32-bit seconds || 2106 || || isofs || 'char' year since 1900 (fixable) || 2028 (!) || || jffs2 || unsigned 32-bit seconds || 2106 || || jfs || unsigned 32-bit seconds/ns || 2106 || || logfs || signed 64-bit ns || 2262 || || minix || unsigned 32-bit seconds || 2106 || || ncpfs || 7-bit year since 1980 || 2107 || || nfsv2,v3 || unsigned 32-bit seconds/ns || 2106 || || nfsv4 || u64 seconds/u32 ns || never || || nfsd || unsigned 32-bit seconds/ns || 2106 || || nilfs2 || u64 seconds/u32 ns || never || || ntfs || 64-bit 100ns since 1601 || 30828 || || ocfs2 || 34-bit seconds/30-bit ns || 2514 || || omfs || 64-bit milliseconds || never || || pstore || ascii seconds || 2106 || || qnx4 || unsigned 32-bit seconds || 2106 || || qnx6 || unsigned 32-bit seconds || 2106 || || reiserfs || unsigned 32-bit seconds || 2106 || || romfs || fixed || 1970 || || squashfs || unsigned 32-bit seconds || 2106 || || sysv || unsigned 32-bit seconds || 2106 || || ubifs || u64 second/u32 ns || never || || udf || u16 year || 2038 || || ufs1 || unsigned 32-bit seconds || 2106 || || ufs2 || signed 64-bit seconds/u32 ns ||never || || xfs || signed 32-bit seconds/ns || 2106 || |
* Introduce a Kconfig symbol to disable all code that has not yet been converted at compile time. |
unfortunately this page got deleted by accident, this version is restored from https://web.archive.org/web/20150318062024/http://kernelnewbies.org/y2038, but most of the formatting is still missing.
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.
System calls
System calls have been moved out [y2038/syscalls], that page is rather outdated, newer information is available at https://lwn.net/Articles/643234/
File systems
Each file system stores its file modification times in its own format on disk, and a lot of them have the same problem. See also [y2038/vfs].
Tasks
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.
Trivial tasks
Find a driver using time_t/timespec/timeval internally and convert it to ktime_t/timespec64, examples:
- drivers/firewire/core-cdev.c
- drivers/firewire/nosy.c
- drivers/hv/hv_util.c
- drivers/infiniband/hw/nes/
- drivers/misc/ibmasm/ibmasm.h
- drivers/net/wireless/atmel.c
- drivers/ide/pdc202xx_new.c
- fs/fuse/dir.c
- drivers/scsi/pmcraid.c
Small tasks
Find a driver using time_t/timespec/timeval internally and convert it to ktime_t/timespec64, examples:
- drivers/block/sx8.c
- drivers/char/ipmi/ipmi_ssif.c
- drivers/char/mmtimer.c
- drivers/cpufreq/speedstep-lib.c
- drivers/hsi/clients/cmt_speech.c
- drivers/media/platform/vivid/
- drivers/net/hamradio/baycom_ser_fdx.c
Medium tasks
- Modify an ioctl interface in a driver to support both 32- and 64-bit time interfaces, examples:
- drivers/usb/misc/usbtest.c
- Convert the internal timekeeping in fs/nfsd
- Convert all 'struct key' users (time_t)
- fix all uses of timeval in drivers/scsi/bfa
Advanced tasks
- Change the on-disk layout of a broken file system to optionally support longer time stamps
- Port a small C library (uClibc, newlib, ...) to optionally use 64-bit time_t and build an embedded distribution (openembedded, openwrt, buildroot, ...) with this.
- start migrating the times in 'struct inode' and 'struct 'kstat' to separate 64-bit second + 32-bit nanosecond fields.
Tasks later in the project
- Hook up all 32-bit architectures to use the new system calls
- Introduce a Kconfig symbol to disable all code that has not yet been converted at compile time.