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.
Showing the changes to kernel/sys.c (1 of 1 file). Show all
Unified · Split
| @@ -47,6 +47,7 @@ · 46 unmodified lines | |||
| 47 | #include <linux/syscalls.h> | 47 | #include <linux/syscalls.h> |
| 48 | #include <linux/kprobes.h> | 48 | #include <linux/kprobes.h> |
| 49 | #include <linux/user_namespace.h> | 49 | #include <linux/user_namespace.h> |
| 50 | #include <linux/time_namespace.h> | ||
| 50 | #include <linux/binfmts.h> | 51 | #include <linux/binfmts.h> |
| 51 | 52 | ||
| 52 | #include <linux/sched.h> | 53 | #include <linux/sched.h> |
| @@ -2546,6 +2547,7 @@ static int do_sysinfo(struct sysinfo *info) · 2493 unmodified lines | |||
| 2546 | memset(info, 0, sizeof(struct sysinfo)); | 2547 | memset(info, 0, sizeof(struct sysinfo)); |
| 2547 | 2548 | ||
| 2548 | ktime_get_boottime_ts64(&tp); | 2549 | ktime_get_boottime_ts64(&tp); |
| 2550 | timens_add_boottime(&tp); | ||
| 2549 | info->uptime = tp.tv_sec + (tp.tv_nsec ? 1 : 0); | 2551 | info->uptime = tp.tv_sec + (tp.tv_nsec ? 1 : 0); |
| 2550 | 2552 | ||
| 2551 | get_avenrun(info->loads, 0, SI_LOAD_SHIFT - FSHIFT); | 2553 | get_avenrun(info->loads, 0, SI_LOAD_SHIFT - FSHIFT); |