lkml.org 
[lkml]   [2011]   [Mar]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 3/3] Check for write permission on FD based posix-clocks
On Thu, Mar 03, 2011 at 06:26:14PM +0100, Torben Hohn wrote:
> pc_clock_settime() and pc_clock_adjtime() did not check
> whether the fd was opened in write mode.
>
> It was possible to set a clock, when we only had read
> permissions.
>
> for completeness, we would also need to check for Read permissions
> on the read operations. but that would be a bit paranoid, probably.

I have no objection to this form of clock access control, but I would
like to get agreement about it from the list.

> diff --git a/kernel/time/posix-clock.c b/kernel/time/posix-clock.c
> index 04498cb..25028dd 100644
> --- a/kernel/time/posix-clock.c
> +++ b/kernel/time/posix-clock.c
> @@ -287,11 +287,16 @@ static int pc_clock_adjtime(clockid_t id, struct timex *tx)
> if (err)
> return err;
>
> + if ((cd.fp->f_mode & FMODE_WRITE) == 0) {
> + err = -EACCES;

Looks like clock_settime and adjtimex are supposed to return EPERM in
this case.

Thanks,

Richard




\
 
 \ /
  Last update: 2011-03-04 08:25    [W:0.096 / U:8.128 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site