History

y2038: rusage: use __kernel_old_timeval

There are two 'struct timeval' fields in 'struct rusage'. Unfortunately the definition of timeval is now ambiguous when used in user space with a libc that has a 64-bit time_t, and this also changes the 'rusage' definition in user space in a way that is incompatible with the system call interface. While there is no good solution to avoid all ambiguity here, change the definition in the kernel headers to be compatible with the kernel ABI, using __kernel_old_timeval as an unambiguous base type. In previous discussions, there was also a plan to add a replacement for rusage based on 64-bit timestamps and nanosecond resolution, i.e. 'struct __kernel_timespec'. I have patches for that as well, if anyone thinks we should do that.

Arnd Bergmann committed 7 years ago

Commit bdd565f1 parent 2a785993 files · +5 −5Browse files

Showing the changes to include/uapi/linux (1 of 3 files). Show all

Unified · Split

include/uapi/linux/resource.h+2−2
@@ -22,8 +22,8 @@ · 21 unmodified lines
2222 #define RUSAGE_THREAD 1 /* only the calling thread */
2323
2424 struct rusage {
25− struct timeval ru_utime; /* user time used */
26− struct timeval ru_stime; /* system time used */
25+ struct __kernel_old_timeval ru_utime; /* user time used */
26+ struct __kernel_old_timeval ru_stime; /* system time used */
2727 __kernel_long_t ru_maxrss; /* maximum resident set size */
2828 __kernel_long_t ru_ixrss; /* integral shared memory size */
2929 __kernel_long_t ru_idrss; /* integral unshared data size */