lkml.org 
[lkml]   [2009]   [Aug]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] posix-timers: fix oops in clock_nanosleep() with CLOCK_MONOTONIC_RAW
On Mon, 03 Aug 2009 11:48:19 +0900 Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com> wrote:

> From: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
>
> Prevent calling do_nanosleep() with clockid CLOCK_MONOTONIC_RAW, it may
> cause oops, such as NULL pointer dereference.
>
> Signed-off-by: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
> ---
> kernel/posix-timers.c | 7 +++++++
> 1 files changed, 7 insertions(+), 0 deletions(-)
>
> diff --git a/kernel/posix-timers.c b/kernel/posix-timers.c
> index 052ec4d..d089d05 100644
> --- a/kernel/posix-timers.c
> +++ b/kernel/posix-timers.c
> @@ -202,6 +202,12 @@ static int no_timer_create(struct k_itimer *new_timer)
> return -EOPNOTSUPP;
> }
>
> +static int no_nsleep(const clockid_t which_clock, int flags,
> + struct timespec *tsave, struct timespec __user *rmtp)
> +{
> + return -EOPNOTSUPP;
> +}
> +
> /*
> * Return nonzero if we know a priori this clockid_t value is bogus.
> */
> @@ -254,6 +260,7 @@ static __init int init_posix_timers(void)
> .clock_get = posix_get_monotonic_raw,
> .clock_set = do_posix_clock_nosettime,
> .timer_create = no_timer_create,
> + .nsleep = no_nsleep,
> };
>
> register_posix_clock(CLOCK_REALTIME, &clock_realtime);

Under which circumstances will this oops trigger?

What userspace setup/actions will trigger the oops?

Thanks.



<spends 5 minutes trying to work out where k_clock.nsleep() even gets
called from>

OK, that CLOCK_DISPATCH() thing should be strangled and burnt...


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