tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: /dev/clockctl, O_CLOEXEC and forking



In article <20180429165331.GA8898@neva>,
Alexander Nasonov  <alnsn%yandex.ru@localhost> wrote:
>-=-=-=-=-=-
>
>While looking whether it's possible to change ntpd to work when
>chrooted to a file system mounted with the nodev flag, I noticed
>that /dev/clockctl is open with O_CLOEXEC and its file descriptor
>is kept in a static variable.  I'm not sure it will work after a
>fork correctly. ntpd doesn't open /dev/clockctl before forking but
>things may change in a future. Any opinions?

After fork it would work fine, after exec, not so much as the name implies :-)

>PS I attach my proof-of-concept patch that attempts to configure
>/dev/clockctl before chrooting ntpd but it doesn't work because
>clockctl's file descriptor is closed by the fork.

It may be closed by something else, but not the fork. Nevertheless
we should not be exposing new API's here... We should arrange so that
things just work. In this case, you could just call adjtime with a 0
delta perhaps instead...

christos



Home | Main Index | Thread Index | Old Index