[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [gpsd-dev] Time Service HOWTO in nearly final form; please review
From: |
Eric S. Raymond |
Subject: |
Re: [gpsd-dev] Time Service HOWTO in nearly final form; please review |
Date: |
Sat, 26 Oct 2013 11:07:49 -0400 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
Beat Bolli <address@hidden>:
> On 26.10.13 14:23, Eric S. Raymond wrote:
> > Beat Bolli <address@hidden>:
> >> The section that explains the differences between root vs. non-root
> >> operation and devices on the command line vs. hotplug needs to be
> >> adjusted now that the root privileges are dropped after setting up the
> >> SHM segments and raising the PPS thread priority (commit
> >> 247c5825172137f337a79a1ff2f73b4af2899f66).
> >
> > I'm not seeing how, sorry. Gary moved the thread interlock to avoid a
> > race condition, and this does mean time_pps_create() will always be
> > called with root permissions. But it appears to me that this just
> > removes a bug that prevented the code from behaving as documented.
>
> But would this not imply that the hot-plugged GPS would also have access
> to the unit 0 and 1 SHM regions?
Alas, no. I should have said "always be called with root permissions
for a command-line device". Trace the call chain: the relevant section
of code is in ntpshm_pps(), which is called by gpsd_ppsmonitor(), which
is called by pps_thread_activate(), which is called by the ntpshm.c entry point
ntpd_link_activate().
That is called by gpsd_add_device(), which can be called under one of
two circumstances. It may be processing a command-line path, in which
case root permissions are in effect. Or it may be called to open a path
passed down the gpsd control socket as the result of a hotplug attempt,
in which case root privileges will have been dropped.
--
<a href="http://www.catb.org/~esr/">Eric S. Raymond</a>
signature.asc
Description: Digital signature