]> git.baikalelectronics.ru Git - kernel.git/commit
perf_events: Fix perf_counter_mmap() hook in mprotect()
authorPekka Enberg <penberg@kernel.org>
Mon, 8 Nov 2010 19:29:07 +0000 (21:29 +0200)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 9 Nov 2010 18:19:38 +0000 (10:19 -0800)
commitf3e8af283b9cc154df5736a3f43f4af84c42e270
treeb01a10267b8e702af948e571801f02ee70ff1794
parent9b9e14f159d1939effd5ea4656ce064c13ab2369
perf_events: Fix perf_counter_mmap() hook in mprotect()

As pointed out by Linus, commit 06fbf3c ("perf_counter: Add mmap event hooks to
mprotect()") is fundamentally wrong as mprotect_fixup() can free 'vma' due to
merging. Fix the problem by moving perf_event_mmap() hook to
mprotect_fixup().

Note: there's another successful return path from mprotect_fixup() if old
flags equal to new flags. We don't, however, need to call
perf_event_mmap() there because 'perf' already knows the VMA is
executable.

Reported-by: Dave Jones <davej@redhat.com>
Analyzed-by: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Ingo Molnar <mingo@elte.hu>
Reviewed-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/mprotect.c