[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [gpsd-users] gpsd/udev behavior
From: |
Paul Fox |
Subject: |
Re: [gpsd-users] gpsd/udev behavior |
Date: |
Fri, 25 May 2012 13:36:13 -0400 |
eric s. raymond wrote:
> Paul Fox <address@hidden>:
> > manually changing the device permissions from 660 to 666 makes
> > everything work.
> >
> > the machine is an OLPC XO laptop, so it's entirely possible that it's
> > a problem with our version of F17, but we don't really touch udev
> > much. (i say "we", because my work address is @laptop.org.) any tips
> > how this _should_ be working?
>
> This is probably a distro-specific issue brought about by the choice
> of default ownership or default permissions on the TTY devices. Or it
> could be the result of a minor packaging error. See the code near the
> the following comment in gpsd.c
>
> /*
> * Drop privileges. Up to now we've been running as root. Instead,
> * set the user ID to 'nobody' (or whatever the --enable-gpsd-user
> * is) and the group ID to the owning group of a prototypical TTY
> * device. This limits the scope of any compromises in the code.
> * It requires that all GPS devices have their group read/write
> * permissions set.
> */
>
> I'd explain in detail, but I think the comment and code are clear enough.
yes, thank you. exactly the nudge i needed, and it explains
everything.
in the case of invocation via udev, there is no prototypical TTY
device, so the code falls back on /dev/ttyS0 for the group id. that
was certainly a reasonable fallback for a legacy PC especially in the
pre-udev world, but gpsd might need more flexibility now.
on the current XO ARM-based laptop, for instance, there is no ttyS0 at
all. (there's a ttyS2, and sometimes a ttyS3, but no S0 or S1 for
reasons i won't go into right now.) so gpsd can't open the
prototypical tty, and ends up running as nobody:root. it therefore
can't open /dev/ttyUSB0 which is owned (on the XO) by root:dialout.
as a stopgap, since all gpsd does is stat() the prototypical device,
this is a useable workaround:
touch /dev/ttyS0; chown root:dialout /dev/ttyS0
the answer might be a command-line argument (i.e., "-g gid") as a hook
that could be set via /etc/{default,sysconfig}/gpsd. i'd be happy
to contribute that patch if you thought it was a good idea. (i
understand the dangers of option creep.)
another (likely unacceptable :-) option would be a commandline flag
telling gpsd not to drop privileges.
(on the XO, we actually have a bigger issue concerning USB device
permissions generally, and the solution will likely end up making this
problem with gpsd moot. but it won't be a generally useable solution
for others: http://dev.laptop.org/ticket/11877 )
paul
=---------------------
paul fox, address@hidden (arlington, ma, where it's 63.0 degrees)
- [gpsd-users] gpsd/udev behavior, Paul Fox, 2012/05/21
- Re: [gpsd-users] gpsd/udev behavior, Eric S. Raymond, 2012/05/24
- Re: [gpsd-users] gpsd/udev behavior,
Paul Fox <=
- Re: [gpsd-users] gpsd/udev behavior, Eric S. Raymond, 2012/05/29
- Re: [gpsd-users] gpsd/udev behavior, Paul Fox, 2012/05/29
- Re: [gpsd-users] gpsd/udev behavior, Eric S. Raymond, 2012/05/29
- Re: [gpsd-users] gpsd/udev behavior, Paul Fox, 2012/05/29
- Re: [gpsd-users] gpsd/udev behavior, Eric S. Raymond, 2012/05/29
- Re: [gpsd-users] gpsd/udev behavior, Paul Fox, 2012/05/29