From: Andrew Morton <akpm@linux-foundation.org>
To: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
Cc: Thomas Gleixner <tglx@linutronix.de>, Ingo Molnar <mingo@elte.hu>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] posix-timers: fix oops in clock_nanosleep() with CLOCK_MONOTONIC_RAW
Date: Tue, 4 Aug 2009 00:22:26 -0700 [thread overview]
Message-ID: <20090804002226.2972cf47.akpm@linux-foundation.org> (raw)
In-Reply-To: <4A764FF3.50607@ct.jp.nec.com>
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...
next prev parent reply other threads:[~2009-08-04 7:23 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-03 2:48 [PATCH] posix-timers: fix oops in clock_nanosleep() with CLOCK_MONOTONIC_RAW Hiroshi Shimamoto
2009-08-04 7:22 ` Andrew Morton [this message]
2009-08-04 7:41 ` Hiroshi Shimamoto
2009-08-04 7:57 ` Andrew Morton
2009-08-04 8:06 ` Hiroshi Shimamoto
2009-08-04 8:21 ` [tip:timers/urgent] posix-timers: Fix " tip-bot for Hiroshi Shimamoto
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090804002226.2972cf47.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=h-shimamoto@ct.jp.nec.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.