Skip to content

Commit 41ea391

Browse files
committed
Merge tag 'y2038-new-syscalls' of git://git.kernel.org:/pub/scm/linux/kernel/git/arnd/playground into timers/2038
Pull y2038 - time64 system calls from Arnd Bergmann: This series finally gets us to the point of having system calls with 64-bit time_t on all architectures, after a long time of incremental preparation patches. There was actually one conversion that I missed during the summer, i.e. Deepa's timex series, which I now updated based the 5.0-rc1 changes and review comments. The following system calls are now added on all 32-bit architectures using the same system call numbers: 403 clock_gettime64 404 clock_settime64 405 clock_adjtime64 406 clock_getres_time64 407 clock_nanosleep_time64 408 timer_gettime64 409 timer_settime64 410 timerfd_gettime64 411 timerfd_settime64 412 utimensat_time64 413 pselect6_time64 414 ppoll_time64 416 io_pgetevents_time64 417 recvmmsg_time64 418 mq_timedsend_time64 419 mq_timedreceiv_time64 420 semtimedop_time64 421 rt_sigtimedwait_time64 422 futex_time64 423 sched_rr_get_interval_time64 Each one of these corresponds directly to an existing system call that includes a 'struct timespec' argument, or a structure containing a timespec or (in case of clock_adjtime) timeval. Not included here are new versions of getitimer/setitimer and getrusage/waitid, which are planned for the future but only needed to make a consistent API rather than for correct operation beyond y2038. These four system calls are based on 'timeval', and it has not been finally decided what the replacement kernel interface will use instead. So far, I have done a lot of build testing across most architectures, which has found a number of bugs. Runtime testing so far included testing LTP on 32-bit ARM with the existing system calls, to ensure we do not regress for existing binaries, and a test with a 32-bit x86 build of LTP against a modified version of the musl C library that has been adapted to the new system call interface [3]. This library can be used for testing on all architectures supported by musl-1.1.21, but it is not how the support is getting integrated into the official musl release. Official musl support is planned but will require more invasive changes to the library. Link: https://lore.kernel.org/lkml/20190110162435.309262-1-arnd@arndb.de/T/ Link: https://lore.kernel.org/lkml/20190118161835.2259170-1-arnd@arndb.de/ Link: https://git.linaro.org/people/arnd/musl-y2038.git/ [2]
2 parents fd659cc + 48166e6 commit 41ea391

File tree

65 files changed

+1263
-713
lines changed

Some content is hidden

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

65 files changed

+1263
-713
lines changed

arch/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -759,7 +759,7 @@ config 64BIT_TIME
759759
handling.
760760

761761
config COMPAT_32BIT_TIME
762-
def_bool (!64BIT && 64BIT_TIME) || COMPAT
762+
def_bool !64BIT || COMPAT
763763
help
764764
This enables 32 bit time_t support in addition to 64 bit time_t support.
765765
This is relevant on all 32-bit architectures, and 64-bit architectures

