mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Kamal Mostafa <kamal@canonical.com>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org,
	kernel-team@lists.ubuntu.com
Cc: Will Deacon <will.deacon@arm.com>,
	Russell King <rmk+kernel@arm.linux.org.uk>,
	Kamal Mostafa <kamal@canonical.com>
Subject: [PATCH 16/58] ARM: 7809/1: perf: fix event validation for software group leaders
Date: Tue,  3 Sep 2013 09:23:20 -0700	[thread overview]
Message-ID: <1378225442-20654-17-git-send-email-kamal@canonical.com> (raw)
In-Reply-To: <1378225442-20654-1-git-send-email-kamal@canonical.com>

3.8.13.8 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Will Deacon <will.deacon@arm.com>

commit c95eb3184ea1a3a2551df57190c81da695e2144b upstream.

It is possible to construct an event group with a software event as a
group leader and then subsequently add a hardware event to the group.
This results in the event group being validated by adding all members
of the group to a fake PMU and attempting to allocate each event on
their respective PMU.

Unfortunately, for software events wthout a corresponding arm_pmu, this
results in a kernel crash attempting to dereference the ->get_event_idx
function pointer.

This patch fixes the problem by checking explicitly for software events
and ignoring those in event validation (since they can always be
scheduled). We will probably want to revisit this for 3.12, since the
validation checks don't appear to work correctly when dealing with
multiple hardware PMUs anyway.

