Skip to content

Commit 95f6008

Browse files
virtuosoIngo Molnar
authored andcommitted
perf/x86/intel/pt: Fix an off-by-one in address filter configuration
PT address filter configuration requires that a range is specified by its first and last address, but at the moment we're obtaining the end of the range by adding user specified size to its start, which is off by one from what it actually needs to be. Fix this and make sure that zero-sized filters don't pass the filter validation. Reported-by: Adrian Hunter <[email protected]> Signed-off-by: Alexander Shishkin <[email protected]> Acked-by: Peter Zijlstra <[email protected]> Cc: Arnaldo Carvalho de Melo <[email protected]> Cc: Arnaldo Carvalho de Melo <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Stephane Eranian <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Vince Weaver <[email protected]> Cc: [email protected] # v4.7 Cc: [email protected]#v4.7 Cc: [email protected] Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Ingo Molnar <[email protected]>
1 parent cecf623 commit 95f6008

File tree

1 file changed

+2
-2
lines changed
  • arch/x86/events/intel

1 file changed

+2
-2
lines changed

arch/x86/events/intel/pt.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1081,7 +1081,7 @@ static int pt_event_addr_filters_validate(struct list_head *filters)
10811081

10821082
list_for_each_entry(filter, filters, entry) {
10831083
/* PT doesn't support single address triggers */
1084-
if (!filter->range)
1084+
if (!filter->range || !filter->size)
10851085
return -EOPNOTSUPP;
10861086

10871087
if (!filter->inode && !kernel_ip(filter->offset))
@@ -1111,7 +1111,7 @@ static void pt_event_addr_filters_sync(struct perf_event *event)
11111111
} else {
11121112
/* apply the offset */
11131113
msr_a = filter->offset + offs[range];
1114-
msr_b = filter->size + msr_a;
1114+
msr_b = filter->size + msr_a - 1;
11151115
}
11161116

11171117
filters->filter[range].msr_a = msr_a;

0 commit comments

Comments
 (0)