Skip to content

Commit 1cfd904

Browse files
committed
Merge tag 'y2038-timekeeping' of git://git.kernel.org/pub/scm/linux/kernel/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.
2 parents 87ef120 + 0190997 commit 1cfd904

File tree

57 files changed

+201
-176
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+201
-176
lines changed

arch/Kconfig

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -870,6 +870,21 @@ config OLD_SIGACTION
870870
config COMPAT_OLD_SIGACTION
871871
bool
872872

873+
config 64BIT_TIME
874+
def_bool ARCH_HAS_64BIT_TIME
875+
help
876+
This should be selected by all architectures that need to support
877+
new system calls with a 64-bit time_t. This is relevant on all 32-bit
878+
architectures, and 64-bit architectures as part of compat syscall
879+
handling.
880+
881+
config COMPAT_32BIT_TIME
882+
def_bool (!64BIT && 64BIT_TIME) || COMPAT
883+
help
884+
This enables 32 bit time_t support in addition to 64 bit time_t support.
885+
This is relevant on all 32-bit architectures, and 64-bit architectures
886+
as part of compat syscall handling.
887+
873888
config ARCH_NO_COHERENT_DMA_MMAP
874889
bool
875890

arch/alpha/include/asm/Kbuild

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# SPDX-License-Identifier: GPL-2.0
22

33

4+
generic-y += compat.h
45
generic-y += exec.h
56
generic-y += export.h
67
generic-y += fb.h

arch/arc/include/asm/Kbuild

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# SPDX-License-Identifier: GPL-2.0
22
generic-y += bugs.h
3+
generic-y += compat.h
34
generic-y += device.h
45
generic-y += div64.h
56
generic-y += emergency-restart.h

arch/arm/include/asm/Kbuild

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
generic-y += compat.h
12
generic-y += current.h
23
generic-y += early_ioremap.h
34
generic-y += emergency-restart.h

arch/arm64/include/asm/compat.h

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434

3535
typedef u32 compat_size_t;
3636
typedef s32 compat_ssize_t;
37-
typedef s32 compat_time_t;
3837
typedef s32 compat_clock_t;
3938
typedef s32 compat_pid_t;
4039
typedef u16 __compat_uid_t;
@@ -66,16 +65,6 @@ typedef u32 compat_ulong_t;
6665
typedef u64 compat_u64;
6766
typedef u32 compat_uptr_t;
6867