Reported-by: Vince Weaver <vincent.weaver@maine.edu>
Tested-by: Vince Weaver <vincent.weaver@maine.edu>
Tested-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 arch/arm/kernel/perf_event.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/arm/kernel/perf_event.c b/arch/arm/kernel/perf_event.c
index 0a29456..41faea8 100644
--- a/arch/arm/kernel/perf_event.c
+++ b/arch/arm/kernel/perf_event.c
@@ -266,6 +266,9 @@ validate_event(struct pmu_hw_events *hw_events,
 	struct arm_pmu *armpmu = to_arm_pmu(event->pmu);
 	struct pmu *leader_pmu = event->group_leader->pmu;
 
+	if (is_software_event(event))
+		return 1;
+
 	if (event->pmu != leader_pmu || event->state < PERF_EVENT_STATE_OFF)
 		return 1;
 
-- 
1.8.1.2


  parent reply	other threads:[~2013-09-03 16:24 UTC|newest]

Thread overview: 59+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-03 16:23 [ 3.8.y.z extended stable ] Linux 3.8.13.8 stable review Kamal Mostafa
2013-09-03 16:23 ` [PATCH 01/58] mac80211: fix infinite loop in ieee80211_determine_chantype Kamal Mostafa
2013-09-03 16:23 ` [PATCH 02/58] cfg80211/mac80211: disconnect on suspend Kamal Mostafa
2013-09-03 16:23 ` [PATCH 03/58] cfg80211: fix P2P GO interface teardown Kamal Mostafa
2013-09-03 16:23 ` [PATCH 04/58] iwl4965: set power mode early Kamal Mostafa
2013-09-03 16:23 ` [PATCH 05/58] iwl4965: reset firmware after rfkill off Kamal Mostafa
2013-09-03 16:23 ` [PATCH 06/58] ASoC: cs42l52: Reorder Min/Max and update to SX_TLV for Beep Volume Kamal Mostafa
2013-09-03 16:23 ` [PATCH 07/58] can: pcan_usb: fix wrong memcpy() bytes length Kamal Mostafa
2013-09-03 16:23 ` [PATCH 08/58] ALSA: 6fire: make buffers DMA-able (pcm) Kamal Mostafa
2013-09-03 16:23 ` [PATCH 09/58] ALSA: 6fire: make buffers DMA-able (midi) Kamal Mostafa
2013-09-03 16:23 ` [PATCH 10/58] jbd2: Fix use after free after error in jbd2_journal_dirty_metadata() Kamal Mostafa
2013-09-03 16:23 ` [PATCH 11/58] USB: EHCI: accept very late isochronous URBs Kamal Mostafa
2013-09-03 16:23 ` [PATCH 12/58] USB-Serial: Fix error handling of usb_wwan Kamal Mostafa
2013-09-03 16:23 ` [PATCH 13/58] USB: mos7840: fix big-endian probe Kamal Mostafa
2013-09-03 16:23 ` [PATCH 14/58] USB: adutux: fix big-endian device-type reporting Kamal Mostafa
2013-09-03 16:23 ` [PATCH 15/58] USB: ti_usb_3410_5052: fix big-endian firmware handling Kamal Mostafa
2013-09-03 16:23 ` Kamal Mostafa [this message]
2013-09-03 16:23 ` [PATCH 17/58] m68k/atari: ARAnyM - Fix NatFeat module support Kamal Mostafa
2013-09-03 16:23 ` [PATCH 18/58] m68k: Truncate base in do_div() Kamal Mostafa
2013-09-03 16:23 ` [PATCH 19/58] usb: add two quirky touchscreen Kamal Mostafa
2013-09-03 16:23 ` [PATCH 20/58] USB: mos7720: fix broken control requests Kamal Mostafa
2013-09-03 16:23 ` [PATCH 21/58] USB: keyspan: fix null-deref at disconnect and release Kamal Mostafa
2013-09-03 16:23 ` [PATCH 22/58] ASoC: tegra: fix Tegra30 I2S capture parameter setup Kamal Mostafa
2013-09-03 16:23 ` [PATCH 23/58] ALSA: hda - Add a fixup for Gateway LT27 Kamal Mostafa
2013-09-03 16:23 ` [PATCH 24/58] mm: fix the TLB range flushed when __tlb_remove_page() runs out of slots Kamal Mostafa
2013-09-03 16:23 ` [PATCH 25/58] arch, mm: Remove tlb_fast_mode() Kamal Mostafa
2013-09-03 16:23 ` [PATCH 26/58] Fix TLB gather virtual address range invalidation corner cases Kamal Mostafa
2013-09-03 16:23 ` [PATCH 27/58] s390: Fix broken build Kamal Mostafa
2013-09-03 16:23 ` [PATCH 28/58] x86 get_unmapped_area: Access mmap_legacy_base through mm_struct member Kamal Mostafa
2013-09-03 16:23 ` [PATCH 29/58] Bluetooth: Add support for Foxconn/Hon Hai [0489:e04d] Kamal Mostafa
2013-09-03 16:23 ` [PATCH 30/58] Bluetooth: ath3k: Add support for Fujitsu Lifebook UH5x2 [04c5:1330] Kamal Mostafa
2013-09-03 16:23 ` [PATCH 31/58] Bluetooth: ath3k: Add support for ID 0x13d3/0x3402 Kamal Mostafa
2013-09-03 16:23 ` [PATCH 32/58] Bluetooth: Add support for Atheros [0cf3:3121] Kamal Mostafa
2013-09-03 16:23 ` [PATCH 33/58] Bluetooth: Add support for Atheros [0cf3:e003] Kamal Mostafa
2013-09-03 16:23 ` [PATCH 34/58] iwlwifi: dvm: fix calling ieee80211_chswitch_done() with NULL Kamal Mostafa
2013-09-03 16:23 ` [PATCH 35/58] iwlwifi: pcie: disable L1 Active after pci_enable_device Kamal Mostafa
2013-09-03 16:23 ` [PATCH 36/58] zd1201: do not use stack as URB transfer_buffer Kamal Mostafa
2013-09-03 16:23 ` [PATCH 37/58] Hostap: copying wrong data prism2_ioctl_giwaplist() Kamal Mostafa
2013-09-03 16:23 ` [PATCH 38/58] ARM: at91/DT: fix at91sam9n12ek memory node Kamal Mostafa
2013-09-03 16:23 ` [PATCH 39/58] drm/i915: Move num_pipes to intel info Kamal Mostafa
2013-09-03 16:23 ` [PATCH 40/58] drm/i915: Don't deref pipe->cpu_transcoder in the hangcheck code Kamal Mostafa
2013-09-03 16:23 ` [PATCH 41/58] drm/i915: Invalidate TLBs for the rings after a reset Kamal Mostafa
2013-09-03 16:23 ` [PATCH 42/58] libata: apply behavioral quirks to sil3826 PMP Kamal Mostafa
2013-09-03 16:23 ` [PATCH 43/58] ARM: davinci: nand: specify ecc strength Kamal Mostafa
2013-09-03 16:23 ` [PATCH 44/58] ARM: allow kuser helpers to be removed from the vector page Kamal Mostafa
2013-09-03 16:23 ` [PATCH 45/58] ARM: 7816/1: CONFIG_KUSER_HELPERS: fix help text Kamal Mostafa
2013-09-03 16:23 ` [PATCH 46/58] arm64: perf: fix array out of bounds access in armpmu_map_hw_event() Kamal Mostafa
2013-09-03 16:23 ` [PATCH 47/58] arm64: perf: fix event validation for software group leaders Kamal Mostafa
2013-09-03 16:23 ` [PATCH 48/58] sata_fsl: save irqs while coalescing Kamal Mostafa
2013-09-03 16:23 ` [PATCH 49/58] xen/events: initialize local per-cpu mask for all possible events Kamal Mostafa
2013-09-03 16:23 ` [PATCH 50/58] xen/events: mask events when changing their VCPU binding Kamal Mostafa
2013-09-03 16:23 ` [PATCH 51/58] block: Add bio_for_each_segment_all() Kamal Mostafa
2013-09-03 16:23 ` [PATCH 52/58] [SCSI] sg: Fix user memory corruption when SG_IO is interrupted by a signal Kamal Mostafa
2013-09-03 16:23 ` [PATCH 53/58] of: fdt: fix memory initialization for expanded DT Kamal Mostafa
2013-09-03 16:23 ` [PATCH 54/58] [SCSI] zfcp: fix lock imbalance by reworking request queue locking Kamal Mostafa
2013-09-03 16:23 ` [PATCH 55/58] [SCSI] zfcp: fix schedule-inside-lock in scsi_device list loops Kamal Mostafa
2013-09-03 16:24 ` [PATCH 56/58] drivers/platform/olpc/olpc-ec.c: initialise earlier Kamal Mostafa
2013-09-03 16:24 ` [PATCH 57/58] nilfs2: remove double bio_put() in nilfs_end_bio_write() for BIO_EOPNOTSUPP error Kamal Mostafa
2013-09-03 16:24 ` [PATCH 58/58] nilfs2: fix issue with counting number of bio requests for BIO_EOPNOTSUPP error detection Kamal Mostafa

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=1378225442-20654-17-git-send-email-kamal@canonical.com \
    --to=kamal@canonical.com \
    --cc=kernel-team@lists.ubuntu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rmk+kernel@arm.linux.org.uk \
    --cc=stable@vger.kernel.org \
    --cc=will.deacon@arm.com \
    /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®