arch/alpha/kernel/osf_sys.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1253,7 +1253,7 @@ struct timex32 {
12531253

12541254
SYSCALL_DEFINE1(old_adjtimex, struct timex32 __user *, txc_p)
12551255
{
1256-
struct timex txc;
1256+
struct __kernel_timex txc;
12571257
int ret;
12581258

12591259
/* copy relevant bits of struct timex. */
@@ -1270,7 +1270,8 @@ SYSCALL_DEFINE1(old_adjtimex, struct timex32 __user *, txc_p)
12701270
if (copy_to_user(txc_p, &txc, offsetof(struct timex32, time)) ||
12711271
(copy_to_user(&txc_p->tick, &txc.tick, sizeof(struct timex32) -
12721272
offsetof(struct timex32, tick))) ||
1273-
(put_tv_to_tv32(&txc_p->time, &txc.time)))
1273+
(put_user(txc.time.tv_sec, &txc_p->time.tv_sec)) ||
1274+
(put_user(txc.time.tv_usec, &txc_p->time.tv_usec)))
12741275
return -EFAULT;
12751276

12761277
return ret;

arch/alpha/kernel/syscalls/syscall.tbl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -461,3 +461,5 @@
461461
530 common getegid sys_getegid
462462
531 common geteuid sys_geteuid
463463
532 common getppid sys_getppid
464+
# all other architectures have common numbers for new syscall, alpha
465+
# is the exception.

arch/arm/include/asm/unistd.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@
2626
#define __ARCH_WANT_SYS_SIGPROCMASK
2727
#define __ARCH_WANT_SYS_OLD_MMAP
2828
#define __ARCH_WANT_SYS_OLD_SELECT
29-
#define __ARCH_WANT_SYS_UTIME
29+
#define __ARCH_WANT_SYS_UTIME32
3030

3131
#if !defined(CONFIG_AEABI) || defined(CONFIG_OABI_COMPAT)
32-
#define __ARCH_WANT_SYS_TIME
32+
#define __ARCH_WANT_SYS_TIME32
3333
#define __ARCH_WANT_SYS_IPC
3434
#define __ARCH_WANT_SYS_OLDUMOUNT
3535
#define __ARCH_WANT_SYS_ALARM

arch/arm/kernel/sys_oabi-compat.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -317,10 +317,10 @@ struct oabi_sembuf {
317317
asmlinkage long sys_oabi_semtimedop(int semid,
318318
struct oabi_sembuf __user *tsops,
319319
unsigned nsops,
320-
const struct timespec __user *timeout)
320+
const struct old_timespec32 __user *timeout)
321321
{
322322
struct sembuf *sops;
323-
struct timespec local_timeout;
323+
struct old_timespec32 local_timeout;
324324
long err;
325325
int i;
326326

@@ -350,7 +350,7 @@ asmlinkage long sys_oabi_semtimedop(int semid,
350350
} else {
351351
mm_segment_t fs = get_fs();
352352
set_fs(KERNEL_DS);
353-
err = sys_semtimedop(semid, sops, nsops, timeout);
353+
err = sys_semtimedop_time32(semid, sops, nsops, timeout);
354354
set_fs(fs);
355355
}
356356
kfree(sops);
@@ -375,7 +375,7 @@ asmlinkage int sys_oabi_ipc(uint call, int first, int second, int third,
375375
return sys_oabi_semtimedop(first,
376376
(struct oabi_sembuf __user *)ptr,
377377
second,
378-
(const struct timespec __user *)fifth);
378+
(const struct old_timespec32 __user *)fifth);
379379
default:
380380
return sys_ipc(call, first, second, third, ptr, fifth);
381381
}

arch/arm/tools/syscall.tbl

Lines changed: 49 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
10 common unlink sys_unlink
2525
11 common execve sys_execve
2626
12 common chdir sys_chdir
27-
13 oabi time sys_time
27+
13 oabi time sys_time32
2828
14 common mknod sys_mknod
2929
15 common chmod sys_chmod
3030
16 common lchown sys_lchown16
@@ -36,12 +36,12 @@
3636
22 oabi umount sys_oldumount
3737
23 common setuid sys_setuid16
3838
24 common getuid sys_getuid16
39-
25 oabi stime sys_stime
39+
25 oabi stime sys_stime32
4040
26 common ptrace sys_ptrace
4141
27 oabi alarm sys_alarm
4242
# 28 was sys_fstat
4343
29 common pause sys_pause
44-
30 oabi utime sys_utime
44+
30 oabi utime sys_utime32
4545
# 31 was sys_stty
4646
# 32 was sys_gtty
4747
33 common access sys_access
@@ -137,7 +137,7 @@
137137
121 common setdomainname sys_setdomainname
138138
122 common uname sys_newuname
139139
# 123 was sys_modify_ldt
140-
124 common adjtimex sys_adjtimex
140+
124 common adjtimex sys_adjtimex_time32
141141
125 common mprotect sys_mprotect
142142
126 common sigprocmask sys_sigprocmask
143143
# 127 was sys_create_module
@@ -174,8 +174,8 @@
174174
158 common sched_yield sys_sched_yield
175175
159 common sched_get_priority_max sys_sched_get_priority_max
176176
160 common sched_get_priority_min sys_sched_get_priority_min
177-
161 common sched_rr_get_interval sys_sched_rr_get_interval
178-
162 common nanosleep sys_nanosleep
177+
161 common sched_rr_get_interval sys_sched_rr_get_interval_time32
178+
162 common nanosleep sys_nanosleep_time32
179179
163 common mremap sys_mremap
180180
164 common setresuid sys_setresuid16
181181
165 common getresuid sys_getresuid16
@@ -190,7 +190,7 @@
190190
174 common rt_sigaction sys_rt_sigaction
191191
175 common rt_sigprocmask sys_rt_sigprocmask
192192
176 common rt_sigpending sys_rt_sigpending
193-
177 common rt_sigtimedwait sys_rt_sigtimedwait
193+
177 common rt_sigtimedwait sys_rt_sigtimedwait_time32
194194
178 common rt_sigqueueinfo sys_rt_sigqueueinfo
195195
179 common rt_sigsuspend sys_rt_sigsuspend
196196
180 common pread64 sys_pread64 sys_oabi_pread64
@@ -254,12 +254,12 @@
254254
237 common fremovexattr sys_fremovexattr
255255
238 common tkill sys_tkill
256256
239 common sendfile64 sys_sendfile64
257-
240 common futex sys_futex
257+
240 common futex sys_futex_time32
258258
241 common sched_setaffinity sys_sched_setaffinity
259259
242 common sched_getaffinity sys_sched_getaffinity
260260
243 common io_setup sys_io_setup
261261
244 common io_destroy sys_io_destroy
262-
245 common io_getevents sys_io_getevents
262+
245 common io_getevents sys_io_getevents_time32
263263
246 common io_submit sys_io_submit
264264
247 common io_cancel sys_io_cancel
265265
248 common exit_group sys_exit_group
@@ -272,26 +272,26 @@
272272
# 255 for get_thread_area
273273
256 common set_tid_address sys_set_tid_address
274274
257 common timer_create sys_timer_create
275-
258 common timer_settime sys_timer_settime
276-
259 common timer_gettime sys_timer_gettime
275+
258 common timer_settime sys_timer_settime32
276+
259 common timer_gettime sys_timer_gettime32
277277
260 common timer_getoverrun sys_timer_getoverrun
278278
261 common timer_delete sys_timer_delete
279-
262 common clock_settime sys_clock_settime
280-
263 common clock_gettime sys_clock_gettime
281-
264 common clock_getres sys_clock_getres
282-
265 common clock_nanosleep sys_clock_nanosleep
279+
262 common clock_settime sys_clock_settime32
280+
263 common clock_gettime sys_clock_gettime32
281+
264 common clock_getres sys_clock_getres_time32
282+
265 common clock_nanosleep sys_clock_nanosleep_time32
283283
266 common statfs64 sys_statfs64_wrapper
284284
267 common fstatfs64 sys_fstatfs64_wrapper
285285
268 common tgkill sys_tgkill
286-
269 common utimes sys_utimes
286+
269 common utimes sys_utimes_time32
287287
270 common arm_fadvise64_64 sys_arm_fadvise64_64
288288
271 common pciconfig_iobase sys_pciconfig_iobase
289289
272 common pciconfig_read sys_pciconfig_read
290290
273 common pciconfig_write sys_pciconfig_write
291291
274 common mq_open sys_mq_open
292292
275 common mq_unlink sys_mq_unlink
293-
276 common mq_timedsend sys_mq_timedsend
294-
277 common mq_timedreceive sys_mq_timedreceive
293+
276 common mq_timedsend sys_mq_timedsend_time32
294+
277 common mq_timedreceive sys_mq_timedreceive_time32
295295
278 common mq_notify sys_mq_notify
296296
279 common mq_getsetattr sys_mq_getsetattr
297297
280 common waitid sys_waitid
@@ -326,7 +326,7 @@
326326
309 common add_key sys_add_key
327327
310 common request_key sys_request_key
328328
311 common keyctl sys_keyctl
329-
312 common semtimedop sys_semtimedop sys_oabi_semtimedop
329+
312 common semtimedop sys_semtimedop_time32 sys_oabi_semtimedop
330330
313 common vserver
331331
314 common ioprio_set sys_ioprio_set
332332
315 common ioprio_get sys_ioprio_get
@@ -340,7 +340,7 @@
340340
323 common mkdirat sys_mkdirat
341341
324 common mknodat sys_mknodat
342342
325 common fchownat sys_fchownat
343-
326 common futimesat sys_futimesat
343+
326 common futimesat sys_futimesat_time32
344344
327 common fstatat64 sys_fstatat64 sys_oabi_fstatat64
345345
328 common unlinkat sys_unlinkat
346346
329 common renameat sys_renameat
@@ -349,8 +349,8 @@
349349
332 common readlinkat sys_readlinkat
350350
333 common fchmodat sys_fchmodat
351351
334 common faccessat sys_faccessat
352-
335 common pselect6 sys_pselect6
353-
336 common ppoll sys_ppoll
352+
335 common pselect6 sys_pselect6_time32
353+
336 common ppoll sys_ppoll_time32
354354
337 common unshare sys_unshare
355355
338 common set_robust_list sys_set_robust_list
356356
339 common get_robust_list sys_get_robust_list
@@ -362,13 +362,13 @@
362362
345 common getcpu sys_getcpu
363363
346 common epoll_pwait sys_epoll_pwait
364364
347 common kexec_load sys_kexec_load
365-
348 common utimensat sys_utimensat
365+
348 common utimensat sys_utimensat_time32
366366
349 common signalfd sys_signalfd
367367
350 common timerfd_create sys_timerfd_create
368368
351 common eventfd sys_eventfd
369369
352 common fallocate sys_fallocate
370-
353 common timerfd_settime sys_timerfd_settime
371-
354 common timerfd_gettime sys_timerfd_gettime
370+
353 common timerfd_settime sys_timerfd_settime32
371+
354 common timerfd_gettime sys_timerfd_gettime32
372372
355 common signalfd4 sys_signalfd4
373373
356 common eventfd2 sys_eventfd2
374374
357 common epoll_create1 sys_epoll_create1
@@ -379,14 +379,14 @@
379379
362 common pwritev sys_pwritev
380380
363 common rt_tgsigqueueinfo sys_rt_tgsigqueueinfo
381381
364 common perf_event_open sys_perf_event_open
382-
365 common recvmmsg sys_recvmmsg
382+
365 common recvmmsg sys_recvmmsg_time32
383383
366 common accept4 sys_accept4
384384
367 common fanotify_init sys_fanotify_init
385385
368 common fanotify_mark sys_fanotify_mark
386386
369 common prlimit64 sys_prlimit64
387387
370 common name_to_handle_at sys_name_to_handle_at
388388
371 common open_by_handle_at sys_open_by_handle_at
389-
372 common clock_adjtime sys_clock_adjtime
389+
372 common clock_adjtime sys_clock_adjtime32
390390
373 common syncfs sys_syncfs
391391
374 common sendmmsg sys_sendmmsg
392392
375 common setns sys_setns
@@ -413,6 +413,27 @@
413413
396 common pkey_free sys_pkey_free
414414
397 common statx sys_statx
415415
398 common rseq sys_rseq
416-
399 common io_pgetevents sys_io_pgetevents
416+
399 common io_pgetevents sys_io_pgetevents_time32
417417
400 common migrate_pages sys_migrate_pages
418418
401 common kexec_file_load sys_kexec_file_load
419+
# 402 is unused
420+
403 common clock_gettime64 sys_clock_gettime
421+
404 common clock_settime64 sys_clock_settime
422+
405 common clock_adjtime64 sys_clock_adjtime
423+
406 common clock_getres_time64 sys_clock_getres
424+
407 common clock_nanosleep_time64 sys_clock_nanosleep
425+
408 common timer_gettime64 sys_timer_gettime
426+
409 common timer_settime64 sys_timer_settime
427+
410 common timerfd_gettime64 sys_timerfd_gettime
428+
411 common timerfd_settime64 sys_timerfd_settime
429+
412 common utimensat_time64 sys_utimensat
430+
413 common pselect6_time64 sys_pselect6
431+
414 common ppoll_time64 sys_ppoll
432+
416 common io_pgetevents_time64 sys_io_pgetevents
433+
417 common recvmmsg_time64 sys_recvmmsg
434+
418 common mq_timedsend_time64 sys_mq_timedsend
435+
419 common mq_timedreceive_time64 sys_mq_timedreceive
436+
420 common semtimedop_time64 sys_semtimedop
437+
421 common rt_sigtimedwait_time64 sys_rt_sigtimedwait
438+
422 common futex_time64 sys_futex
439+
423 common sched_rr_get_interval_time64 sys_sched_rr_get_interval

arch/arm64/include/asm/unistd.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
#define __ARM_NR_compat_set_tls (__ARM_NR_COMPAT_BASE + 5)
4545
#define __ARM_NR_COMPAT_END (__ARM_NR_COMPAT_BASE + 0x800)
4646

47-
#define __NR_compat_syscalls 402
47+
#define __NR_compat_syscalls 424
4848
#endif
4949

5050
#define __ARCH_WANT_SYS_CLONE

0 commit comments

Comments
 (0)