From: Andi Kleen <andi@firstfloor.org>
To: mingo@kernel.org
Cc: linux-kernel@vger.kernel.org, a.p.zijlstra@chello.nl,
akpm@linux-foundation.org, acme@redhat.com, eranian@google.com,
jolsa@redhat.com, namhyung@kernel.org,
Andi Kleen <ak@linux.intel.com>
Subject: [PATCH 09/12] perf, x86: Disable LBR recording for unknown LBR_FMT
Date: Thu, 31 Jan 2013 14:51:47 -0800 [thread overview]
Message-ID: <1359672710-19528-10-git-send-email-andi@firstfloor.org> (raw)
In-Reply-To: <1359672710-19528-1-git-send-email-andi@firstfloor.org>
From: Andi Kleen <ak@linux.intel.com>
When the LBR format is unknown disable LBR recording. This prevents
crashes when the LBR address is misdecoded and mis-sign extended.
Signed-off-by: Andi Kleen <ak@linux.intel.com>
---
arch/x86/kernel/cpu/perf_event_intel_lbr.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/arch/x86/kernel/cpu/perf_event_intel_lbr.c b/arch/x86/kernel/cpu/perf_event_intel_lbr.c
index 2af6695b..ad5af13 100644
--- a/arch/x86/kernel/cpu/perf_event_intel_lbr.c
+++ b/arch/x86/kernel/cpu/perf_event_intel_lbr.c
@@ -13,6 +13,7 @@ enum {
LBR_FORMAT_EIP = 0x02,
LBR_FORMAT_EIP_FLAGS = 0x03,
LBR_FORMAT_EIP_FLAGS2 = 0x04,
+ LBR_FORMAT_MAX_KNOWN = LBR_FORMAT_EIP_FLAGS2,
};
/*
@@ -392,7 +393,7 @@ int intel_pmu_setup_lbr_filter(struct perf_event *event)
/*
* no LBR on this PMU
*/
- if (!x86_pmu.lbr_nr)
+ if (!x86_pmu.lbr_nr || x86_pmu.intel_cap.lbr_format > LBR_FORMAT_MAX_KNOWN)
return -EOPNOTSUPP;
/*
--
1.7.7.6
next prev parent reply other threads:[~2013-01-31 22:52 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-31 22:51 Basic perf PMU support for Haswell v2 Andi Kleen
2013-01-31 22:51 ` [PATCH 01/12] perf, x86: Add PEBSv2 record support Andi Kleen
2013-02-01 17:18 ` Stephane Eranian
2013-01-31 22:51 ` [PATCH 02/12] perf, x86: Basic Haswell PMU support v3 Andi Kleen
2013-02-01 17:22 ` Stephane Eranian
2013-01-31 22:51 ` [PATCH 03/12] perf, x86: Basic Haswell PEBS support v4 Andi Kleen
2013-02-01 17:26 ` Stephane Eranian
2013-01-31 22:51 ` [PATCH 04/12] perf, x86: Support the TSX intx/intx_cp qualifiers v3 Andi Kleen
2013-02-01 10:16 ` Ingo Molnar
2013-02-01 15:03 ` Andi Kleen
2013-02-03 10:52 ` Ingo Molnar
2013-01-31 22:51 ` [PATCH 05/12] perf, x86: Support Haswell v4 LBR format Andi Kleen
2013-01-31 22:51 ` [PATCH 06/12] perf, x86: Support full width counting Andi Kleen
2013-01-31 22:51 ` [PATCH 07/12] perf, x86: Avoid checkpointed counters causing excessive TSX aborts v4 Andi Kleen
2013-01-31 22:51 ` [PATCH 08/12] perf, x86: Move NMI clearing to end of PMI handler after the counter registers are reset Andi Kleen
2013-01-31 22:51 ` Andi Kleen [this message]
2013-01-31 22:51 ` [PATCH 10/12] perf, x86: Support LBR filtering by INTX/NOTX/ABORT v3 Andi Kleen
2013-01-31 22:51 ` [PATCH 11/12] perf, tools: Support sorting by intx, abort branch flags v2 Andi Kleen
2013-01-31 22:51 ` [PATCH 12/12] perf, tools: Add abort_tx,no_tx,in_tx branch filter options to perf record -j v3 Andi Kleen
-- strict thread matches above, loose matches on Subject: below --
2013-01-25 22:00 Basic perf PMU support for Haswell v1 Andi Kleen
2013-01-25 22:00 ` [PATCH 09/12] perf, x86: Disable LBR recording for unknown LBR_FMT Andi Kleen
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=1359672710-19528-10-git-send-email-andi@firstfloor.org \
--to=andi@firstfloor.org \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@redhat.com \
--cc=ak@linux.intel.com \
--cc=akpm@linux-foundation.org \
--cc=eranian@google.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=namhyung@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®