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

From: Richard Cochran
Date: Thu Mar 03 2011 - 11:01:50 EST


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.

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.

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/