Patch "sparc64: Fix pcr_ops initialization and usage bugs." has been added to the 3.14-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    sparc64: Fix pcr_ops initialization and usage bugs.

to the 3.14-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     sparc64-fix-pcr_ops-initialization-and-usage-bugs.patch
and it can be found in the queue-3.14 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.


>From foo@baz Tue Oct 28 11:13:19 CST 2014
From: "David S. Miller" <davem@xxxxxxxxxxxxx>
Date: Mon, 11 Aug 2014 15:38:46 -0700
Subject: sparc64: Fix pcr_ops initialization and usage bugs.

From: "David S. Miller" <davem@xxxxxxxxxxxxx>

[ Upstream commit 8bccf5b313180faefce38e0d1140f76e0f327d28 ]

Christopher reports that perf_event_print_debug() can crash in uniprocessor
builds.  The crash is due to pcr_ops being NULL.

This happens because pcr_arch_init() is only invoked by smp_cpus_done() which
only executes in SMP builds.

init_hw_perf_events() is closely intertwined with pcr_ops being setup properly,
therefore:

1) Call pcr_arch_init() early on from init_hw_perf_events(), instead of
   from smp_cpus_done().

2) Do not hook up a PMU type if pcr_ops is NULL after pcr_arch_init().

3) Move init_hw_perf_events to a later initcall so that it we will be
   sure to invoke pcr_arch_init() after all cpus are brought up.

Finally, guard the one naked sequence of pcr_ops dereferences in
__global_pmu_self() with an appropriate NULL check.

Reported-by: Christopher Alexander Tobias Schulze <cat.schulze@xxxxxxxxxxxxx>
Signed-off-by: David S. Miller <davem@xxxxxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
 arch/sparc/kernel/perf_event.c |    7 +++++--
 arch/sparc/kernel/process_64.c |    3 +++
 arch/sparc/kernel/smp_64.c     |    1 -
 3 files changed, 8 insertions(+), 3 deletions(-)

--- a/arch/sparc/kernel/perf_event.c
+++ b/arch/sparc/kernel/perf_event.c
@@ -1671,9 +1671,12 @@ static bool __init supported_pmu(void)
 
 int __init init_hw_perf_events(void)
 {
+	int err;
+
 	pr_info("Performance events: ");
 
-	if (!supported_pmu()) {
+	err = pcr_arch_init();
+	if (err || !supported_pmu()) {
 		pr_cont("No support for PMU type '%s'\n", sparc_pmu_type);
 		return 0;
 	}
@@ -1685,7 +1688,7 @@ int __init init_hw_perf_events(void)
 
 	return 0;
 }
-early_initcall(init_hw_perf_events);
+pure_initcall(init_hw_perf_events);
 
 void perf_callchain_kernel(struct perf_callchain_entry *entry,
 			   struct pt_regs *regs)
--- a/arch/sparc/kernel/process_64.c
+++ b/arch/sparc/kernel/process_64.c
@@ -306,6 +306,9 @@ static void __global_pmu_self(int this_c
 	struct global_pmu_snapshot *pp;
 	int i, num;
 
+	if (!pcr_ops)
+		return;
+
 	pp = &global_cpu_snapshot[this_cpu].pmu;
 
 	num = 1;
--- a/arch/sparc/kernel/smp_64.c
+++ b/arch/sparc/kernel/smp_64.c
@@ -1395,7 +1395,6 @@ void __cpu_die(unsigned int cpu)
 
 void __init smp_cpus_done(unsigned int max_cpus)
 {
-	pcr_arch_init();
 }
 
 void smp_send_reschedule(int cpu)


Patches currently in stable-queue which might be from davem@xxxxxxxxxxxxx are

queue-3.14/sparc64-adjust-vmalloc-region-size-based-upon-available-virtual-address-bits.patch
queue-3.14/sparc64-fix-fpu-register-corruption-with-aes-crypto-offload.patch
queue-3.14/sparc64-move-request_irq-from-ldc_bind-to-ldc_alloc.patch
queue-3.14/sparc32-dma_alloc_coherent-must-honour-gfp-flags.patch
queue-3.14/sparc64-kill-unnecessary-tables-and-increase-max_banks.patch
queue-3.14/sparc-let-memset-return-the-address-argument.patch
queue-3.14/sparc64-use-kernel-page-tables-for-vmemmap.patch
queue-3.14/sparc64-sparse-irq.patch
queue-3.14/sparc64-fix-physical-memory-management-regressions-with-large-max_phys_bits.patch
queue-3.14/sparc64-fix-lockdep-warnings-on-reboot-on-ultra-5.patch
queue-3.14/sparc64-switch-to-4-level-page-tables.patch
queue-3.14/sparc64-sun4v-tlb-error-power-off-events.patch
queue-3.14/sparc64-increase-size-of-boot-string-to-1024-bytes.patch
queue-3.14/sparc64-find_node-adjustment.patch
queue-3.14/sparc64-fix-reversed-start-end-in-flush_tlb_kernel_range.patch
queue-3.14/sparc64-increase-max_phys_address_bits-to-53.patch
queue-3.14/sparc64-define-va-hole-at-run-time-rather-than-at-compile-time.patch
queue-3.14/sparc64-fix-register-corruption-in-top-most-kernel-stack-frame-during-boot.patch
queue-3.14/sparc64-do-not-disable-interrupts-in-nmi_cpu_busy.patch
queue-3.14/sparc64-support-m6-and-m7-for-building-cpu-distribution-map.patch
queue-3.14/sparc64-cpu-hardware-caps-support-for-sparc-m6-and-m7.patch
queue-3.14/sparc64-do-not-define-thread-fpregs-save-area-as-zero-length-array.patch
queue-3.14/sparc64-t5-pmu.patch
queue-3.14/sparc64-adjust-ktsb-assembler-to-support-larger-physical-addresses.patch
queue-3.14/sparc64-implement-__get_user_pages_fast.patch
queue-3.14/sparc64-fix-corrupted-thread-fault-code.patch
queue-3.14/sparc64-fix-hibernation-code-refrence-to-page_offset.patch
queue-3.14/sparc64-correctly-recognise-m6-and-m7-cpu-type.patch
queue-3.14/sparc64-fix-pcr_ops-initialization-and-usage-bugs.patch
--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]