1
0
Fork 0
alistair23-linux/kernel/events
Song Liu 7438239690 perf/core: Fix mlock accounting in perf_mmap()
commit 003461559e upstream.

Decreasing sysctl_perf_event_mlock between two consecutive perf_mmap()s of
a perf ring buffer may lead to an integer underflow in locked memory
accounting. This may lead to the undesired behaviors, such as failures in
BPF map creation.

Address this by adjusting the accounting logic to take into account the
possibility that the amount of already locked memory may exceed the
current limit.

Fixes: c4b7547974 ("perf/core: Make the mlock accounting simple again")
Suggested-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Signed-off-by: Song Liu <songliubraving@fb.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: <stable@vger.kernel.org>
Acked-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Link: https://lkml.kernel.org/r/20200123181146.2238074-1-songliubraving@fb.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-02-11 04:35:54 -08:00
..
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
callchain.c perf/core: Convert to SPDX license identifiers 2019-02-04 08:46:11 +01:00
core.c perf/core: Fix mlock accounting in perf_mmap() 2020-02-11 04:35:54 -08:00
hw_breakpoint.c perf/hw_breakpoint: Fix arch_hw_breakpoint use-before-initialization 2019-09-06 08:24:01 +02:00
internal.h perf/ring-buffer: Use regular variables for nesting 2019-05-24 09:00:11 +02:00
ring_buffer.c perf/ring-buffer: Use regular variables for nesting 2019-05-24 09:00:11 +02:00
uprobes.c kernel/events/uprobes.c: only do FOLL_SPLIT_PMD for uprobe register 2019-10-19 06:32:33 -04:00