From: tip-bot for Stanislaw Gruszka <sgruszka@redhat.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, hpa@zytor.com, mingo@redhat.com,
a.p.zijlstra@chello.nl, akpm@linux-foundation.org,
tglx@linutronix.de, oleg@redhat.com, sgruszka@redhat.com,
mingo@elte.hu
Subject: [tip:timers/urgent] itimers: Fix racy writes to cpu_itimer fields
Date: Wed, 18 Nov 2009 15:36:51 GMT [thread overview]
Message-ID: <tip-8747d793fc5c4d3e4decd41d55f6dc24498dd5f5@git.kernel.org> (raw)
In-Reply-To: <1253802903-979-1-git-send-email-sgruszka@redhat.com>
Commit-ID: 8747d793fc5c4d3e4decd41d55f6dc24498dd5f5
Gitweb: http://git.kernel.org/tip/8747d793fc5c4d3e4decd41d55f6dc24498dd5f5
Author: Stanislaw Gruszka <sgruszka@redhat.com>
AuthorDate: Tue, 17 Nov 2009 14:14:12 -0800
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitDate: Wed, 18 Nov 2009 16:32:12 +0100
itimers: Fix racy writes to cpu_itimer fields
incr_error and error fields of struct cpu_itimer are used when calculating
next timer tick in check_cpu_itimers() and should not be modified without
tsk->sighand->siglock taken.
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
LKML-Reference: <1253802903-979-1-git-send-email-sgruszka@redhat.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
kernel/itimer.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/kernel/itimer.c b/kernel/itimer.c
index b03451e..d802883 100644
--- a/kernel/itimer.c
+++ b/kernel/itimer.c
@@ -146,6 +146,7 @@ static void set_cpu_itimer(struct task_struct *tsk, unsigned int clock_id,
{
cputime_t cval, nval, cinterval, ninterval;
s64 ns_ninterval, ns_nval;
+ u32 error, incr_error;
struct cpu_itimer *it = &tsk->signal->it[clock_id];
nval = timeval_to_cputime(&value->it_value);
@@ -153,8 +154,8 @@ static void set_cpu_itimer(struct task_struct *tsk, unsigned int clock_id,
ninterval = timeval_to_cputime(&value->it_interval);
ns_ninterval = timeval_to_ns(&value->it_interval);
- it->incr_error = cputime_sub_ns(ninterval, ns_ninterval);
- it->error = cputime_sub_ns(nval, ns_nval);
+ error = cputime_sub_ns(nval, ns_nval);
+ incr_error = cputime_sub_ns(ninterval, ns_ninterval);
spin_lock_irq(&tsk->sighand->siglock);
@@ -168,6 +169,8 @@ static void set_cpu_itimer(struct task_struct *tsk, unsigned int clock_id,
}
it->expires = nval;
it->incr = ninterval;
+ it->error = error;
+ it->incr_error = incr_error;
trace_itimer_state(clock_id == CPUCLOCK_VIRT ?
ITIMER_VIRTUAL : ITIMER_PROF, value, nval);
prev parent reply other threads:[~2009-11-18 15:38 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-24 14:35 [PATCH 1/2] itimers: fix racy writes to cpu_itimer fields Stanislaw Gruszka
2009-09-24 14:35 ` [PATCH 2/2] posix-cpu-timers: initialize new_itimer->it.cpu.firing Stanislaw Gruszka
2009-09-24 14:48 ` [PATCH 1/2] itimers: fix racy writes to cpu_itimer fields Peter Zijlstra
2009-09-24 17:57 ` Stanislaw Gruszka
2009-09-24 18:04 ` Peter Zijlstra
2009-09-24 20:19 ` Ingo Molnar
2009-09-30 15:05 ` Stanislaw Gruszka
2009-11-18 15:36 ` tip-bot for Stanislaw Gruszka [this message]
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=tip-8747d793fc5c4d3e4decd41d55f6dc24498dd5f5@git.kernel.org \
--to=sgruszka@redhat.com \
--cc=a.p.zijlstra@chello.nl \
--cc=akpm@linux-foundation.org \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=mingo@redhat.com \
--cc=oleg@redhat.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox