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

fs/proc: Respect boottime inside time namespace for /proc/uptime

Make sure that /proc/uptime is adjusted to the tasks time namespace.

Co-developed-by: Andrei Vagin <avagin@openvz.org>
Signed-off-by: Andrei Vagin <avagin@openvz.org>
Signed-off-by: Dmitry Safonov <dima@arista.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/r/20191112012724.250792-19-dima@arista.com


authored by

Dmitry Safonov and committed by
Thomas Gleixner
0efc8bb0 1f9b37bf

+3
+3
fs/proc/uptime.c
··· 5 5 #include <linux/sched.h> 6 6 #include <linux/seq_file.h> 7 7 #include <linux/time.h> 8 + #include <linux/time_namespace.h> 8 9 #include <linux/kernel_stat.h> 9 10 10 11 static int uptime_proc_show(struct seq_file *m, void *v) ··· 21 20 nsec += (__force u64) kcpustat_cpu(i).cpustat[CPUTIME_IDLE]; 22 21 23 22 ktime_get_boottime_ts64(&uptime); 23 + timens_add_boottime(&uptime); 24 + 24 25 idle.tv_sec = div_u64_rem(nsec, NSEC_PER_SEC, &rem); 25 26 idle.tv_nsec = rem; 26 27 seq_printf(m, "%lu.%02lu %lu.%02lu\n",