Skip to content

Commit ecc421e

Browse files
metan-ucwKAGA-KOKO
authored andcommitted
sys/sysinfo: Respect boottime inside time namespace
The sysinfo() syscall includes uptime in seconds but has no correction for time namespaces which makes it inconsistent with the /proc/uptime inside of a time namespace. Add the missing time namespace adjustment call. Signed-off-by: Cyril Hrubis <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Reviewed-by: Dmitry Safonov <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
1 parent 98d54f8 commit ecc421e

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

kernel/sys.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
#include <linux/syscalls.h>
4848
#include <linux/kprobes.h>
4949
#include <linux/user_namespace.h>
50+
#include <linux/time_namespace.h>
5051
#include <linux/binfmts.h>
5152

5253
#include <linux/sched.h>
@@ -2546,6 +2547,7 @@ static int do_sysinfo(struct sysinfo *info)
25462547
memset(info, 0, sizeof(struct sysinfo));
25472548

25482549
ktime_get_boottime_ts64(&tp);
2550+
timens_add_boottime(&tp);
25492551
info->uptime = tp.tv_sec + (tp.tv_nsec ? 1 : 0);
25502552

25512553
get_avenrun(info->loads, 0, SI_LOAD_SHIFT - FSHIFT);

0 commit comments

Comments
 (0)