Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp2249905pxu; Fri, 9 Oct 2020 11:37:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzuj8sLYhosiWSJ8lp2QFO0QKu0+XRKsNd4lHUAwOzyC8gD4l/GJSe7Ijq0kZIrQs5kAjqr X-Received: by 2002:a17:906:a282:: with SMTP id i2mr15573779ejz.39.1602268644370; Fri, 09 Oct 2020 11:37:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602268644; cv=none; d=google.com; s=arc-20160816; b=Sym/tBH5/y70Lc6Jyzdwip/9jZQSIexrFXyRx1est9OzsNX0Mqgx0S0VEolQz9I5/c vqUlq4wuNqD2wUpPgzc0yOtT99g0oQiLBJrUw7Cs9S5CiypFnzV/kaUBiWPdMWRYbJ0C cVDLpPDdj2soHcx8DVj4TYWXn5D3Fzqq8wUgNOTSBQHvzA14wZ4ejz4cIn6c2U995RMJ yI5jq1+NRYuRRATvEeYhmrci1DSSxk+gsvUbm4LT678mem+9/Q7qx7aQSEny0md7p7Dh SqUjmUyo/etKU6+51YRBocWdV3XJmK2cvGmtd9pbTK0scahoiwTvsIqDCqAfVL7s/HOk KeAA== 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=ulftwGPHZXk34HD4nALWxJRrdNhNDYJDr1PJ+dcwsrU=; b=0pnELiR/siz7kc/Pd3D+Eu5iNOr2kjaEt+GTD4uYgOBGmKjj6rMI0ajTCa0CkkVx70 1z5t6MaFPCIY8SW9oo6aT3kZZTLQBRS3RIagqwJ3ZIHL1eSEjhy090dcxLs9ad1e9ELK 3B7VGmeL8kHh6bYcD1cJoD6ug4gF4MH/GFF6qXIe0DnCU9XORySaigFjyLqXzDm559Dj 3jDfoSjqkj7BtV5+NigPxUVrJCJCRQ1bTdEmM3SYJBbuccKUk3oye5438xOXo/CkM7w6 1Rjxe8H02WT9wGRQy3dxEdRjBj+b9ewevVZdQT4CbdAuyP0s377dR0MlysshHGeA6CFw acJA== 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 z8si6239727eju.267.2020.10.09.11.37.01; Fri, 09 Oct 2020 11:37:24 -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 S2388280AbgJINVe (ORCPT + 99 others); Fri, 9 Oct 2020 09:21:34 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:59831 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729935AbgJINVe (ORCPT ); Fri, 9 Oct 2020 09:21:34 -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 1kQsKw-0005qq-I7; Fri, 09 Oct 2020 13:21:30 +0000 Date: Fri, 9 Oct 2020 15:21:29 +0200 From: Christian Brauner To: Michael =?utf-8?B?V2Vpw58=?= Cc: Thomas Gleixner , Andrei Vagin , Dmitry Safonov <0x7f454c46@gmail.com>, linux-kernel@vger.kernel.org, kernel test robot Subject: Re: [PATCH v2 0/4] time namespace aware system boot time Message-ID: <20201009132129.3vzdgzyy7gloou6v@wittgenstein> References: <20201008053944.32718-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: <20201008053944.32718-1-michael.weiss@aisec.fraunhofer.de> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 08, 2020 at 07:39:40AM +0200, 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_bootime provided by the task_struct. > > v2 Changes: > Fixed compile errors with TIME_NS not set in config > Reported-by: kernel test robot Hey Michael, Thanks for the patches. This looks like a good idea to me. Since /proc/uptime is now virtualized according to the timens the caller is in btime has to be virtualized too. Christian