stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org,
	Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com>,
	Madhavan Srinivasan <maddy@linux.vnet.ibm.com>,
	Michael Ellerman <mpe@ellerman.id.au>,
	Sasha Levin <alexander.levin@microsoft.com>
Subject: [PATCH 4.9 061/145] powerpc/perf: Fix oops when grouping different pmu events
Date: Fri, 23 Feb 2018 19:26:07 +0100	[thread overview]
Message-ID: <20180223170732.680009918@linuxfoundation.org> (raw)
In-Reply-To: <20180223170724.669759283@linuxfoundation.org>

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

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

From: Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com>


[ Upstream commit 5aa04b3eb6fca63d2e9827be656dcadc26d54e11 ]

When user tries to group imc (In-Memory Collections) event with
normal event, (sometime) kernel crashes with following log:

    Faulting instruction address: 0x00000000
    [link register   ] c00000000010ce88 power_check_constraints+0x128/0x980
    ...
    c00000000010e238 power_pmu_event_init+0x268/0x6f0
    c0000000002dc60c perf_try_init_event+0xdc/0x1a0
    c0000000002dce88 perf_event_alloc+0x7b8/0xac0
    c0000000002e92e0 SyS_perf_event_open+0x530/0xda0
    c00000000000b004 system_call+0x38/0xe0

'event_base' field of 'struct hw_perf_event' is used as flags for
normal hw events and used as memory address for imc events. While
grouping these two types of events, collect_events() tries to
interpret imc 'event_base' as a flag, which causes a corruption
resulting in a crash.

Consider only those events which belongs to 'perf_hw_context' in
collect_events().

