All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sys/sysinfo: Respect boottime inside time namespace
@ 2020-03-03 15:06 Cyril Hrubis
  2020-03-03 16:40 ` Dmitry Safonov
  2020-03-03 18:40 ` [tip: timers/urgent] " tip-bot2 for Cyril Hrubis
  0 siblings, 2 replies; 3+ messages in thread
From: Cyril Hrubis @ 2020-03-03 15:06 UTC (permalink / raw)
  To: linux-kernel
  Cc: Andrei Vagin, Dmitry Safonov, Thomas Gleixner, Jiri Bohac, Cyril Hrubis

The sysinfo() syscall includes uptime in seconds this makes it
consistent with the /proc/uptime inside of a time namespace.

Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
---
 kernel/sys.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/kernel/sys.c b/kernel/sys.c
index f9bc5c303e3f..d325f3ab624a 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -47,6 +47,7 @@
 #include <linux/syscalls.h>
 #include <linux/kprobes.h>
 #include <linux/user_namespace.h>
+#include <linux/time_namespace.h>
 #include <linux/binfmts.h>
 
 #include <linux/sched.h>
@@ -2546,6 +2547,7 @@ static int do_sysinfo(struct sysinfo *info)
 	memset(info, 0, sizeof(struct sysinfo));
 
 	ktime_get_boottime_ts64(&tp);
+	timens_add_boottime(&tp);
 	info->uptime = tp.tv_sec + (tp.tv_nsec ? 1 : 0);
 
 	get_avenrun(info->loads, 0, SI_LOAD_SHIFT - FSHIFT);
-- 
2.24.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] sys/sysinfo: Respect boottime inside time namespace
  2020-03-03 15:06 [PATCH] sys/sysinfo: Respect boottime inside time namespace Cyril Hrubis
@ 2020-03-03 16:40 ` Dmitry Safonov
  2020-03-03 18:40 ` [tip: timers/urgent] " tip-bot2 for Cyril Hrubis
  1 sibling, 0 replies; 3+ messages in thread
From: Dmitry Safonov @ 2020-03-03 16:40 UTC (permalink / raw)
  To: Cyril Hrubis, linux-kernel; +Cc: Andrei Vagin, Thomas Gleixner, Jiri Bohac

On 3/3/20 3:06 PM, Cyril Hrubis wrote:
> The sysinfo() syscall includes uptime in seconds this makes it
> consistent with the /proc/uptime inside of a time namespace.
> 
> Signed-off-by: Cyril Hrubis <chrubis@suse.cz>

Reviewed-by: Dmitry Safonov <dima@arista.com>

> ---
>  kernel/sys.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/kernel/sys.c b/kernel/sys.c
> index f9bc5c303e3f..d325f3ab624a 100644
> --- a/kernel/sys.c
> +++ b/kernel/sys.c
> @@ -47,6 +47,7 @@
>  #include <linux/syscalls.h>
>  #include <linux/kprobes.h>
>  #include <linux/user_namespace.h>
> +#include <linux/time_namespace.h>
>  #include <linux/binfmts.h>
>  
>  #include <linux/sched.h>
> @@ -2546,6 +2547,7 @@ static int do_sysinfo(struct sysinfo *info)
>  	memset(info, 0, sizeof(struct sysinfo));
>  
>  	ktime_get_boottime_ts64(&tp);
> +	timens_add_boottime(&tp);
>  	info->uptime = tp.tv_sec + (tp.tv_nsec ? 1 : 0);
>  
>  	get_avenrun(info->loads, 0, SI_LOAD_SHIFT - FSHIFT);
> 

Thanks for noticing,
          Dmitry

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [tip: timers/urgent] sys/sysinfo: Respect boottime inside time namespace
  2020-03-03 15:06 [PATCH] sys/sysinfo: Respect boottime inside time namespace Cyril Hrubis
  2020-03-03 16:40 ` Dmitry Safonov
@ 2020-03-03 18:40 ` tip-bot2 for Cyril Hrubis
  1 sibling, 0 replies; 3+ messages in thread
From: tip-bot2 for Cyril Hrubis @ 2020-03-03 18:40 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Cyril Hrubis, Thomas Gleixner, Dmitry Safonov, x86, LKML

The following commit has been merged into the timers/urgent branch of tip:

Commit-ID:     ecc421e05bab97cf3ff4fe456ade47ef84dba8c2
Gitweb:        https://git.kernel.org/tip/ecc421e05bab97cf3ff4fe456ade47ef84dba8c2
Author:        Cyril Hrubis <chrubis@suse.cz>
AuthorDate:    Tue, 03 Mar 2020 16:06:38 +01:00
Committer:     Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Tue, 03 Mar 2020 19:34:32 +01:00

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 <chrubis@suse.cz>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Dmitry Safonov <dima@arista.com>
Link: https://lkml.kernel.org/r/20200303150638.7329-1-chrubis@suse.cz

---
 kernel/sys.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/kernel/sys.c b/kernel/sys.c
index f9bc5c3..d325f3a 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -47,6 +47,7 @@
 #include <linux/syscalls.h>
 #include <linux/kprobes.h>
 #include <linux/user_namespace.h>
+#include <linux/time_namespace.h>
 #include <linux/binfmts.h>
 
 #include <linux/sched.h>
@@ -2546,6 +2547,7 @@ static int do_sysinfo(struct sysinfo *info)
 	memset(info, 0, sizeof(struct sysinfo));
 
 	ktime_get_boottime_ts64(&tp);
+	timens_add_boottime(&tp);
 	info->uptime = tp.tv_sec + (tp.tv_nsec ? 1 : 0);
 
 	get_avenrun(info->loads, 0, SI_LOAD_SHIFT - FSHIFT);

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-03-03 18:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-03 15:06 [PATCH] sys/sysinfo: Respect boottime inside time namespace Cyril Hrubis
2020-03-03 16:40 ` Dmitry Safonov
2020-03-03 18:40 ` [tip: timers/urgent] " tip-bot2 for Cyril Hrubis

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.