summaryrefslogtreecommitdiffstats
path: root/security/tomoyo/audit.c
diff options
context:
space:
mode:
authorArnd Bergmann2017-10-19 14:29:04 +0200
committerJames Morris2017-10-21 04:21:06 +0200
commit927340926ed61477e34f960eec64b7532e35d2f0 (patch)
tree8e48e194ded6863826462df91a837925bca559df /security/tomoyo/audit.c
parentcapabilities: audit log other surprising conditions (diff)
downloadkernel-qcow2-linux-927340926ed61477e34f960eec64b7532e35d2f0.tar.gz
kernel-qcow2-linux-927340926ed61477e34f960eec64b7532e35d2f0.tar.xz
kernel-qcow2-linux-927340926ed61477e34f960eec64b7532e35d2f0.zip
tomoyo: fix timestamping for y2038
Tomoyo uses an open-coded version of time_to_tm() to create a timestamp from the current time as read by get_seconds(). This will overflow and give wrong results on 32-bit systems in 2038. To correct this, this changes the code to use ktime_get_real_seconds() and the generic time64_to_tm() function that are both y2038-safe. Using the library function avoids adding an expensive 64-bit division in this code and can benefit from any optimizations we do in common code. Acked-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: James Morris <james.l.morris@oracle.com>
Diffstat (limited to 'security/tomoyo/audit.c')
-rw-r--r--security/tomoyo/audit.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/security/tomoyo/audit.c b/security/tomoyo/audit.c
index 3ffa4f5509d8..a51edfbe593b 100644
--- a/security/tomoyo/audit.c
+++ b/security/tomoyo/audit.c
@@ -156,7 +156,7 @@ static char *tomoyo_print_header(struct tomoyo_request_info *r)
if (!buffer)
return NULL;
- tomoyo_convert_time(get_seconds(), &stamp);
+ tomoyo_convert_time(ktime_get_real_seconds(), &stamp);
pos = snprintf(buffer, tomoyo_buffer_len - 1,
"#%04u/%02u/%02u %02u:%02u:%02u# profile=%u mode=%s "