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

Support time namespaces #2345

Closed
djboris9 opened this issue Apr 22, 2020 · 5 comments · Fixed by #3876
Closed

Support time namespaces #2345

djboris9 opened this issue Apr 22, 2020 · 5 comments · Fixed by #3876
Milestone

Comments

@djboris9
Copy link

djboris9 commented Apr 22, 2020

Hi there

Since Kernel 5.6 there is support for time namespaces using CLONE_NEWTIME (see setns(2)).
Support for it in runc would allow people to have different times in containers, which is useful for testing of time based services/jobs.

Currently we are doing it with libfaketime but the software which is being tested needs to be compatible with it.

It looks like golang.org/x/sys/unix already supports the CLONE_NEWTIME argument.

I've opened this issue to track it. If I get some time I will try to implement it and open a pull request.

Boris

P.S. The challenge seams to be that as soon as the first child is spawned after the unshare, the time offsets cannot be changed. An example is shown in time_namespaces(7)

djboris9 added a commit to djboris9/runc that referenced this issue Apr 22, 2020
@kolyshkin
Copy link
Contributor

runc should not support timens directly, this feature is aimed mostly for stuff like checkpoint/restore (so that the system time won't jump forward in the restored container). Maybe @avagin can chime in, too.

Feel free to discuss it further, but I'm closing this for now

@AkihiroSuda
Copy link
Member

I think runc can support timens directly. Having different clocks across containers would be very useful for Jepsen(-ish) testing.

@AkihiroSuda AkihiroSuda reopened this Jun 2, 2020
@AkihiroSuda AkihiroSuda added this to the 1.1.0 milestone Jun 2, 2020
@cyphar
Copy link
Member

cyphar commented Jun 2, 2020

I agree that we should at least have support for it, though the only annoyance is that we'd need to have a different configuration mechanism for timens than any of the other namespaces -- because the canonical way to configure CLONE_NEWTIME is with the clone_args passed to clone3. So we'd also need to port nsexec.c to clone3 but that's something we were going to have to do anyway (and clone3 is objectively much nicer than clone2).

In any case, this issue should be an issue/PR against the runtime-spec.

@tianon
Copy link
Member

tianon commented Aug 13, 2020

FWIW, there's an initial PR on the runtime-spec now: opencontainers/runtime-spec#1062 opencontainers/runtime-spec#1151

(edited for new PR link)

@thaJeztah
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants