public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jason Vas Dias <jason.vas.dias@gmail.com>
To: Ben Gamari <bgamari@gmail.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: per-chroot clock module ?
Date: Sat, 27 Nov 2010 19:22:45 +0000	[thread overview]
Message-ID: <201011271922.45611.jason.vas.dias@gmail.com> (raw)
In-Reply-To: <874ob2r3w0.fsf@gmail.com>

On Saturday 27 November 2010 18:57:19 Ben Gamari wrote:
> On Sat, 27 Nov 2010 18:21:34 +0000, Jason Vas Dias <jason.vas.dias@gmail.com> wrote:
> > Greetings -
> > 
> > Sorry in advance if this is a stupid idea, but -
> > 
> > I'd really like to be able to set a distinct "clock" for a specific chroot environment, 
> > such that the super-user could call :
> > [snip]
> 
> It certainly doesn't sound like a particularly good idea to me. This
> would add great complexity to the kernel while having very few
> users. Perhaps there's something I haven't considered but I can't think
> of any good applications for this sort of functionality. Do you have
> something in particular in mind?

I'm not sure that it need be that complex -
  o kernel knows chroot() has succeeded so adds the inode of that directory to a "inode <-> clock_offset" mapping
     initialized to 0.
  o this mapping could perhaps also be used to provide other future per-chroot specific features - as for instance 
     a per-chroot  list of extra acceptable binary executable formats ?
  o clock_gettime() and gettimeofday() and time() and clock_settime() are modified to see if the root device inode 
     number has a non-zero real-time clock offset, and, if so, apply it to the real-time clock returned or in the case
     of clock_settime(), set the associated offset to a non-zero value.

RE: why ?
This would allow one to very easily support websites for totally different timezones , where offsets need not be
restricted to legal timezone offsets but could encompass years - also nice if you want to run applications whose
license key has expired .  Also very easy to support multiple instances of cron(1) running in different timezones.
In any case, the module would ensure that the time the kernel sees internally for all processes is the actual real-time
clock value; only processes which have their root directory in one of the special chroot directories would get
a different gettimeofday() or clock_gettime() value .
  
> 
> It seems like what you want here is simple virtualization. Have you
> considered KVM? The closest thing to your request currently upstream is
> containers, although I'm unsure of whether a container can be created
> with an independent clock. Might be something to look into.
> 

To me, using virtualization to solve this problem is like using a sledgehammer to crack a nut,
particularly if the optimal performance of the processes running in such chroot environments
is of paramount importance. 

> Cheers,
> 
> - Ben
> 

Thanks for your comments,  but I think it is still a good idea and I'm investigating now - 
it doesn't seem to need to be too complex to me.

All the best,
Jason.

  reply	other threads:[~2010-11-27 19:22 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-27 18:21 per-chroot clock module ? Jason Vas Dias
2010-11-27 18:57 ` Ben Gamari
2010-11-27 19:22   ` Jason Vas Dias [this message]
2010-11-27 23:51     ` Andre Tomt
2010-11-27 19:27   ` Elias Gabriel Amaral da Silva
2010-12-03 19:36 ` Pavel Machek
2010-12-30 20:31   ` webmaster
2011-01-02  5:32     ` Pavel Machek
     [not found] <fTxH4-2pP-5@gated-at.bofh.it>
     [not found] ` <fTya5-30n-9@gated-at.bofh.it>
     [not found]   ` <fTyD7-3UB-11@gated-at.bofh.it>
2010-11-28 11:15     ` Bodo Eggert
2010-11-29 12:52       ` Jason Vas Dias

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201011271922.45611.jason.vas.dias@gmail.com \
    --to=jason.vas.dias@gmail.com \
    --cc=bgamari@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox