Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

btime is not virtualized in /proc/stat #164

Closed
hallyn opened this issue Jan 6, 2017 · 5 comments
Closed

btime is not virtualized in /proc/stat #164

hallyn opened this issue Jan 6, 2017 · 5 comments
Labels
Easy Good for new contributors Feature New feature, not a bug

Comments

@hallyn
Copy link
Member

hallyn commented Jan 6, 2017

See https://bugs.launchpad.net/ubuntu/+source/lxcfs/+bug/1654310

This should be a trivial fix.

@hallyn hallyn added Easy Good for new contributors Feature New feature, not a bug labels Jan 6, 2017
@hallyn hallyn closed this as completed Feb 3, 2017
@gozdal
Copy link

gozdal commented Jun 19, 2017

This introduces a different problem: process creation time is counted as offset from btime:

(22) starttime  %llu
          The time the process started after system boot.  In
          kernels before Linux 2.6, this value was expressed
          in jiffies.  Since Linux 2.6, the value is expressed
          in clock ticks (divide by sysconf(_SC_CLK_TCK)).

(http://man7.org/linux/man-pages/man5/proc.5.html)

This means that because starttime is not virtualized, all the processes within the LXC container appear as time travellers from the future.

@brauner
Copy link
Member

brauner commented Jun 19, 2017

We've reverted the commit just yesterday for exactly this reason. :)

@zerkms
Copy link

zerkms commented Jul 16, 2017

If it was reverted, shouldn't this be re-opened as well?

Also, is it relevant that the sysinfo's uptime field is also not virtualised?

#include <stdio.h>
#include <sys/sysinfo.h>

int main ()
{
 struct sysinfo si;
 sysinfo (&si);
 printf ("uptime %lu\n", si.uptime);
 return 0;
}

This would show the uptime of the host, not of the container.

@hallyn hallyn reopened this Jul 16, 2017
@zerkms zerkms mentioned this issue Jul 16, 2017
Closed
@hallyn hallyn removed the Easy Good for new contributors label Aug 9, 2017
@hallyn
Copy link
Member Author

hallyn commented Sep 12, 2017

So just to be clear, is re-applying this patch plus virtualizing /proc/stat's starttime all that is needed?

I had thought there was a more complicated design issue blocking us...

@brauner
Copy link
Member

brauner commented Mar 4, 2020

Not sure if btime is safe now. If it is, someone please send a patch!

@brauner brauner closed this as completed Mar 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Easy Good for new contributors Feature New feature, not a bug
Development

No branches or pull requests

4 participants