History

acct: stop using get_seconds()

In 'struct acct', 'struct acct_v3', and 'struct taskstats' we have a 32-bit 'ac_btime' field containing an absolute time value, which will overflow in year 2106. There are two possible ways to deal with it: a) let it overflow and have user space code deal with reconstructing the data based on the current time, or b) truncate the times based on the range of the u32 type. Neither of them solves the actual problem. Pick the second one to best document what the issue is, and have someone fix it in a future version.

Arnd Bergmann committed 7 years ago

Commit 2d602bf1 parent 853bc0a4 files · +11 −4Browse files

Showing the changes to include/uapi/linux (2 of 4 files). Show all

Unified · Split

2 files
  1. include/uapi/linux/acct.h +2 −0
  2. include/uapi/linux/taskstats.h +1 −0
include/uapi/linux/acct.h+2−0
@@ -49,6 +49,7 @@ struct acct · 48 unmodified lines
4949 __u16 ac_uid16; /* LSB of Real User ID */
5050 __u16 ac_gid16; /* LSB of Real Group ID */
5151 __u16 ac_tty; /* Control Terminal */
52+ /* __u32 range means times from 1970 to 2106 */
5253 __u32 ac_btime; /* Process Creation Time */
5354 comp_t ac_utime; /* User Time */
5455 comp_t ac_stime; /* System Time */
@@ -81,6 +82,7 @@ struct acct_v3 · 26 unmodified lines
8182 __u32 ac_gid; /* Real Group ID */
8283 __u32 ac_pid; /* Process ID */
8384 __u32 ac_ppid; /* Parent Process ID */
85+ /* __u32 range means times from 1970 to 2106 */
8486 __u32 ac_btime; /* Process Creation Time */
8587 #ifdef __KERNEL__
8688 __u32 ac_etime; /* Elapsed Time */
include/uapi/linux/taskstats.h+1−0
@@ -112,6 +112,7 @@ struct taskstats { · 111 unmodified lines
112112 __u32 ac_gid; /* Group ID */
113113 __u32 ac_pid; /* Process ID */
114114 __u32 ac_ppid; /* Parent process ID */
115+ /* __u32 range means times from 1970 to 2106 */
115116 __u32 ac_btime; /* Begin time [sec since 1970] */
116117 __u64 ac_etime __attribute__((aligned(8)));
117118 /* Elapsed time [usec] */