Skip to content

Commit

Permalink
Merge tag 'y2038-timekeeping' of git://git.kernel.org/pub/scm/linux/k…
Browse files Browse the repository at this point in the history
…ernel/git/arnd/playground into timers/core

Pull y2038 timekeeping syscall changes from Arnd Bergmann:

This is the first set of system call entry point changes to enable 32-bit
architectures to have variants on both 32-bit and 64-bit time_t. Typically
these system calls take a 'struct timespec' argument, but that structure
is defined in user space by the C library and its layout will change.

The kernel already supports handling the 32-bit time_t on 64-bit
architectures through the CONFIG_COMPAT mechanism. As there are a total
of 51 system calls suffering from this problem, reusing that mechanism
on 32-bit architectures.

We already have patches for most of the remaining system calls, but this
set contains most of the complexity and is best tested.  There was one
last-minute regression that prevented it from going into 4.17, but that
is fixed now.

More details from Deepa's patch series description:

   Big picture is as per the lwn article:
   https://lwn.net/Articles/643234/ [2]

   The series is directed at converting posix clock syscalls:
   clock_gettime, clock_settime, clock_getres and clock_nanosleep
   to use a new data structure __kernel_timespec at syscall boundaries.
   __kernel_timespec maintains 64 bit time_t across all execution modes.

   vdso will be handled as part of each architecture when they enable
   support for 64 bit time_t.

   The compat syscalls are repurposed to provide backward compatibility
   by using them as native syscalls as well for 32 bit architectures.
   They will continue to use timespec at syscall boundaries.

   CONFIG_64_BIT_TIME controls whether the syscalls use __kernel_timespec
   or timespec at syscall boundaries.

   The series does the following:
   1. Enable compat syscalls on 32 bit architectures.
   2. Add a new __kernel_timespec type to be used as the data structure
      for all the new syscalls.
   3. Add new config CONFIG_64BIT_TIME(intead of the CONFIG_COMPAT_TIME in
      [1] and [2] to switch to new definition of __kernel_timespec. It is
      the same as struct timespec otherwise.
   4. Add new CONFIG_32BIT_TIME to conditionally compile compat syscalls.
  • Loading branch information
Thomas Gleixner committed Apr 19, 2018
2 parents 87ef120 + 0190997 commit 1cfd904
Show file tree
Hide file tree
Showing 57 changed files with 201 additions and 176 deletions.
15 changes: 15 additions & 0 deletions arch/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -870,6 +870,21 @@ config OLD_SIGACTION
config COMPAT_OLD_SIGACTION
bool

config 64BIT_TIME
def_bool ARCH_HAS_64BIT_TIME
help
This should be selected by all architectures that need to support
new system calls with a 64-bit time_t. This is relevant on all 32-bit
architectures, and 64-bit architectures as part of compat syscall
handling.

config COMPAT_32BIT_TIME
def_bool (!64BIT && 64BIT_TIME) || COMPAT
help
This enables 32 bit time_t support in addition to 64 bit time_t support.
This is relevant on all 32-bit architectures, and 64-bit architectures
as part of compat syscall handling.

config ARCH_NO_COHERENT_DMA_MMAP
bool

Expand Down
1 change: 1 addition & 0 deletions arch/alpha/include/asm/Kbuild
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# SPDX-License-Identifier: GPL-2.0


generic-y += compat.h
generic-y += exec.h
generic-y += export.h
generic-y += fb.h
Expand Down
1 change: 1 addition & 0 deletions arch/arc/include/asm/Kbuild
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# SPDX-License-Identifier: GPL-2.0
generic-y += bugs.h
generic-y += compat.h
generic-y += device.h
generic-y += div64.h
generic-y += emergency-restart.h
Expand Down
1 change: 1 addition & 0 deletions arch/arm/include/asm/Kbuild
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
generic-y += compat.h
generic-y += current.h
generic-y += early_ioremap.h
generic-y += emergency-restart.h
Expand Down
11 changes: 0 additions & 11 deletions arch/arm64/include/asm/compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@

typedef u32 compat_size_t;
typedef s32 compat_ssize_t;
typedef s32 compat_time_t;
typedef s32 compat_clock_t;
typedef s32 compat_pid_t;
typedef u16 __compat_uid_t;
Expand Down Expand Up @@ -66,16 +65,6 @@ typedef u32 compat_ulong_t;
typedef u64 compat_u64;
typedef u32 compat_uptr_t;

struct compat_timespec {
compat_time_t tv_sec;
s32 tv_nsec;
};

struct compat_timeval {
compat_time_t tv_sec;
s32 tv_usec;
};

struct compat_stat {
#ifdef __AARCH64EB__
short st_dev;
Expand Down
1 change: 1 addition & 0 deletions arch/arm64/include/asm/stat.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

#ifdef CONFIG_COMPAT

#include <linux/compat_time.h>
#include <asm/compat.h>

/*
Expand Down
1 change: 0 additions & 1 deletion arch/arm64/kernel/hw_breakpoint.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
#include <linux/smp.h>
#include <linux/uaccess.h>

#include <asm/compat.h>
#include <asm/current.h>
#include <asm/debug-monitors.h>
#include <asm/hw_breakpoint.h>
Expand Down
2 changes: 1 addition & 1 deletion arch/arm64/kernel/perf_regs.c
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// SPDX-License-Identifier: GPL-2.0
#include <linux/compat.h>
#include <linux/errno.h>
#include <linux/kernel.h>
#include <linux/perf_event.h>
#include <linux/bug.h>
#include <linux/sched/task_stack.h>

#include <asm/compat.h>
#include <asm/perf_regs.h>
#include <asm/ptrace.h>

Expand Down
1 change: 1 addition & 0 deletions arch/c6x/include/asm/Kbuild
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
generic-y += atomic.h
generic-y += barrier.h
generic-y += bugs.h
generic-y += compat.h
generic-y += current.h
generic-y += device.h
generic-y += div64.h
Expand Down
1 change: 1 addition & 0 deletions arch/h8300/include/asm/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ generic-y += barrier.h
generic-y += bugs.h
generic-y += cacheflush.h
generic-y += checksum.h
generic-y += compat.h
generic-y += current.h
generic-y += delay.h
generic-y += device.h
Expand Down
1 change: 1 addition & 0 deletions arch/hexagon/include/asm/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
generic-y += barrier.h
generic-y += bug.h
generic-y += bugs.h
generic-y += compat.h
generic-y += current.h
generic-y += device.h
generic-y += div64.h
Expand Down
1 change: 1 addition & 0 deletions arch/ia64/include/asm/Kbuild
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
generic-y += compat.h
generic-y += exec.h
generic-y += irq_work.h
generic-y += mcs_spinlock.h
Expand Down
1 change: 1 addition & 0 deletions arch/m68k/include/asm/Kbuild
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
generic-y += barrier.h
generic-y += compat.h
generic-y += device.h
generic-y += emergency-restart.h
generic-y += exec.h
Expand Down
1 change: 1 addition & 0 deletions arch/microblaze/include/asm/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ generic-y += barrier.h
generic-y += bitops.h
generic-y += bug.h
generic-y += bugs.h
generic-y += compat.h
generic-y += device.h
generic-y += div64.h
generic-y += emergency-restart.h
Expand Down
11 changes: 0 additions & 11 deletions arch/mips/include/asm/compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

typedef u32 compat_size_t;
typedef s32 compat_ssize_t;
typedef s32 compat_time_t;
typedef s32 compat_clock_t;
typedef s32 compat_suseconds_t;

Expand Down Expand Up @@ -46,16 +45,6 @@ typedef u32 compat_ulong_t;
typedef u64 compat_u64;
typedef u32 compat_uptr_t;

struct compat_timespec {
compat_time_t tv_sec;
s32 tv_nsec;
};

struct compat_timeval {
compat_time_t tv_sec;
s32 tv_usec;
};

struct compat_stat {
compat_dev_t st_dev;
s32 st_pad1[3];
Expand Down
2 changes: 1 addition & 1 deletion arch/mips/kernel/signal32.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
* Copyright (C) 1999, 2000 Silicon Graphics, Inc.
* Copyright (C) 2016, Imagination Technologies Ltd.
*/
#include <linux/compat.h>
#include <linux/compiler.h>
#include <linux/errno.h>
#include <linux/kernel.h>
#include <linux/signal.h>
#include <linux/syscalls.h>

#include <asm/compat.h>
#include <asm/compat-signal.h>
#include <linux/uaccess.h>
#include <asm/unistd.h>
Expand Down
1 change: 1 addition & 0 deletions arch/nds32/include/asm/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ generic-y += checksum.h
generic-y += clkdev.h
generic-y += cmpxchg.h
generic-y += cmpxchg-local.h
generic-y += compat.h
generic-y += cputime.h
generic-y += device.h
generic-y += div64.h
Expand Down
1 change: 1 addition & 0 deletions arch/nios2/include/asm/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ generic-y += bitops.h
generic-y += bug.h
generic-y += bugs.h
generic-y += cmpxchg.h
generic-y += compat.h
generic-y += current.h
generic-y += device.h
generic-y += div64.h
Expand Down
1 change: 1 addition & 0 deletions arch/openrisc/include/asm/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ generic-y += barrier.h
generic-y += bug.h
generic-y += bugs.h
generic-y += checksum.h
generic-y += compat.h
generic-y += current.h
generic-y += device.h
generic-y += div64.h
Expand Down
11 changes: 0 additions & 11 deletions arch/parisc/include/asm/compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

typedef u32 compat_size_t;
typedef s32 compat_ssize_t;
typedef s32 compat_time_t;
typedef s32 compat_clock_t;
typedef s32 compat_pid_t;
typedef u32 __compat_uid_t;
Expand All @@ -40,16 +39,6 @@ typedef u32 compat_ulong_t;
typedef u64 compat_u64;
typedef u32 compat_uptr_t;

struct compat_timespec {
compat_time_t tv_sec;
s32 tv_nsec;
};

struct compat_timeval {
compat_time_t tv_sec;
s32 tv_usec;
};

struct compat_stat {
compat_dev_t st_dev; /* dev_t is 32 bits on parisc */
compat_ino_t st_ino; /* 32 bits */
Expand Down
11 changes: 0 additions & 11 deletions arch/powerpc/include/asm/compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

typedef u32 compat_size_t;
typedef s32 compat_ssize_t;
typedef s32 compat_time_t;
typedef s32 compat_clock_t;
typedef s32 compat_pid_t;
typedef u32 __compat_uid_t;
Expand Down Expand Up @@ -45,16 +44,6 @@ typedef u32 compat_ulong_t;
typedef u64 compat_u64;
typedef u32 compat_uptr_t;

struct compat_timespec {
compat_time_t tv_sec;
s32 tv_nsec;
};

struct compat_timeval {
compat_time_t tv_sec;
s32 tv_usec;
};

struct compat_stat {
compat_dev_t st_dev;
compat_ino_t st_ino;
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/kernel/asm-offsets.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* 2 of the License, or (at your option) any later version.
*/

#include <linux/compat.h>
#include <linux/signal.h>
#include <linux/sched.h>
#include <linux/kernel.h>
Expand Down Expand Up @@ -42,7 +43,6 @@
#include <asm/paca.h>
#include <asm/lppaca.h>
#include <asm/cache.h>
#include <asm/compat.h>
#include <asm/mmu.h>
#include <asm/hvcall.h>
#include <asm/xics.h>
Expand Down
1 change: 1 addition & 0 deletions arch/powerpc/oprofile/backtrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
* 2 of the License, or (at your option) any later version.
**/

#include <linux/compat_time.h>
#include <linux/oprofile.h>
#include <linux/sched.h>
#include <asm/processor.h>
Expand Down
1 change: 0 additions & 1 deletion arch/s390/hypfs/hypfs_sprp.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#include <linux/string.h>
#include <linux/types.h>
#include <linux/uaccess.h>
#include <asm/compat.h>
#include <asm/diag.h>
#include <asm/sclp.h>
#include "hypfs.h"
Expand Down
11 changes: 0 additions & 11 deletions arch/s390/include/asm/compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@

typedef u32 compat_size_t;
typedef s32 compat_ssize_t;
typedef s32 compat_time_t;
typedef s32 compat_clock_t;
typedef s32 compat_pid_t;
typedef u16 __compat_uid_t;
Expand Down Expand Up @@ -97,16 +96,6 @@ typedef struct {
u32 gprs_high[NUM_GPRS];
} s390_compat_regs_high;

struct compat_timespec {
compat_time_t tv_sec;
s32 tv_nsec;
};

struct compat_timeval {
compat_time_t tv_sec;
s32 tv_usec;
};

struct compat_stat {
compat_dev_t st_dev;
u16 __pad1;
Expand Down
4 changes: 2 additions & 2 deletions arch/s390/include/asm/elf.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,9 @@
* ELF register definitions..
*/

#include <linux/compat.h>

#include <asm/ptrace.h>
#include <asm/compat.h>
#include <asm/syscall.h>
#include <asm/user.h>

Expand All @@ -136,7 +137,6 @@ typedef s390_regs elf_gregset_t;
typedef s390_fp_regs compat_elf_fpregset_t;
typedef s390_compat_regs compat_elf_gregset_t;

#include <linux/compat.h>
#include <linux/sched/mm.h> /* for task_struct */
#include <asm/mmu_context.h>

Expand Down
1 change: 0 additions & 1 deletion arch/s390/kvm/priv.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#include <asm/gmap.h>
#include <asm/io.h>
#include <asm/ptrace.h>
#include <asm/compat.h>
#include <asm/sclp.h>
#include "gaccess.h"
#include "kvm-s390.h"
Expand Down
1 change: 0 additions & 1 deletion arch/s390/pci/pci_clp.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#include <linux/uaccess.h>
#include <asm/pci_debug.h>
#include <asm/pci_clp.h>
#include <asm/compat.h>
#include <asm/clp.h>
#include <uapi/asm/clp.h>

Expand Down
1 change: 1 addition & 0 deletions arch/sh/include/asm/Kbuild
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
generic-y += compat.h
generic-y += current.h
generic-y += delay.h
generic-y += div64.h
Expand Down
Loading

0 comments on commit 1cfd904

Please sign in to comment.