69-
struct compat_timespec {
70-
compat_time_t tv_sec;
71-
s32 tv_nsec;
72-
};
73-
74-
struct compat_timeval {
75-
compat_time_t tv_sec;
76-
s32 tv_usec;
77-
};
78-
7968
struct compat_stat {
8069
#ifdef __AARCH64EB__
8170
short st_dev;

arch/arm64/include/asm/stat.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
#ifdef CONFIG_COMPAT
2222

23+
#include <linux/compat_time.h>
2324
#include <asm/compat.h>
2425

2526
/*

arch/arm64/kernel/hw_breakpoint.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
#include <linux/smp.h>
3131
#include <linux/uaccess.h>
3232

33-
#include <asm/compat.h>
3433
#include <asm/current.h>
3534
#include <asm/debug-monitors.h>
3635
#include <asm/hw_breakpoint.h>

arch/arm64/kernel/perf_regs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
// SPDX-License-Identifier: GPL-2.0
2+
#include <linux/compat.h>
23
#include <linux/errno.h>
34
#include <linux/kernel.h>
45
#include <linux/perf_event.h>
56
#include <linux/bug.h>
67
#include <linux/sched/task_stack.h>
78

8-
#include <asm/compat.h>
99
#include <asm/perf_regs.h>
1010
#include <asm/ptrace.h>
1111

arch/c6x/include/asm/Kbuild

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
generic-y += atomic.h
22
generic-y += barrier.h
33
generic-y += bugs.h
4+
generic-y += compat.h
45
generic-y += current.h
56
generic-y += device.h
67
generic-y += div64.h

arch/h8300/include/asm/Kbuild

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ generic-y += barrier.h
33
generic-y += bugs.h
44
generic-y += cacheflush.h
55
generic-y += checksum.h
6+
generic-y += compat.h
67
generic-y += current.h
78
generic-y += delay.h
89
generic-y += device.h

arch/hexagon/include/asm/Kbuild

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
generic-y += barrier.h
33
generic-y += bug.h
44
generic-y += bugs.h
5+
generic-y += compat.h
56
generic-y += current.h
67
generic-y += device.h
78
generic-y += div64.h

arch/ia64/include/asm/Kbuild

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
generic-y += compat.h
12
generic-y += exec.h
23
generic-y += irq_work.h
34
generic-y += mcs_spinlock.h

arch/m68k/include/asm/Kbuild

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
generic-y += barrier.h
2+
generic-y += compat.h
23
generic-y += device.h
34
generic-y += emergency-restart.h
45
generic-y += exec.h

arch/microblaze/include/asm/Kbuild

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ generic-y += barrier.h
22
generic-y += bitops.h
33
generic-y += bug.h
44
generic-y += bugs.h
5+
generic-y += compat.h
56
generic-y += device.h
67
generic-y += div64.h
78
generic-y += emergency-restart.h

arch/mips/include/asm/compat.h

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414

1515
typedef u32 compat_size_t;
1616
typedef s32 compat_ssize_t;
17-
typedef s32 compat_time_t;
1817
typedef s32 compat_clock_t;
1918
typedef s32 compat_suseconds_t;
2019

@@ -46,16 +45,6 @@ typedef u32 compat_ulong_t;
4645
typedef u64 compat_u64;
4746
typedef u32 compat_uptr_t;
4847

49-
struct compat_timespec {
50-
compat_time_t tv_sec;
51-
s32 tv_nsec;
52-
};
53-
54-
struct compat_timeval {
55-
compat_time_t tv_sec;
56-
s32 tv_usec;
57-
};
58-
5948
struct compat_stat {
6049
compat_dev_t st_dev;
6150
s32 st_pad1[3];

arch/mips/kernel/signal32.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88
* Copyright (C) 1999, 2000 Silicon Graphics, Inc.
99
* Copyright (C) 2016, Imagination Technologies Ltd.
1010
*/
11+
#include <linux/compat.h>
1112
#include <linux/compiler.h>
1213
#include <linux/errno.h>
1314
#include <linux/kernel.h>
1415
#include <linux/signal.h>
1516
#include <linux/syscalls.h>
1617

17-
#include <asm/compat.h>
1818
#include <asm/compat-signal.h>
1919
#include <linux/uaccess.h>
2020
#include <asm/unistd.h>

arch/nds32/include/asm/Kbuild

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ generic-y += checksum.h
99
generic-y += clkdev.h
1010
generic-y += cmpxchg.h
1111
generic-y += cmpxchg-local.h
12+
generic-y += compat.h
1213
generic-y += cputime.h
1314
generic-y += device.h
1415
generic-y += div64.h

arch/nios2/include/asm/Kbuild

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ generic-y += bitops.h
44
generic-y += bug.h
55
generic-y += bugs.h
66
generic-y += cmpxchg.h
7+
generic-y += compat.h
78
generic-y += current.h
89
generic-y += device.h
910
generic-y += div64.h

arch/openrisc/include/asm/Kbuild

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ generic-y += barrier.h
22
generic-y += bug.h
33
generic-y += bugs.h
44
generic-y += checksum.h
5+
generic-y += compat.h
56
generic-y += current.h
67
generic-y += device.h
78
generic-y += div64.h

arch/parisc/include/asm/compat.h

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
typedef u32 compat_size_t;
1515
typedef s32 compat_ssize_t;
16-
typedef s32 compat_time_t;
1716
typedef s32 compat_clock_t;
1817
typedef s32 compat_pid_t;
1918
typedef u32 __compat_uid_t;
@@ -40,16 +39,6 @@ typedef u32 compat_ulong_t;
4039
typedef u64 compat_u64;
4140
typedef u32 compat_uptr_t;
4241

43-
struct compat_timespec {
44-
compat_time_t tv_sec;
45-
s32 tv_nsec;
46-
};
47-
48-
struct compat_timeval {
49-
compat_time_t tv_sec;
50-
s32 tv_usec;
51-
};
52-
5342
struct compat_stat {
5443
compat_dev_t st_dev; /* dev_t is 32 bits on parisc */
5544
compat_ino_t st_ino; /* 32 bits */

arch/powerpc/include/asm/compat.h

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717

1818
typedef u32 compat_size_t;
1919
typedef s32 compat_ssize_t;
20-
typedef s32 compat_time_t;
2120
typedef s32 compat_clock_t;
2221
typedef s32 compat_pid_t;
2322
typedef u32 __compat_uid_t;
@@ -45,16 +44,6 @@ typedef u32 compat_ulong_t;
4544
typedef u64 compat_u64;
4645
typedef u32 compat_uptr_t;
4746

48-
struct compat_timespec {
49-
compat_time_t tv_sec;
50-
s32 tv_nsec;
51-
};
52-
53-
struct compat_timeval {
54-
compat_time_t tv_sec;
55-
s32 tv_usec;
56-
};
57-
5847
struct compat_stat {
5948
compat_dev_t st_dev;
6049
compat_ino_t st_ino;

arch/powerpc/kernel/asm-offsets.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
* 2 of the License, or (at your option) any later version.
1414
*/
1515

16+
#include <linux/compat.h>
1617
#include <linux/signal.h>
1718
#include <linux/sched.h>
1819
#include <linux/kernel.h>
@@ -42,7 +43,6 @@
4243
#include <asm/paca.h>
4344
#include <asm/lppaca.h>
4445
#include <asm/cache.h>
45-
#include <asm/compat.h>
4646
#include <asm/mmu.h>
4747
#include <asm/hvcall.h>
4848
#include <asm/xics.h>

arch/powerpc/oprofile/backtrace.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
* 2 of the License, or (at your option) any later version.
88
**/
99

10+
#include <linux/compat_time.h>
1011
#include <linux/oprofile.h>
1112
#include <linux/sched.h>
1213
#include <asm/processor.h>

arch/s390/hypfs/hypfs_sprp.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
#include <linux/string.h>
1414
#include <linux/types.h>
1515
#include <linux/uaccess.h>
16-
#include <asm/compat.h>
1716
#include <asm/diag.h>
1817
#include <asm/sclp.h>
1918
#include "hypfs.h"

arch/s390/include/asm/compat.h

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@
5353

5454
typedef u32 compat_size_t;
5555
typedef s32 compat_ssize_t;
56-
typedef s32 compat_time_t;
5756
typedef s32 compat_clock_t;
5857
typedef s32 compat_pid_t;
5958
typedef u16 __compat_uid_t;
@@ -97,16 +96,6 @@ typedef struct {
9796
u32 gprs_high[NUM_GPRS];
9897
} s390_compat_regs_high;
9998

100-
struct compat_timespec {
101-
compat_time_t tv_sec;
102-
s32 tv_nsec;
103-
};
104-
105-
struct compat_timeval {
106-
compat_time_t tv_sec;
107-
s32 tv_usec;
108-
};
109-
11099
struct compat_stat {
111100
compat_dev_t st_dev;
112101
u16 __pad1;

arch/s390/include/asm/elf.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,9 @@
125125
* ELF register definitions..
126126
*/
127127

128+
#include <linux/compat.h>
129+
128130
#include <asm/ptrace.h>
129-
#include <asm/compat.h>
130131
#include <asm/syscall.h>
131132
#include <asm/user.h>
132133

@@ -136,7 +137,6 @@ typedef s390_regs elf_gregset_t;
136137
typedef s390_fp_regs compat_elf_fpregset_t;
137138
typedef s390_compat_regs compat_elf_gregset_t;
138139

139-
#include <linux/compat.h>
140140
#include <linux/sched/mm.h> /* for task_struct */
141141
#include <asm/mmu_context.h>
142142

arch/s390/kvm/priv.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
#include <asm/gmap.h>
2727
#include <asm/io.h>
2828
#include <asm/ptrace.h>
29-
#include <asm/compat.h>
3029
#include <asm/sclp.h>
3130
#include "gaccess.h"
3231
#include "kvm-s390.h"

arch/s390/pci/pci_clp.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
#include <linux/uaccess.h>
2020
#include <asm/pci_debug.h>
2121
#include <asm/pci_clp.h>
22-
#include <asm/compat.h>
2322
#include <asm/clp.h>
2423
#include <uapi/asm/clp.h>
2524

arch/sh/include/asm/Kbuild

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
generic-y += compat.h
12
generic-y += current.h
23
generic-y += delay.h
34
generic-y += div64.h

0 commit comments

Comments
 (0)