linux/arch/x86/kernel
Andrey Vagin 20afc60f89 x86, perf: Check that current->mm is alive before getting user callchain
An event may occur when an mm is already released.

I added an event in dequeue_entity() and caught a panic with
the following backtrace:

[  434.421110] BUG: unable to handle kernel NULL pointer dereference at 0000000000000050
[  434.421258] IP: [<ffffffff810464ac>] __get_user_pages_fast+0x9c/0x120
...
[  434.421258] Call Trace:
[  434.421258]  [<ffffffff8101ae81>] copy_from_user_nmi+0x51/0xf0
[  434.421258]  [<ffffffff8109a0d5>] ? sched_clock_local+0x25/0x90
[  434.421258]  [<ffffffff8101b048>] perf_callchain_user+0x128/0x170
[  434.421258]  [<ffffffff811154cd>] ? __perf_event_header__init_id+0xed/0x100
[  434.421258]  [<ffffffff81116690>] perf_prepare_sample+0x200/0x280
[  434.421258]  [<ffffffff81118da8>] __perf_event_overflow+0x1b8/0x290
[  434.421258]  [<ffffffff81065240>] ? tg_shares_up+0x0/0x670
[  434.421258]  [<ffffffff8104fe1a>] ? walk_tg_tree+0x6a/0xb0
[  434.421258]  [<ffffffff81118f44>] perf_swevent_overflow+0xc4/0xf0
[  434.421258]  [<ffffffff81119150>] do_perf_sw_event+0x1e0/0x250
[  434.421258]  [<ffffffff81119204>] perf_tp_event+0x44/0x70
[  434.421258]  [<ffffffff8105701f>] ftrace_profile_sched_block+0xdf/0x110
[  434.421258]  [<ffffffff8106121d>] dequeue_entity+0x2ad/0x2d0
[  434.421258]  [<ffffffff810614ec>] dequeue_task_fair+0x1c/0x60
[  434.421258]  [<ffffffff8105818a>] dequeue_task+0x9a/0xb0
[  434.421258]  [<ffffffff810581e2>] deactivate_task+0x42/0xe0
[  434.421258]  [<ffffffff814bc019>] thread_return+0x191/0x808
[  434.421258]  [<ffffffff81098a44>] ? switch_task_namespaces+0x24/0x60
[  434.421258]  [<ffffffff8106f4c4>] do_exit+0x464/0x910
[  434.421258]  [<ffffffff8106f9c8>] do_group_exit+0x58/0xd0
[  434.421258]  [<ffffffff8106fa57>] sys_exit_group+0x17/0x20
[  434.421258]  [<ffffffff8100b202>] system_call_fastpath+0x16/0x1b

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: stable@kernel.org
Link: http://lkml.kernel.org/r/1314693156-24131-1-git-send-email-avagin@openvz.org
Signed-off-by: Ingo Molnar <mingo@elte.hu>
2011-08-31 15:56:31 +02:00
..
acpi x86 idle: move mwait_idle_with_hints() to where it is used 2011-08-03 19:06:36 -04:00
apic x86, UV: Remove UV delay in starting slave cpus 2011-08-05 23:48:34 +02:00
cpu x86, perf: Check that current->mm is alive before getting user callchain 2011-08-31 15:56:31 +02:00
.gitignore
alternative.c x86-64: Move vread_tsc and vread_hpet into the vDSO 2011-07-14 17:57:05 -07:00
amd_gart_64.c atomic: use <linux/atomic.h> 2011-07-26 16:49:47 -07:00
amd_nb.c
apb_timer.c Merge branch 'timers-clocksource-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip 2011-07-23 10:34:47 -07:00
aperture_64.c
apm_32.c i8253: Cleanup outb/inb magic 2011-07-01 10:37:15 +02:00
asm-offsets_32.c lguest: use a special 1:1 linear pagetable mode until first switch. 2011-07-22 14:39:48 +09:30
asm-offsets_64.c
asm-offsets.c
audit_64.c
bootflag.c
check.c
cpuid.c
crash_dump_32.c
crash_dump_64.c
crash.c
devicetree.c Merge branch 'of-pci' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc 2011-07-22 14:54:02 -07:00
doublefault_32.c
dumpstack_32.c
dumpstack_64.c x86: Don't use frame pointer to save old stack on irq entry 2011-07-02 18:06:36 +02:00
dumpstack.c
e820.c
early_printk.c
early-quirks.c
entry_32.S x86-32: Fix boot with CONFIG_X86_INVD_BUG 2011-08-25 13:27:14 -07:00
entry_64.S Merge branch 'x86-vdso-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-tip 2011-08-12 20:46:24 -07:00
ftrace.c
head32.c
head64.c
head_32.S
head_64.S
head.c
hpet.c Merge branch 'x86-vdso-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip 2011-07-22 17:05:15 -07:00
hw_breakpoint.c
i386_ksyms_32.c
i387.c treewide: fix potentially dangerous trailing ';' in #defined values/expressions 2011-07-21 14:10:00 +02:00
i8237.c
i8253.c x86: Use common i8253 clockevent 2011-07-01 10:37:14 +02:00
i8259.c atomic: use <linux/atomic.h> 2011-07-26 16:49:47 -07:00
init_task.c
io_delay.c
ioport.c
irq_32.c
irq_64.c
irq_work.c
irq.c
irqinit.c atomic: use <linux/atomic.h> 2011-07-26 16:49:47 -07:00
jump_label.c
kdebugfs.c
kgdb.c perf: Add context field to perf_event 2011-07-01 11:06:38 +02:00
kprobes.c
kvm.c KVM guest: KVM Steal time registration 2011-07-24 11:49:36 +03:00
kvmclock.c KVM guest: KVM Steal time registration 2011-07-24 11:49:36 +03:00
ldt.c
machine_kexec_32.c
machine_kexec_64.c
Makefile Merge branch 'x86-vdso-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-tip 2011-08-12 20:46:24 -07:00
mca_32.c
microcode_amd.c
microcode_core.c
microcode_intel.c
mmconf-fam10h_64.c
module.c modules: make arch's use default loader hooks 2011-07-24 22:06:04 +09:30
mpparse.c
msr.c
paravirt_patch_32.c
paravirt_patch_64.c
paravirt-spinlocks.c
paravirt.c Merge branch 'x86-vdso-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-tip 2011-08-12 20:46:24 -07:00
pci-calgary_64.c
pci-dma.c
pci-iommu_table.c
pci-nommu.c
pci-swiotlb.c
pcspeaker.c
probe_roms.c
process_32.c cpuidle: stop depending on pm_idle 2011-08-03 19:06:37 -04:00
process_64.c cpuidle: stop depending on pm_idle 2011-08-03 19:06:37 -04:00
process.c x86 idle: move mwait_idle_with_hints() to where it is used 2011-08-03 19:06:36 -04:00
ptrace.c perf: Add context field to perf_event 2011-07-01 11:06:38 +02:00
pvclock.c
quirks.c x86, quirks: Use pci_dev->revision 2011-07-21 10:26:00 +02:00
reboot_32.S
reboot_fixups_32.c
reboot.c x86: Make Dell Latitude E6420 use reboot=pci 2011-07-21 11:47:17 -07:00
relocate_kernel_32.S kexec, x86: Fix incorrect jump back address if not preserving context 2011-07-21 11:19:28 +02:00
relocate_kernel_64.S kexec, x86: Fix incorrect jump back address if not preserving context 2011-07-21 11:19:28 +02:00
resource.c
rtc.c
setup_percpu.c
setup.c
signal.c x86: Kill handle_signal()->set_fs() 2011-07-14 21:46:20 -07:00
smp.c
smpboot.c Merge branch 'x86-cleanups-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip 2011-07-22 17:02:38 -07:00
stacktrace.c
step.c x86-64: Add user_64bit_mode paravirt op 2011-08-04 16:13:49 -07:00
sys_i386_32.c
sys_x86_64.c
syscall_64.c
syscall_table_32.S All Arch: remove linkage for sys_nfsservctl system call 2011-08-26 15:09:58 -07:00
tboot.c net: remove mm.h inclusion from netdevice.h 2011-06-21 19:17:20 -07:00
tce_64.c
test_nx.c
test_rodata.c
time.c
tls.c
tls.h
topology.c
trampoline_32.S
trampoline_64.S
trampoline.c
traps.c Merge branch 'x86-vdso-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-tip 2011-08-12 20:46:24 -07:00
tsc_sync.c
tsc.c Merge branches 'x86-detect-hyper-for-linus', 'x86-fpu-for-linus', 'x86-kexec-for-linus', 'x86-platform-for-linus', 'x86-quirks-for-linus', 'x86-tsc-for-linus' and 'x86-smpboot-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip 2011-07-23 10:38:21 -07:00
verify_cpu.S
vm86_32.c
vmlinux.lds.S x86-64: Rework vsyscall emulation and add vsyscall= parameter 2011-08-10 19:26:46 -05:00
vsmp_64.c
vsyscall_64.c x86-64: Rework vsyscall emulation and add vsyscall= parameter 2011-08-10 19:26:46 -05:00
vsyscall_emu_64.S x86-64: Rework vsyscall emulation and add vsyscall= parameter 2011-08-10 19:26:46 -05:00
vsyscall_trace.h x86-64: Add vsyscall:emulate_vsyscall trace event 2011-08-04 16:13:53 -07:00
x86_init.c
x8664_ksyms_64.c
xsave.c