[<prev] [next>] [day] [month] [year] [list]
Message-ID: <tip-53020fe81eecd0b7be295868ce5850ef8f41074e@git.kernel.org>
Date: Fri, 15 May 2009 08:43:04 GMT
From: tip-bot for Peter Zijlstra <a.p.zijlstra@...llo.nl>
To: linux-tip-commits@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, paulus@...ba.org, hpa@...or.com,
mingo@...hat.com, a.p.zijlstra@...llo.nl, tglx@...utronix.de,
cjashfor@...ux.vnet.ibm.com, mingo@...e.hu
Subject: [tip:perfcounters/core] perf_counter: Fix perf_output_copy() WARN to account for overflow
Commit-ID: 53020fe81eecd0b7be295868ce5850ef8f41074e
Gitweb: http://git.kernel.org/tip/53020fe81eecd0b7be295868ce5850ef8f41074e
Author: Peter Zijlstra <a.p.zijlstra@...llo.nl>
AuthorDate: Wed, 13 May 2009 21:26:19 +0200
Committer: Ingo Molnar <mingo@...e.hu>
CommitDate: Fri, 15 May 2009 09:46:59 +0200
perf_counter: Fix perf_output_copy() WARN to account for overflow
The simple reservation test in perf_output_copy() failed to take
unsigned int overflow into account, fix this.
[ Impact: fix false positive warning with more than 4GB of profiling data ]
Signed-off-by: Peter Zijlstra <a.p.zijlstra@...llo.nl>
Cc: Paul Mackerras <paulus@...ba.org>
Cc: Corey Ashford <cjashfor@...ux.vnet.ibm.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@...e.hu>
---
kernel/perf_counter.c | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c
index ff166c1..985be0b 100644
--- a/kernel/perf_counter.c
+++ b/kernel/perf_counter.c
@@ -1927,7 +1927,11 @@ static void perf_output_copy(struct perf_output_handle *handle,
handle->offset = offset;
- WARN_ON_ONCE(handle->offset > handle->head);
+ /*
+ * Check we didn't copy past our reservation window, taking the
+ * possible unsigned int wrap into account.
+ */
+ WARN_ON_ONCE(((int)(handle->head - handle->offset)) < 0);
}
#define perf_output_put(handle, x) \
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists