[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20201011145924.6554-1-michael.weiss@aisec.fraunhofer.de>
Date: Sun, 11 Oct 2020 16:59:21 +0200
From: Michael Weiß <michael.weiss@...ec.fraunhofer.de>
To: Thomas Gleixner <tglx@...utronix.de>,
Andrei Vagin <avagin@...il.com>,
Christian Brauner <christian.brauner@...ntu.com>
Cc: Dmitry Safonov <0x7f454c46@...il.com>,
linux-kernel@...r.kernel.org,
"J . Bruce Fields" <bfields@...ldses.org>,
Chuck Lever <chuck.lever@...cle.com>,
Trond Myklebust <trond.myklebust@...merspace.com>,
Anna Schumaker <anna.schumaker@...app.com>,
Michael Weiß <michael.weiss@...ec.fraunhofer.de>,
kernel test robot <lkp@...el.com>
Subject: [PATCH v3 0/3] time namespace aware system boot time
Time namespaces make it possible to virtualize time inside of
containers, e.g., it is feasible to reset the uptime of a container
to zero by setting the time namespace offset for boottime to the
negated current value of the CLOCK_BOOTTIME.
However, the boot time stamp provided by getboottime64() does not
take care of time namespaces. The resulting boot time stamp 'btime'
provided by /proc/stat does not show a plausible time stamp inside
the time namespace of a container.
We address this by shifting the value returned by getboottime64()
by subtracting the boottime offset of the time namespace.
(A selftest to check the expected /proc/stat 'btime' inside the
namespace is provided.)
Further, to avoid to show processes as time travelers inside of the
time namespace the boottime offset then needs to be added to the
start_bootime provided by the task_struct.
v3 Changes:
leave getboottime64() unchanged and shift the boot timestamp in
'fs/proc/stat.c' as result of the discussion with Andrei and Thomas.
v2 Changes:
Fixed compile errors with TIME_NS not set in config
Reported-by: kernel test robot <lkp@...el.com>
Michael Weiß (3):
timens: additional helper function to add boottime in nsec
fs/proc: apply the time namespace offset to /proc/stat btime
selftests/timens: added selftest for /proc/stat btime
fs/proc/array.c | 6 ++-
fs/proc/stat.c | 17 +++++++-
include/linux/time_namespace.h | 13 ++++++
tools/testing/selftests/timens/procfs.c | 58 ++++++++++++++++++++++++-
4 files changed, 90 insertions(+), 4 deletions(-)
--
2.20.1
Powered by blists - more mailing lists