Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

y2038: vdso: change timeval to __kernel_old_timeval

The gettimeofday() function in vdso uses the traditional 'timeval'
structure layout, which will be incompatible with future versions of
glibc on 32-bit architectures that use a 64-bit time_t.

This interface is problematic for y2038, when time_t overflows on 32-bit
architectures, but the plan so far is that a libc with 64-bit time_t
will not call into the gettimeofday() vdso helper at all, and only
have a method for entering clock_gettime(). This means we don't have
to fix it here, though we probably want to add a new clock_gettime()
entry point using a 64-bit version of 'struct timespec' at some point.

Changing the vdso code to use __kernel_old_timeval helps isolate
this usage from the other ones that still need to be fixed properly,
and it gets us closer to removing the 'timeval' definition from the
kernel sources.

Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>

+16 -16
+3 -3
arch/nds32/kernel/vdso/gettimeofday.c
··· 230 230 return 0; 231 231 } 232 232 233 - static notrace inline int gettimeofday_fallback(struct timeval *_tv, 233 + static notrace inline int gettimeofday_fallback(struct __kernel_old_timeval *_tv, 234 234 struct timezone *_tz) 235 235 { 236 - register struct timeval *tv asm("$r0") = _tv; 236 + register struct __kernel_old_timeval *tv asm("$r0") = _tv; 237 237 register struct timezone *tz asm("$r1") = _tz; 238 238 register int ret asm("$r0"); 239 239 ··· 246 246 return ret; 247 247 } 248 248 249 - notrace int __vdso_gettimeofday(struct timeval *tv, struct timezone *tz) 249 + notrace int __vdso_gettimeofday(struct __kernel_old_timeval *tv, struct timezone *tz) 250 250 { 251 251 struct timespec ts; 252 252 struct vdso_data *vdata;
+4 -4
arch/powerpc/kernel/asm-offsets.c
··· 393 393 OFFSET(CFG_DCACHE_LOGBLOCKSZ, vdso_data, dcache_log_block_size); 394 394 #ifdef CONFIG_PPC64 395 395 OFFSET(CFG_SYSCALL_MAP64, vdso_data, syscall_map_64); 396 - OFFSET(TVAL64_TV_SEC, timeval, tv_sec); 397 - OFFSET(TVAL64_TV_USEC, timeval, tv_usec); 396 + OFFSET(TVAL64_TV_SEC, __kernel_old_timeval, tv_sec); 397 + OFFSET(TVAL64_TV_USEC, __kernel_old_timeval, tv_usec); 398 398 OFFSET(TVAL32_TV_SEC, old_timeval32, tv_sec); 399 399 OFFSET(TVAL32_TV_USEC, old_timeval32, tv_usec); 400 400 OFFSET(TSPC64_TV_SEC, timespec, tv_sec); ··· 402 402 OFFSET(TSPC32_TV_SEC, old_timespec32, tv_sec); 403 403 OFFSET(TSPC32_TV_NSEC, old_timespec32, tv_nsec); 404 404 #else 405 - OFFSET(TVAL32_TV_SEC, timeval, tv_sec); 406 - OFFSET(TVAL32_TV_USEC, timeval, tv_usec); 405 + OFFSET(TVAL32_TV_SEC, __kernel_old_timeval, tv_sec); 406 + OFFSET(TVAL32_TV_USEC, __kernel_old_timeval, tv_usec); 407 407 OFFSET(TSPC32_TV_SEC, timespec, tv_sec); 408 408 OFFSET(TSPC32_TV_NSEC, timespec, tv_nsec); 409 409 #endif
+6 -6
arch/sparc/vdso/vclock_gettime.c
··· 74 74 return o0; 75 75 } 76 76 77 - notrace static long vdso_fallback_gettimeofday(struct timeval *tv, struct timezone *tz) 77 + notrace static long vdso_fallback_gettimeofday(struct __kernel_old_timeval *tv, struct timezone *tz) 78 78 { 79 79 register long num __asm__("g1") = __NR_gettimeofday; 80 80 register long o0 __asm__("o0") = (long) tv; ··· 304 304 } 305 305 306 306 notrace int 307 - __vdso_gettimeofday(struct timeval *tv, struct timezone *tz) 307 + __vdso_gettimeofday(struct __kernel_old_timeval *tv, struct timezone *tz) 308 308 { 309 309 struct vvar_data *vvd = get_vvar_data(); 310 310 ··· 312 312 if (likely(tv != NULL)) { 313 313 union tstv_t { 314 314 struct timespec ts; 315 - struct timeval tv; 315 + struct __kernel_old_timeval tv; 316 316 } *tstv = (union tstv_t *) tv; 317 317 do_realtime(vvd, &tstv->ts); 318 318 /* ··· 336 336 return vdso_fallback_gettimeofday(tv, tz); 337 337 } 338 338 int 339 - gettimeofday(struct timeval *, struct timezone *) 339 + gettimeofday(struct __kernel_old_timeval *, struct timezone *) 340 340 __attribute__((weak, alias("__vdso_gettimeofday"))); 341 341 342 342 notrace int 343 - __vdso_gettimeofday_stick(struct timeval *tv, struct timezone *tz) 343 + __vdso_gettimeofday_stick(struct __kernel_old_timeval *tv, struct timezone *tz) 344 344 { 345 345 struct vvar_data *vvd = get_vvar_data(); 346 346 ··· 348 348 if (likely(tv != NULL)) { 349 349 union tstv_t { 350 350 struct timespec ts; 351 - struct timeval tv; 351 + struct __kernel_old_timeval tv; 352 352 } *tstv = (union tstv_t *) tv; 353 353 do_realtime_stick(vvd, &tstv->ts); 354 354 /*
+1 -1
arch/x86/entry/vsyscall/vsyscall_64.c
··· 184 184 */ 185 185 switch (vsyscall_nr) { 186 186 case 0: 187 - if (!write_ok_or_segv(regs->di, sizeof(struct timeval)) || 187 + if (!write_ok_or_segv(regs->di, sizeof(struct __kernel_old_timeval)) || 188 188 !write_ok_or_segv(regs->si, sizeof(struct timezone))) { 189 189 ret = -EFAULT; 190 190 goto check_fault;
+2 -2
arch/x86/um/vdso/um_vdso.c
··· 25 25 int clock_gettime(clockid_t, struct timespec *) 26 26 __attribute__((weak, alias("__vdso_clock_gettime"))); 27 27 28 - int __vdso_gettimeofday(struct timeval *tv, struct timezone *tz) 28 + int __vdso_gettimeofday(struct __kernel_old_timeval *tv, struct timezone *tz) 29 29 { 30 30 long ret; 31 31 ··· 34 34 35 35 return ret; 36 36 } 37 - int gettimeofday(struct timeval *, struct timezone *) 37 + int gettimeofday(struct __kernel_old_timeval *, struct timezone *) 38 38 __attribute__((weak, alias("__vdso_gettimeofday"))); 39 39 40 40 time_t __vdso_time(time_t *t)