Signed-off-by: Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com>
Reviewed-By: Madhavan Srinivasan <maddy@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 arch/powerpc/perf/core-book3s.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/arch/powerpc/perf/core-book3s.c
+++ b/arch/powerpc/perf/core-book3s.c
@@ -1381,7 +1381,7 @@ static int collect_events(struct perf_ev
 	int n = 0;
 	struct perf_event *event;
 
-	if (!is_software_event(group)) {
+	if (group->pmu->task_ctx_nr == perf_hw_context) {
 		if (n >= max_count)
 			return -1;
 		ctrs[n] = group;
@@ -1389,7 +1389,7 @@ static int collect_events(struct perf_ev
 		events[n++] = group->hw.config;
 	}
 	list_for_each_entry(event, &group->sibling_list, group_entry) {
-		if (!is_software_event(event) &&
+		if (event->pmu->task_ctx_nr == perf_hw_context &&
 		    event->state != PERF_EVENT_STATE_OFF) {
 			if (n >= max_count)
 				return -1;

  parent reply	other threads:[~2018-02-23 18:44 UTC|newest]

Thread overview: 132+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-23 18:25 [PATCH 4.9 000/145] 4.9.84-stable review Greg Kroah-Hartman
2018-02-23 18:25 ` [PATCH 4.9 001/145] vhost: use mutex_lock_nested() in vhost_dev_lock_vqs() Greg Kroah-Hartman
2018-02-23 18:25 ` [PATCH 4.9 002/145] kcm: Check if sk_user_data already set in kcm_attach Greg Kroah-Hartman
2018-02-23 18:25 ` [PATCH 4.9 003/145] kcm: Only allow TCP sockets to be attached to a KCM mux Greg Kroah-Hartman
2018-02-23 18:25 ` [PATCH 4.9 004/145] cfg80211: check dev_set_name() return value Greg Kroah-Hartman
2018-02-23 18:25 ` [PATCH 4.9 005/145] xfrm: skip policies marked as dead while rehashing Greg Kroah-Hartman
2018-02-23 18:25 ` [PATCH 4.9 006/145] mm,vmscan: Make unregister_shrinker() no-op if register_shrinker() failed Greg Kroah-Hartman
2018-02-23 18:25 ` [PATCH 4.9 007/145] xfrm: Fix stack-out-of-bounds read on socket policy lookup Greg Kroah-Hartman
2018-02-23 18:25 ` [PATCH 4.9 008/145] xfrm: check id proto in validate_tmpl() Greg Kroah-Hartman
2018-02-23 18:25 ` [PATCH 4.9 009/145] sctp: set frag_point in sctp_setsockopt_maxseg correctly Greg Kroah-Hartman
2018-02-23 18:25 ` [PATCH 4.9 010/145] blktrace: fix unlocked registration of tracepoints Greg Kroah-Hartman
2018-02-23 18:25 ` [PATCH 4.9 012/145] ptr_ring: fail early if queue occupies more than KMALLOC_MAX_SIZE Greg Kroah-Hartman
2018-02-23 18:25 ` [PATCH 4.9 013/145] Provide a function to create a NUL-terminated string from unterminated data Greg Kroah-Hartman
2018-02-23 18:25 ` [PATCH 4.9 014/145] selinux: ensure the context is NUL terminated in security_context_to_sid_core() Greg Kroah-Hartman
2018-02-23 18:25 ` [PATCH 4.9 015/145] selinux: skip bounded transition processing if the policy isnt loaded Greg Kroah-Hartman
2018-02-23 18:25 ` [PATCH 4.9 016/145] crypto: x86/twofish-3way - Fix %rbp usage Greg Kroah-Hartman
2018-02-23 18:25 ` [PATCH 4.9 017/145] staging: android: ion: Add __GFP_NOWARN for system contig heap Greg Kroah-Hartman
2018-02-23 18:25 ` [PATCH 4.9 018/145] staging: android: ion: Switch from WARN to pr_warn Greg Kroah-Hartman
2018-02-23 18:25 ` [PATCH 4.9 019/145] blk_rq_map_user_iov: fix error override Greg Kroah-Hartman
2018-02-23 18:25 ` [PATCH 4.9 021/145] kcov: detect double association with a single task Greg Kroah-Hartman
2018-02-23 18:25 ` [PATCH 4.9 022/145] netfilter: x_tables: fix int overflow in xt_alloc_table_info() Greg Kroah-Hartman
2018-02-23 18:25 ` [PATCH 4.9 023/145] netfilter: x_tables: avoid out-of-bounds reads in xt_request_find_{match|target} Greg Kroah-Hartman
2018-02-23 18:25 ` [PATCH 4.9 024/145] netfilter: ipt_CLUSTERIP: fix out-of-bounds accesses in clusterip_tg_check() Greg Kroah-Hartman
2018-02-23 18:25 ` [PATCH 4.9 025/145] netfilter: on sockopt() acquire sock lock only in the required scope Greg Kroah-Hartman
2018-02-23 18:25 ` [PATCH 4.9 026/145] netfilter: xt_cgroup: initialize info->priv in cgroup_mt_check_v1() Greg Kroah-Hartman
2018-02-23 18:25 ` [PATCH 4.9 027/145] netfilter: xt_RATEEST: acquire xt_rateest_mutex for hash insert Greg Kroah-Hartman
2018-02-23 18:25 ` [PATCH 4.9 028/145] rds: tcp: atomically purge entries from rds_tcp_conn_list during netns delete Greg Kroah-Hartman
2018-02-23 18:25 ` [PATCH 4.9 029/145] net: avoid skb_warn_bad_offload on IS_ERR Greg Kroah-Hartman
2018-02-23 18:25 ` [PATCH 4.9 030/145] crypto: hash - annotate algorithms taking optional key Greg Kroah-Hartman
2018-02-23 18:25 ` [PATCH 4.9 031/145] crypto: hash - prevent using keyed hashes without setting key Greg Kroah-Hartman
2018-02-23 18:25 ` [PATCH 4.9 032/145] ASoC: ux500: add MODULE_LICENSE tag Greg Kroah-Hartman
2018-02-23 18:25 ` [PATCH 4.9 033/145] video: fbdev/mmp: add MODULE_LICENSE Greg Kroah-Hartman
2018-02-23 18:25 ` [PATCH 4.9 034/145] ARM: 8743/1: bL_switcher: add MODULE_LICENSE tag Greg Kroah-Hartman
2018-02-23 18:25 ` [PATCH 4.9 035/145] arm64: dts: add #cooling-cells to CPU nodes Greg Kroah-Hartman
2018-02-23 18:25 ` [PATCH 4.9 036/145] dn_getsockoptdecnet: move nf_{get/set}sockopt outside sock lock Greg Kroah-Hartman
2018-02-23 18:25 ` [PATCH 4.9 037/145] staging: android: ashmem: Fix a race condition in pin ioctls Greg Kroah-Hartman
2018-02-23 18:25 ` [PATCH 4.9 038/145] binder: check for binder_thread allocation failure in binder_poll() Greg Kroah-Hartman
2018-02-23 18:25 ` [PATCH 4.9 039/145] staging: iio: adc: ad7192: fix external frequency setting Greg Kroah-Hartman
2018-02-23 18:25 ` [PATCH 4.9 040/145] staging: iio: ad5933: switch buffer mode to software Greg Kroah-Hartman
2018-02-23 18:25 ` [PATCH 4.9 041/145] usbip: keep usbip_device sockfd state in sync with tcp_socket Greg Kroah-Hartman
2018-02-23 18:25 ` [PATCH 4.9 042/145] usb: build drivers/usb/common/ when USB_SUPPORT is set Greg Kroah-Hartman
2018-02-23 18:25 ` [PATCH 4.9 043/145] ARM: OMAP2+: Fix SRAM virt to phys translation for save_secure_ram_context Greg Kroah-Hartman
2018-02-23 18:25 ` [PATCH 4.9 044/145] ARM: AM33xx: PRM: Remove am33xx_pwrdm_read_prev_pwrst function Greg Kroah-Hartman
2018-02-23 18:25 ` [PATCH 4.9 045/145] ARM: dts: Fix omap4 hang with GPS connected to USB by using wakeupgen Greg Kroah-Hartman
2018-02-23 18:25 ` [PATCH 4.9 046/145] ARM: dts: logicpd-som-lv: Fix gpmc addresses for NAND and enet Greg Kroah-Hartman
2018-02-23 18:25 ` [PATCH 4.9 047/145] ARM: dts: logicpd-somlv: Fix wl127x pinmux Greg Kroah-Hartman
2018-02-23 18:25 ` [PATCH 4.9 048/145] ARM: dts: am4372: Correct the interrupts_properties of McASP Greg Kroah-Hartman
2018-02-23 18:25 ` [PATCH 4.9 049/145] ARM: dts: am437x-cm-t43: Correct the dmas property of spi0 Greg Kroah-Hartman
2018-02-23 18:25 ` [PATCH 4.9 050/145] perf top: Fix window dimensions change handling Greg Kroah-Hartman
2018-02-23 18:25 ` [PATCH 4.9 051/145] perf bench numa: Fixup discontiguous/sparse numa nodes Greg Kroah-Hartman
2018-02-23 18:25 ` [PATCH 4.9 052/145] media: s5k6aa: describe some function parameters Greg Kroah-Hartman
2018-02-23 18:25 ` [PATCH 4.9 053/145] pinctrl: sunxi: Fix A80 interrupt pin bank Greg Kroah-Hartman
2018-02-23 18:26 ` [PATCH 4.9 054/145] pinctrl: sunxi: Fix A64 UART mux value Greg Kroah-Hartman
2018-02-23 18:26 ` [PATCH 4.9 055/145] i40iw: Correct ARP index mask Greg Kroah-Hartman
2018-02-23 18:26 ` [PATCH 4.9 056/145] RDMA/cma: Make sure that PSN is not over max allowed Greg Kroah-Hartman
2018-02-23 18:26 ` [PATCH 4.9 057/145] sctp: only update outstanding_bytes for transmitted queue when doing prsctp_prune Greg Kroah-Hartman
2018-02-23 18:26 ` [PATCH 4.9 058/145] scripts/kernel-doc: Dont fail with status != 0 if error encountered with -none Greg Kroah-Hartman
2018-02-23 18:26 ` [PATCH 4.9 059/145] ipvlan: Add the skb->mark as flow4s member to lookup route Greg Kroah-Hartman
2018-02-23 18:26 ` [PATCH 4.9 060/145] m68k: add missing SOFTIRQENTRY_TEXT linker section Greg Kroah-Hartman
2018-02-23 18:26 ` Greg Kroah-Hartman [this message]
2018-02-23 18:26 ` [PATCH 4.9 062/145] s390/dasd: prevent prefix I/O error Greg Kroah-Hartman
2018-02-23 18:26 ` [PATCH 4.9 063/145] ARM: dts: Fix elm interrupt compiler warning Greg Kroah-Hartman
2018-02-23 18:26 ` [PATCH 4.9 064/145] gianfar: fix a flooded alignment reports because of padding issue Greg Kroah-Hartman
2018-02-23 18:26 ` [PATCH 4.9 065/145] net_sched: red: Avoid devision by zero Greg Kroah-Hartman
2018-02-23 18:26 ` [PATCH 4.9 066/145] net_sched: red: Avoid illegal values Greg Kroah-Hartman
2018-02-23 18:26 ` [PATCH 4.9 067/145] btrfs: Fix possible off-by-one in btrfs_search_path_in_tree Greg Kroah-Hartman
2018-02-23 18:26 ` [PATCH 4.9 068/145] brcmfmac: Avoid build error with make W=1 Greg Kroah-Hartman
2018-02-23 18:26 ` [PATCH 4.9 069/145] net: ethernet: arc: fix error handling in emac_rockchip_probe Greg Kroah-Hartman
2018-02-23 18:26 ` [PATCH 4.9 070/145] 509: fix printing uninitialized stack memory when OID is empty Greg Kroah-Hartman
2018-02-23 18:26 ` [PATCH 4.9 071/145] gianfar: Disable EEE autoneg by default Greg Kroah-Hartman
2018-02-23 18:26 ` [PATCH 4.9 072/145] dmaengine: ioat: Fix error handling path Greg Kroah-Hartman
2018-02-23 18:26 ` [PATCH 4.9 073/145] dmaengine: at_hdmac: fix potential NULL pointer dereference in atc_prep_dma_interleaved Greg Kroah-Hartman
2018-02-23 18:26 ` [PATCH 4.9 074/145] clk: fix a panic error caused by accessing NULL pointer Greg Kroah-Hartman
2018-02-23 18:26 ` [PATCH 4.9 075/145] ASoC: rockchip: disable clock on error Greg Kroah-Hartman
2018-02-23 18:26 ` [PATCH 4.9 076/145] spi: sun4i: disable clocks in the remove function Greg Kroah-Hartman
2018-02-23 18:26 ` [PATCH 4.9 077/145] xfrm: Fix stack-out-of-bounds with misconfigured transport mode policies Greg Kroah-Hartman
2018-02-23 18:26 ` [PATCH 4.9 078/145] drm/armada: fix leak of crtc structure Greg Kroah-Hartman
2018-02-23 18:26 ` [PATCH 4.9 079/145] dmaengine: jz4740: disable/unprepare clk if probe fails Greg Kroah-Hartman
2018-02-23 18:26 ` [PATCH 4.9 080/145] usb: dwc3: gadget: Wait longer for controller to end command processing Greg Kroah-Hartman
2018-02-23 18:26 ` [PATCH 4.9 081/145] usb: dwc3: of-simple: fix missing clk_disable_unprepare Greg Kroah-Hartman
2018-02-23 18:26 ` [PATCH 4.9 082/145] mm/early_ioremap: Fix boot hang with earlyprintk=efi,keep Greg Kroah-Hartman
2018-02-23 18:26 ` [PATCH 4.9 083/145] x86/mm/kmmio: Fix mmiotrace for page unaligned addresses Greg Kroah-Hartman
2018-02-23 18:26 ` [PATCH 4.9 085/145] xen: XEN_ACPI_PROCESSOR is Dom0-only Greg Kroah-Hartman
2018-02-23 18:26 ` [PATCH 4.9 086/145] hippi: Fix a Fix a possible sleep-in-atomic bug in rr_close Greg Kroah-Hartman
2018-02-23 18:26 ` [PATCH 4.9 087/145] powerpc/64s: Fix conversion of slb_miss_common to use RFI_TO_USER/KERNEL Greg Kroah-Hartman
2018-02-23 18:26 ` [PATCH 4.9 088/145] powerpc/64s: Simple RFI macro conversions Greg Kroah-Hartman
2018-02-23 18:26 ` [PATCH 4.9 089/145] powerpc/64s: Improve RFI L1-D cache flush fallback Greg Kroah-Hartman
2018-02-23 18:26 ` [PATCH 4.9 090/145] crypto: talitos - fix Kernel Oops on hashing an empty file Greg Kroah-Hartman
2018-02-23 18:26 ` [PATCH 4.9 091/145] drm/i915: fix intel_backlight_device_register declaration Greg Kroah-Hartman
2018-02-23 18:26 ` [PATCH 4.9 092/145] shmem: avoid maybe-uninitialized warning Greg Kroah-Hartman
2018-02-23 18:26 ` [PATCH 4.9 093/145] clk: sunxi-ng: fix build error without CONFIG_RESET_CONTROLLER Greg Kroah-Hartman
2018-02-23 18:26 ` [PATCH 4.9 094/145] vmxnet3: prevent building with 64K pages Greg Kroah-Hartman
2018-02-23 18:26 ` [PATCH 4.9 100/145] PCI: Change pci_host_common_probe() visibility Greg Kroah-Hartman
2018-02-23 18:26 ` [PATCH 4.9 101/145] perf: xgene: Include module.h Greg Kroah-Hartman
2018-02-23 18:26 ` [PATCH 4.9 102/145] video: fbdev: via: remove possibly unused variables Greg Kroah-Hartman
2018-02-23 18:26 ` [PATCH 4.9 103/145] scsi: advansys: fix build warning for PCI=n Greg Kroah-Hartman
2018-02-23 18:26 ` [PATCH 4.9 105/145] gpio: xgene: mark PM functions as __maybe_unused Greg Kroah-Hartman
2018-02-23 18:26 ` [PATCH 4.9 106/145] arm64: define BUG() instruction without CONFIG_BUG Greg Kroah-Hartman
2018-02-23 18:26 ` [PATCH 4.9 108/145] tools build: Add tools tree support for make -s Greg Kroah-Hartman
2018-02-23 18:26 ` [PATCH 4.9 109/145] x86/build: Silence the build with "make -s" Greg Kroah-Hartman
2018-02-23 18:26 ` [PATCH 4.9 110/145] thermal: fix INTEL_SOC_DTS_IOSF_CORE dependencies Greg Kroah-Hartman
2018-02-23 18:26 ` [PATCH 4.9 112/145] dmaengine: zx: fix build warning Greg Kroah-Hartman
2018-02-23 18:26 ` [PATCH 4.9 113/145] x86/platform: Add PCI dependency for PUNIT_ATOM_DEBUG Greg Kroah-Hartman
2018-02-23 18:27 ` [PATCH 4.9 115/145] scsi: advansys: fix uninitialized data access Greg Kroah-Hartman
2018-02-23 18:27 ` [PATCH 4.9 116/145] arm64: Kconfig: select COMPAT_BINFMT_ELF only when BINFMT_ELF is set Greg Kroah-Hartman
2018-02-23 18:27 ` [PATCH 4.9 117/145] ALSA: hda/ca0132 - fix possible NULL pointer use Greg Kroah-Hartman
2018-02-23 18:27 ` [PATCH 4.9 118/145] reiserfs: avoid a -Wmaybe-uninitialized warning Greg Kroah-Hartman
2018-02-23 18:27 ` [PATCH 4.9 120/145] security/keys: BIG_KEY requires CONFIG_CRYPTO Greg Kroah-Hartman
2018-02-23 18:27 ` [PATCH 4.9 121/145] drm: exynos: mark pm functions as __maybe_unused Greg Kroah-Hartman
2018-02-23 18:27 ` [PATCH 4.9 127/145] [media] tc358743: fix register i2c_rd/wr functions Greg Kroah-Hartman
2018-02-23 18:27 ` [PATCH 4.9 128/145] [media] go7007: add MEDIA_CAMERA_SUPPORT dependency Greg Kroah-Hartman
2018-02-23 18:27 ` [PATCH 4.9 129/145] [media] em28xx: only use mt9v011 if camera support is enabled Greg Kroah-Hartman
2018-02-23 18:27 ` [PATCH 4.9 130/145] [media] tw5864: use dev_warn instead of WARN to shut up warning Greg Kroah-Hartman
2018-02-23 18:27 ` [PATCH 4.9 131/145] ISDN: eicon: reduce stack size of sig_ind function Greg Kroah-Hartman
2018-02-23 18:27 ` [PATCH 4.9 132/145] clk: meson: gxbb: fix build error without RESET_CONTROLLER Greg Kroah-Hartman
2018-02-23 18:27 ` [PATCH 4.9 133/145] kasan: rework Kconfig settings Greg Kroah-Hartman
2018-02-23 18:27 ` [PATCH 4.9 134/145] drm/i915: hide unused intel_panel_set_backlight function Greg Kroah-Hartman
2018-02-23 18:27 ` [PATCH 4.9 135/145] arm64: sunxi: always enable reset controller Greg Kroah-Hartman
2018-02-23 18:27 ` [PATCH 4.9 136/145] binfmt_elf: compat: avoid unused function warning Greg Kroah-Hartman
2018-02-23 18:27 ` [PATCH 4.9 137/145] spi: bcm-qspi: shut up warning about cfi header inclusion Greg Kroah-Hartman
2018-04-03 17:46   ` [4.9, " Florian Fainelli
2018-04-06  7:09     ` gregkh
2018-04-06  7:22       ` Arnd Bergmann
2018-04-06 15:55         ` Florian Fainelli
2018-02-23 18:27 ` [PATCH 4.9 138/145] idle: i7300: add PCI dependency Greg Kroah-Hartman
2018-02-23 18:27 ` [PATCH 4.9 139/145] arm64: fix warning about swapper_pg_dir overflow Greg Kroah-Hartman
2018-02-23 18:27 ` [PATCH 4.9 140/145] usb: phy: msm add regulator dependency Greg Kroah-Hartman
2018-02-23 18:27 ` [PATCH 4.9 141/145] x86/microcode/AMD: Change load_microcode_amd()s param to bool to fix preemptibility bug Greg Kroah-Hartman
2018-02-23 18:27 ` [PATCH 4.9 145/145] crypto: s5p-sss - Fix kernel Oops in AES-ECB mode Greg Kroah-Hartman
2018-02-24  0:36 ` [PATCH 4.9 000/145] 4.9.84-stable review Shuah Khan
2018-02-24 17:56 ` Guenter Roeck
2018-02-25  3:36 ` Dan Rue

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=20180223170732.680009918@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=alexander.levin@microsoft.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maddy@linux.vnet.ibm.com \
    --cc=mpe@ellerman.id.au \
    --cc=ravi.bangoria@linux.vnet.ibm.com \
    --cc=stable@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;
as well as URLs for NNTP newsgroup(s).