Apologies for the overly long patch series, I was hoping this
would have been simpler.
This is my first draft of how we could modify the system call interface
in Linux to support user space with 64-bit time_t in addition to the
existing 32-bit time_t based interfaces. For the time being, I'm mainly
interested in feedback about the general approach, to see if this is
a reasonable concept, or whether we should do this in a completely
different way.
The current submission is for a relatively small group of people and
only for the y2038 mailing list, and if we can agree on the approach,
I will post it to a wider group of people and mailing lists next.
The overall approach I have taken here is as follows:
* Since 64-bit architectures already support two versions of each system
call that passes a time value in order to run 32-bit user space,
I'm not adding new system calls for the most part, but instead make
32-bit architectures use the same compat handlers that 64-bit
architectures already use.
* The existing syscall numbers are modified to point to the compat_sys_*
functions, and new numbers are assigned to point to the existing handlers
that now deal with 64-bit time_t based structures
* This series does not touch any ioctl implementation, but should be
otherwise complete regarding the system calls. We are still trying
to find out exactly which ioctls are affected and have not come
up with a complete list at this point. It's probably a good idea
though to do at least the essential ioctls before merging the series,
so we can have a better understanding of how it will be done in the
end.
* Each data structure we need to modify gets a new definition with a
__kernel_ prefix, e.g. struct __kernel_timespec to replace struct
timespec. This keeps the new structures out of the user libc
namespace, but still allows the structure to be integrated into
other data structures, e.g. for ioctl.
* There is no #ifdef in the UAPI headers at this point that would
check for the kind of user space that is in use. Unfortunately,
I believe we will need to add that in order to do some of the
particularly tricky ioctls later.
* At first, all system call implementations are modified, but this
is done in a way that is not supposed to have any ABI-visible
effect on existing architectures.
* After all system calls are converted, we can change one architecture
at a time to select ARCH_HAS_COMPAT_TIME, and modify its system
call table accordingly. In this version, I do it for ARM32, x86-32,
and x86-64 for demonstration purposes.
* A follow-up series changes over all other architectures.
* The last patch in the series changes the CONFIG_COMPAT_TIME
Kconfig symbol to be user visible. Disabling this symbol will
get you a kernel that intentionally breaks support for old tasks
in order to provide an interface that will survive 2038.
This is meant mostly as a debugging help for now, to let people
build a y2038 safe distro, but at some point in the 2030s, we
should remove that option and all the compat handling.
Arnd Bergmann (37):
initramfs: use vfs_stat/lstat directly
y2038: introduce linux/compat_time.h header
y2038: introduce CONFIG_COMPAT_TIME
y2038: make linux/compat_time.h usable on 32-bit
y2038: compile compat time code even when CONFIG_COMPAT is not set
y2038: add compat_sys_rt_sigtimedwait variants
y2038: introduce struct __kernel_rusage
y2038: introduce struct __kernel_timespec
y2038: introduce struct __kernel_stat
y2038: use timespec64 for poll/select/recvmmsg
y2038: add compat_{get,put}_timespec64
y2038: use __kernel_timespec in sys_aio_getevents
y2038: factor out compat fd_set and sigset handling
y2038: add compat handling for sys_recvmmsg
y2038: add compat handling for sys_semtimedop
y2038: extend sysvipc data structures for 64-bit time_t
y2038: ipc: report long times to user space
y2038: introduce {get,put}_itimerspec
y2038: use __kernel_itimerspec in timerfd
y2038: introduce compat_sys_pselect6_time64
y2038: introduce compat_sys_ppoll_time64
y2038: use __kernel_timespec for sys_mq_timed{send,receive}
y2038: make compat_sys_mq_timed{send,receive} usable on 32-bit
y2038: use __kernel_timespec in sys_utimensat
y2038: introduce timespec64_to_jiffies
y2038: use __kernel_timespec in sys_rt_sigtimedwait
y2038: use __kernel_timespec in sys_futex
y2038: introduce jiffies_to_timespec64
y2038: use __kernel_timespec in sys_sched_rr_get_interval
y2038: move compat posix time handling to posix-timers.c
y2038: introduce struct __kernel_timex
y2038: convert all timex users to use __kernel_timex
y2038: convert posix clock syscalls
y2038: ignore new syscalls for now
ARM: use CONFIG_COMPAT_TIME
x86: use COMPAT_SYS_TIME
[NOT YET] y2038: make CONFIG_COMPAT_TIME optional
arch/Kconfig | 12 ++
arch/alpha/include/asm/Kbuild | 4 +
arch/alpha/include/uapi/asm/ipcbuf.h | 1 -
arch/alpha/include/uapi/asm/msgbuf.h | 27 ---
arch/alpha/include/uapi/asm/sembuf.h | 22 --
arch/alpha/include/uapi/asm/shmbuf.h | 38 ----
arch/alpha/include/uapi/asm/stat.h | 4 +
arch/alpha/kernel/osf_sys.c | 8 +-
arch/arm/Kconfig | 1 +
arch/arm/include/asm/unistd.h | 11 +-
arch/arm/include/uapi/asm/stat.h | 2 +
arch/arm/include/uapi/asm/unistd.h | 22 ++
arch/arm/kernel/calls.S | 101 ++++++----
arch/arm/kernel/sys_oabi-compat.c | 9 +-
arch/arm64/include/asm/compat.h | 43 ++--
arch/avr32/include/asm/Kbuild | 4 +
arch/avr32/include/uapi/asm/Kbuild | 1 -
arch/avr32/include/uapi/asm/msgbuf.h | 31 ---
arch/avr32/include/uapi/asm/sembuf.h | 25 ---
arch/avr32/include/uapi/asm/shmbuf.h | 42 ----
arch/avr32/include/uapi/asm/stat.h | 2 +
arch/blackfin/include/uapi/asm/stat.h | 2 +
arch/cris/include/asm/Kbuild | 6 +-
arch/cris/include/uapi/asm/ipcbuf.h | 1 -
arch/cris/include/uapi/asm/msgbuf.h | 33 ---
arch/cris/include/uapi/asm/sembuf.h | 25 ---
arch/cris/include/uapi/asm/shmbuf.h | 42 ----
arch/cris/include/uapi/asm/stat.h | 2 +
arch/frv/include/asm/Kbuild | 4 +
arch/frv/include/uapi/asm/ipcbuf.h | 1 -
arch/frv/include/uapi/asm/msgbuf.h | 32 ---
arch/frv/include/uapi/asm/sembuf.h | 26 ---
arch/frv/include/uapi/asm/shmbuf.h | 43 ----
arch/frv/include/uapi/asm/stat.h | 2 +
arch/ia64/include/asm/Kbuild | 4 +
arch/ia64/include/uapi/asm/ipcbuf.h | 1 -
arch/ia64/include/uapi/asm/msgbuf.h | 27 ---
arch/ia64/include/uapi/asm/sembuf.h | 22 --
arch/ia64/include/uapi/asm/shmbuf.h | 38 ----
arch/ia64/include/uapi/asm/stat.h | 4 +
arch/m32r/include/asm/Kbuild | 4 +
arch/m32r/include/uapi/asm/ipcbuf.h | 1 -
arch/m32r/include/uapi/asm/msgbuf.h | 31 ---
arch/m32r/include/uapi/asm/sembuf.h | 25 ---
arch/m32r/include/uapi/asm/shmbuf.h | 42 ----
arch/m32r/include/uapi/asm/stat.h | 1 +
arch/m68k/include/uapi/asm/stat.h | 2 +
arch/mips/include/asm/compat.h | 49 ++---
arch/mips/include/uapi/asm/msgbuf.h | 56 ++++--
arch/mips/include/uapi/asm/sembuf.h | 15 +-
arch/mips/include/uapi/asm/shmbuf.h | 23 ++-
arch/mips/include/uapi/asm/stat.h | 1 +
arch/mn10300/include/asm/Kbuild | 4 +
arch/mn10300/include/uapi/asm/ipcbuf.h | 1 -
arch/mn10300/include/uapi/asm/msgbuf.h | 31 ---
arch/mn10300/include/uapi/asm/sembuf.h | 25 ---
arch/mn10300/include/uapi/asm/shmbuf.h | 42 ----
arch/mn10300/include/uapi/asm/stat.h | 2 +
arch/parisc/include/asm/compat.h | 43 ++--
arch/parisc/include/uapi/asm/msgbuf.h | 32 +--
arch/parisc/include/uapi/asm/sembuf.h | 13 +-
arch/parisc/include/uapi/asm/shmbuf.h | 18 +-
arch/parisc/include/uapi/asm/stat.h | 1 +
arch/powerpc/include/asm/compat.h | 43 ++--
arch/powerpc/include/uapi/asm/msgbuf.h | 18 +-
arch/powerpc/include/uapi/asm/sembuf.h | 14 +-
arch/powerpc/include/uapi/asm/shmbuf.h | 18 +-
arch/powerpc/include/uapi/asm/stat.h | 25 +++
arch/s390/include/asm/Kbuild | 4 +-
arch/s390/include/asm/compat.h | 43 ++--
arch/s390/include/uapi/asm/msgbuf.h | 37 ----
arch/s390/include/uapi/asm/sembuf.h | 29 ---
arch/s390/include/uapi/asm/shmbuf.h | 48 -----
arch/s390/include/uapi/asm/stat.h | 24 +++
arch/s390/kernel/time.c | 2 +-
arch/sh/include/uapi/asm/stat.h | 2 +
arch/sparc/include/asm/compat.h | 43 ++--
arch/sparc/include/uapi/asm/msgbuf.h | 21 +-
arch/sparc/include/uapi/asm/sembuf.h | 15 +-
arch/sparc/include/uapi/asm/shmbuf.h | 20 +-
arch/sparc/include/uapi/asm/stat.h | 28 +++
arch/tile/include/asm/compat.h | 43 ++--
arch/x86/Kconfig | 1 +
arch/x86/include/asm/compat.h | 44 ++--
arch/x86/include/asm/ftrace.h | 2 +-
arch/x86/include/asm/sys_ia32.h | 2 +-
arch/x86/include/asm/unistd.h | 21 +-
arch/x86/include/uapi/asm/msgbuf.h | 41 +++-
arch/x86/include/uapi/asm/sembuf.h | 10 +
arch/x86/include/uapi/asm/shmbuf.h | 58 +++++-
arch/x86/include/uapi/asm/stat.h | 49 +++--
arch/x86/kernel/cpu/perf_event.c | 2 +-
arch/x86/syscalls/syscall_32.tbl | 98 +++++----
arch/xtensa/include/uapi/asm/msgbuf.h | 24 +--
arch/xtensa/include/uapi/asm/sembuf.h | 16 +-
arch/xtensa/include/uapi/asm/shmbuf.h | 36 +---
arch/xtensa/include/uapi/asm/stat.h | 2 +
drivers/ptp/ptp_clock.c | 2 +-
fs/Makefile | 1 +
fs/aio.c | 54 +++--
fs/compat.c | 198 +++++++++++-------
fs/eventpoll.c | 12 +-
fs/select.c | 64 +++---
fs/stat.c | 12 +-
fs/timerfd.c | 13 +-
fs/utimes.c | 19 +-
include/linux/audit.h | 4 +-
include/linux/compat.h | 261 +++---------------------
include/linux/compat_time.h | 298 +++++++++++++++++++++++++++
include/linux/hrtimer.h | 2 +-
include/linux/jiffies.h | 23 ++-
include/linux/msg.h | 7 +-
include/linux/poll.h | 10 +-
include/linux/posix-clock.h | 2 +-
include/linux/posix-timers.h | 11 +-
include/linux/resource.h | 8 +-
include/linux/sem.h | 3 +-
include/linux/shm.h | 7 +-
include/linux/signal.h | 3 +-
include/linux/socket.h | 4 +-
include/linux/stat.h | 3 +
include/linux/syscalls.h | 73 ++++---
include/linux/thread_info.h | 8 +-
include/linux/time.h | 11 +-
include/linux/time64.h | 25 ++-
include/linux/timex.h | 6 +-
include/net/compat.h | 3 +
include/uapi/asm-generic/kernel_stat.h | 36 ++++
include/uapi/asm-generic/msgbuf.h | 16 +-
include/uapi/asm-generic/sembuf.h | 26 ++-
include/uapi/asm-generic/shmbuf.h | 16 +-
include/uapi/asm-generic/stat.h | 12 +-
include/uapi/linux/net.h | 1 +
include/uapi/linux/resource.h | 32 +++
include/uapi/linux/time.h | 17 ++
include/uapi/linux/timex.h | 45 +++++
init/do_mounts.h | 22 +-
init/initramfs.c | 14 +-
ipc/compat.c | 18 +-
ipc/compat_mq.c | 28 ---
ipc/mqueue.c | 140 +++++++++----
ipc/msg.c | 23 ++-
ipc/sem.c | 92 ++++++---
ipc/shm.c | 21 +-
ipc/syscall.c | 9 +-
kernel/Makefile | 1 +
kernel/audit.h | 2 +-
kernel/auditsc.c | 14 +-
kernel/compat.c | 340 +++++++++++++------------------
kernel/exit.c | 6 +-
kernel/futex.c | 10 +-
kernel/sched/core.c | 35 +++-
kernel/signal.c | 13 +-
kernel/sys.c | 23 ++-
kernel/sys_ni.c | 38 ++++
kernel/time/alarmtimer.c | 13 +-
kernel/time/hrtimer.c | 20 +-
kernel/time/ntp.c | 16 +-
kernel/time/ntp_internal.h | 4 +-
kernel/time/posix-clock.c | 2 +-
kernel/time/posix-cpu-timers.c | 14 +-
kernel/time/posix-timers.c | 357 ++++++++++++++++++++++++++++-----
kernel/time/time.c | 63 ++++--
kernel/time/timekeeping.c | 2 +-
net/compat.c | 18 +-
net/socket.c | 52 ++++-
scripts/checksyscalls.sh | 25 +++
167 files changed, 2564 insertions(+), 2289 deletions(-)
delete mode 100644 arch/alpha/include/uapi/asm/ipcbuf.h
delete mode 100644 arch/alpha/include/uapi/asm/msgbuf.h
delete mode 100644 arch/alpha/include/uapi/asm/sembuf.h
delete mode 100644 arch/alpha/include/uapi/asm/shmbuf.h
delete mode 100644 arch/avr32/include/uapi/asm/msgbuf.h
delete mode 100644 arch/avr32/include/uapi/asm/sembuf.h
delete mode 100644 arch/avr32/include/uapi/asm/shmbuf.h
delete mode 100644 arch/cris/include/uapi/asm/ipcbuf.h
delete mode 100644 arch/cris/include/uapi/asm/msgbuf.h
delete mode 100644 arch/cris/include/uapi/asm/sembuf.h
delete mode 100644 arch/cris/include/uapi/asm/shmbuf.h
delete mode 100644 arch/frv/include/uapi/asm/ipcbuf.h
delete mode 100644 arch/frv/include/uapi/asm/msgbuf.h
delete mode 100644 arch/frv/include/uapi/asm/sembuf.h
delete mode 100644 arch/frv/include/uapi/asm/shmbuf.h
delete mode 100644 arch/ia64/include/uapi/asm/ipcbuf.h
delete mode 100644 arch/ia64/include/uapi/asm/msgbuf.h
delete mode 100644 arch/ia64/include/uapi/asm/sembuf.h
delete mode 100644 arch/ia64/include/uapi/asm/shmbuf.h
delete mode 100644 arch/m32r/include/uapi/asm/ipcbuf.h
delete mode 100644 arch/m32r/include/uapi/asm/msgbuf.h
delete mode 100644 arch/m32r/include/uapi/asm/sembuf.h
delete mode 100644 arch/m32r/include/uapi/asm/shmbuf.h
delete mode 100644 arch/mn10300/include/uapi/asm/ipcbuf.h
delete mode 100644 arch/mn10300/include/uapi/asm/msgbuf.h
delete mode 100644 arch/mn10300/include/uapi/asm/sembuf.h
delete mode 100644 arch/mn10300/include/uapi/asm/shmbuf.h
delete mode 100644 arch/s390/include/uapi/asm/msgbuf.h
delete mode 100644 arch/s390/include/uapi/asm/sembuf.h
delete mode 100644 arch/s390/include/uapi/asm/shmbuf.h
create mode 100644 include/linux/compat_time.h
create mode 100644 include/uapi/asm-generic/kernel_stat.h
--
2.1.0.rc2