linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "tip-bot2 for Cyril Hrubis" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: Cyril Hrubis <chrubis@suse.cz>,
	Thomas Gleixner <tglx@linutronix.de>,
	Dmitry Safonov <dima@arista.com>, x86 <x86@kernel.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: [tip: timers/urgent] sys/sysinfo: Respect boottime inside time namespace
Date: Tue, 03 Mar 2020 18:40:39 -0000	[thread overview]
Message-ID: <158326083954.28353.16922158200341050554.tip-bot2@tip-bot2> (raw)
In-Reply-To: <20200303150638.7329-1-chrubis@suse.cz>

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);

      parent reply	other threads:[~2020-03-03 18:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=158326083954.28353.16922158200341050554.tip-bot2@tip-bot2 \
    --to=tip-bot2@linutronix.de \
    --cc=chrubis@suse.cz \
    --cc=dima@arista.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).