Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp544353pxx; Thu, 29 Oct 2020 08:35:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy48u2G73XhIkNzen0B/I9WCLKE5LXZZwwsgiV3Xq4gxh7QsjhMuG9PGfj65wyqbnWhOr72 X-Received: by 2002:a17:906:2548:: with SMTP id j8mr4592789ejb.140.1603985711577; Thu, 29 Oct 2020 08:35:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603985711; cv=none; d=google.com; s=arc-20160816; b=xwY90lk3RlS8luSSsWGhatm0Ive2l7UoWqcf3PSv0bjZZ6dMz+m05amvc5eJ0r2nkO C3GrFAYskn//MqzuDGQvV5oqOocxM/GpNsQW8F4AJWEN+svh9UqrK6F2rA5sWMmaIF/1 3qqAqBTcJHlarmyVVC0ug252rGgyMgwaq6dOYpk8kLNmhqqSGDgYhAlwUG7U3p3dhKeX sJBIUf6cTyg/RudFJW+wMVeFf/25p2ESOdDlmWmP45+mtZazbA2jcTtQJFj1aKPzJGdH /caORy7x9iWmTg1751refSgkmCsY+pHzE2nHkPFu1YMghutS3D1NltMlMPPzNGRknCwl qk6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=mvHH0ij4gxP96iJj4gGl8gvh0/+kT0wRIXpf7WwFAbs=; b=pyWBwC/cVLr64OTp8oNzvZjVjPn/QLOJioC3ZhbHc3P5hDNOC6h2x+0N8K4wke+G+5 Mx+u+IU+n2f8nN5osVkINjT0DKhsGIqRIce8spjVkD+zzKadRchbbNaEnO7Zm9tDhsVs 4ME+lWE9X4g4TN+wZskqLc4httCsvLhjKGDzwS+95J3KJCVGTTOFYQBiVDrZ6pW4CBhF QvapOQ7y8K5zyqx5Etk8muQtwHx9ndVpe+stofd/r4zGsu5NVtpv9aTezxoU6CJ1GeVg yR90xUvtRcD2lDpe2mjLHF4l30lWDrRqVtKWJhWSx66Fr47nzEjaDH0xSzp2w2KCl9fy /B5g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id rl17si1929965ejb.19.2020.10.29.08.34.49; Thu, 29 Oct 2020 08:35:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728230AbgJ2PdU (ORCPT + 99 others); Thu, 29 Oct 2020 11:33:20 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:33658 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728247AbgJ2PdP (ORCPT ); Thu, 29 Oct 2020 11:33:15 -0400 Received: from ip5f5af0a0.dynamic.kabel-deutschland.de ([95.90.240.160] helo=wittgenstein) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1kY9vC-0001LQ-SV; Thu, 29 Oct 2020 15:33:03 +0000 Date: Thu, 29 Oct 2020 16:33:01 +0100 From: Christian Brauner To: Michael =?utf-8?B?V2Vpw58=?= Cc: Thomas Gleixner , Andrei Vagin , Dmitry Safonov <0x7f454c46@gmail.com>, linux-kernel@vger.kernel.org, "J . Bruce Fields" , Chuck Lever , Trond Myklebust , Anna Schumaker Subject: Re: [PATCH v5 0/3] time namespace aware system boot time Message-ID: <20201029153301.aahwxau6ijyol357@wittgenstein> References: <20201027204258.7869-1-michael.weiss@aisec.fraunhofer.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20201027204258.7869-1-michael.weiss@aisec.fraunhofer.de> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 27, 2020 at 09:42:55PM +0100, Michael Weiß wrote: > 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_boottime provided by the task_struct. > > v5 Changes: > Added tags, Thanks Andrei and Thomas for reviews and comments. > Updated commit message of [2/3] as indicated by Thomas. > > v4 Changes: > Avoid type conversions back and forth between timespec64 and ktime_t > in 'proc/stat.c' as suggested by Andrei. > Introduced timens_sub_boottime() in 'time_namespace.h' to provide > better coder readability/consistency. > > 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 Thank you Michael, Acked-by: Christian Brauner As discussed with Thomas, I'm picking this up now! Thanks! Christian