History

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.

Cyril Hrubis committed 6 years ago

Commit ecc421e1 parent 98d54f81 file · +2 −0Browse files

Showing the changes to kernel (1 of 1 file). Show all

Unified · Split

kernel/sys.c+2−0
@@ -47,6 +47,7 @@ · 46 unmodified lines
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) · 2493 unmodified lines
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);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t