mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Lin Tan <tammy000@gmail.com>
To: linux-kernel@vger.kernel.org
Subject: kernel/posix-timer.c: Forgot to disable interrupts in  sys_timer_settime()?
Date: Sun, 23 Aug 2009 17:18:02 -0500	[thread overview]
Message-ID: <7fcc02550908231518m1d35a0c6kd4397b974ac65747@mail.gmail.com> (raw)

Hi,

Did we forget to disable interrupts before calling
posix_cpu_timer_set() in the system call function sys_timer_settime()
(in code literally as SYSCALL_DEFINE4(timer_settime, ...) as shown
below)? The CLOCK_DISPATCH macro invokes posix_cpu_timer_set(), which
requires interrupts to be disabled upon entry of calling. When
posix_cpu_timer_set() was called from other functions such as
do_cpu_nanosleep(), interrupts are disabled.


SYSCALL_DEFINE4(timer_settime, timer_t, timer_id, int, flags,
 769                const struct itimerspec __user *, new_setting,
 770                struct itimerspec __user *, old_setting)
 771{
    ...
 792        error = CLOCK_DISPATCH(timr->it_clock, timer_set,
 793                               (timr, flags, &new_spec, rtn)); //
this MACRO invokes posix_cpu_timer_set()
 ...
}


In addition, its block comments also state that we must disable
interrupts before calling it (in posix-cpu-timers.c):

/*
 712 * ...
 713 * This is called with the timer locked and interrupts disabled.
 714 *
 ...
 716 */
 717int posix_cpu_timer_set(struct k_itimer *timer, int flags,
 718                        struct itimerspec *new, struct itimerspec *old)
 719{
  ...
}

Thanks,
Lin

                 reply	other threads:[~2009-08-23 22:18 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=7fcc02550908231518m1d35a0c6kd4397b974ac65747@mail.gmail.com \
    --to=tammy000@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®