Skip to content

Commit 23931d9

Browse files
committed
Merge tag 'perf-urgent-2023-10-14' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 perf event fix from Ingo Molnar: "Fix an LBR sampling bug" * tag 'perf-urgent-2023-10-14' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: perf/x86/lbr: Filter vsyscall addresses
2 parents 70f8c6f + e538997 commit 23931d9

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

arch/x86/events/utils.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// SPDX-License-Identifier: GPL-2.0
22
#include <asm/insn.h>
3+
#include <linux/mm.h>
34

45
#include "perf_event.h"
56

@@ -132,9 +133,9 @@ static int get_branch_type(unsigned long from, unsigned long to, int abort,
132133
* The LBR logs any address in the IP, even if the IP just
133134
* faulted. This means userspace can control the from address.
134135
* Ensure we don't blindly read any address by validating it is
135-
* a known text address.
136+
* a known text address and not a vsyscall address.
136137
*/
137-
if (kernel_text_address(from)) {
138+
if (kernel_text_address(from) && !in_gate_area_no_mm(from)) {
138139
addr = (void *)from;
139140
/*
140141
* Assume we can get the maximum possible size

0 commit comments

Comments
 (0)