Re: [patch 28/28] posix clocks: Introduce dynamic clocks

From: torbenh
Date: Thu Mar 03 2011 - 12:08:15 EST


On Thu, Mar 03, 2011 at 05:01:14PM +0100, Richard Cochran wrote:
> On Thu, Mar 03, 2011 at 03:50:08PM +0100, torbenh wrote:
> > On Tue, Feb 01, 2011 at 01:52:35PM -0000, Thomas Gleixner wrote:
> > > +static int pc_clock_adjtime(clockid_t id, struct timex *tx)
> > > +{
> > > + struct posix_clock_desc cd;
> > > + int err;
> > > +
> > > + err = get_clock_desc(id, &cd);
> > > + if (err)
> > > + return err;
> >
> > there is no permission check here.
> > if i get the clock fd in READ mode, i can still adjtime.
> > same for settime.
>
> You are right, but I think the check should be for the capability
> instead. Checking the file mode for RDWR seems a bit pedantic to me.

i dont see, why an fd based clock, which already has associated permissions,
should check against the capability.
why should the ptpd be running as root ?
changing the permissions of /dev/ptp0 to allow ptpd to set the
clock should be enough.

>
> For the normal system timer, clock_settime calls security_settime, but
> adjtimex calls capable(CAP_SYS_TIME) directly. Perhaps adjtimex should
> also use the security call, too.

probably yes.

>
> Thanks,
>
> Richard
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/

--
torben Hohn
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/