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