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

0 commit comments

Comments
 (0)