Commit 0fea20fc authored by Arnd Bergmann's avatar Arnd Bergmann Committed by Sasha Levin

coredump: Use 64bit time for unix time of coredump

[ Upstream commit 03927c8a ]

struct timeval on 32-bit systems will have its tv_sec
value overflow in year 2038 and beyond.
Use a 64 bit value to print time of the coredump in seconds.
ktime_get_real_seconds is chosen here for efficiency reasons.

Suggested by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarTina Ruchandani <ruchandani.tina@gmail.com>
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
parent bef794e8
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include <linux/pipe_fs_i.h> #include <linux/pipe_fs_i.h>
#include <linux/oom.h> #include <linux/oom.h>
#include <linux/compat.h> #include <linux/compat.h>
#include <linux/timekeeping.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <asm/mmu_context.h> #include <asm/mmu_context.h>
...@@ -225,9 +226,10 @@ static int format_corename(struct core_name *cn, struct coredump_params *cprm) ...@@ -225,9 +226,10 @@ static int format_corename(struct core_name *cn, struct coredump_params *cprm)
break; break;
/* UNIX time of coredump */ /* UNIX time of coredump */
case 't': { case 't': {
struct timeval tv; time64_t time;
do_gettimeofday(&tv);
err = cn_printf(cn, "%lu", tv.tv_sec); time = ktime_get_real_seconds();
err = cn_printf(cn, "%lld", time);
break; break;
} }
/* hostname */ /* hostname */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment